-
Notifications
You must be signed in to change notification settings - Fork 20
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
Allow variable to start with a letter #3
Comments
The simple support mechanism would be to implement a regex. The problem comes in that the tokenizer right now will greedily consume digits. So you could literally never have a variable that contained a digit (as it would be tokenized separately). This may be ok, as we could support alpha variables (without the leading The clean solution would be to rewrite the current system into a proper lexer rather than a dirty tokenizer. But that may be beyond the scope of the tool... |
I think for now I'd be happy with the inclusion of only alpha characters. Maybe just throw an exception if a variable is added that does not conform. |
I've been thinking about this and I think the fact digits would not be allowed in the equation is a good thing. For instance if you have 2y4x this would actually be 2 * y * 4 * x at the moment the code would pick up 2,x,4,x and I think this is right and no operator should be used as multiplication. |
Its 2016 and thank you for the parser. The regex I am using in tokenize function is:
But this regex makes leading $ required, as commented above. |
Detect variables by first character based on a regex that can be overridden. Default could be [a-zA-Z$].
This provides better usage for end users and closely resembles algebra
The text was updated successfully, but these errors were encountered: