-
Notifications
You must be signed in to change notification settings - Fork 37
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
Variables should resolve before keywords. #31
Comments
Thanks for the report, you're right that this is unintentional. It's is an issue with the parser and somewhat related to #10. For example,
The issue is in the I think this could be improved fairly easily by simply avoiding splitting up coherent word tokens (e.g. potential variable/function names). The Feel free to have a stab at this, and let me know if you have any further questions. On a side note, I've started rewriting the parser to use a grammar-based approach as described in this comment. The WIP code is on the feature-parser-rewrite branch but it's still missing support for parsing functions, and I'm not sure when I'll get around to finishing that off. I'd be happy to accept a contribution to either the existing or new WIP parser code. |
For now, I may just use a workaround of using a regex replace for all variables instead of using the |
The new parser handles this much better, so the bug with parsing identifiers containing This leaves two points from this ticket:
|
Great library, one small issue I'm having though. It seems like you resolve built-in keywords/functions before the variables (from the ContextModel) are resolved. This yields a couple of problems.
If I bind a variable name like
score
, the library seems to be trying to resolvee
and subsequently doesn't properly resolvescore
(as I presume its then trying to resolvescor
?). This happens whenever any variable name contains a built-in keyword. Other examples of invalid variable names:variable
ceiling
resin
Basically anything that contains
e
or a built-in function likesin
,ceil
, etc.Also, it should be noted in my use case that variables can be named anything (my users define variables).
So for example, a variable name could be something like
qw%d
. This is more of a special case, and not really needed, but it would be nice if your code was smart enough to tell that this is probably a variable name and not awd
andd
separated by a modulus. Although, if you're resolving variables first, this actually should be a fairly trivial case to handle.Thanks! I can also take a look at fixing this if you point me in a right direction / have any pointers.
The text was updated successfully, but these errors were encountered: