Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Add non English variable names #39

Open
LordPanda95 opened this issue Apr 2, 2023 · 3 comments
Open

[Feature Request] Add non English variable names #39

LordPanda95 opened this issue Apr 2, 2023 · 3 comments
Labels
enhancement New feature or request question Further information is requested

Comments

@LordPanda95
Copy link

Please add not only English variable name

@LordPanda95 LordPanda95 changed the title Add non English variable names [Feature Request] Add non English variable names Apr 2, 2023
@gtg922r
Copy link
Owner

gtg922r commented May 25, 2024

What do you mean by variable names? Any variable name will work today.

Do you mean the built-in functions and physical constants such as speedOfLight?

@gtg922r gtg922r added enhancement New feature or request question Further information is requested labels May 25, 2024
@LennoC
Copy link

LennoC commented Jul 16, 2024

What do you mean by variable names? Any variable name will work today.

Do you mean the built-in functions and physical constants such as speedOfLight?

I think his meaning is that we can't type non-English words in the math block, an error SyntaxError will be reported.

e.g

math block
# Here can be writen in non-English word, eg Chinese-测试 Russian-Я думаю
# below the calc process, No non-English words can appear in.
Apple = 3 # This is OK.
苹果 = 3 # This line will occur `SynataError`

@egwynn
Copy link

egwynn commented Aug 1, 2024

This is a limitation of mathjs, and I don't think it should be in scope of this project. Here's an MRE:

import { evaluate } from 'mathjs';
evaluate('a = 1');
evaluate('好 = 1');

This will produce the error you saw:

SyntaxError: Syntax error in part "好 = 1" (char 1)

Note that mathjs has published a syntax doc which specifies allowed variable names. To quote their docs:

Variable names must:

  • Begin with an “alpha character”, which is:
    • A latin letter (upper or lower case). Ascii: a-z, A-Z
    • An underscore. Ascii: _
    • A dollar sign. Ascii: $
    • A latin letter with accents. Unicode: \u00C0 - \u02AF
    • A greek letter. Unicode: \u0370 - \u03FF
    • A letter-like character. Unicode: \u2100 - \u214F
    • A mathematical alphanumeric symbol. Unicode: \u{1D400} - \u{1D7FF} excluding invalid code points
  • Contain only alpha characters (above) and digits 0-9
  • Not be any of the following: mod, to, in, and, xor, or, not, end. It is possible to assign to some of these, but that’s not recommended.

I recommend closing this issue and taking it up with mathjs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants