-
Notifications
You must be signed in to change notification settings - Fork 393
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
Move definitions of expression rules. #162
Conversation
ah it breaks blame. will fix it. |
725289f
to
e34b62c
Compare
e34b62c
to
3ae62c1
Compare
I see you've marked as blocked by #161, but feel free to merge if working. I can resolve any conflicts in my branch later on. |
@ZibingZhang Sure, removed the reference. |
(ast.Attribute(), expression_rules._INF_PRECEDENCE), | ||
], | ||
) | ||
def test_get_precedence(tree: ast.AST, precedence: int) -> None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Half the tests call this argument tree
and the other half node
. Personally I prefer node
but don't really care but would make it easier to understand tests if the same variable name was used across them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
renamed to node
anyway since the name has been used in codegens. tree
is used in frontend though. I prefer this name a bit because it slightly means "entire tree" rather than the fragment. (But this is just a bike-shedding problem I guess)
|
||
|
||
# name => left_syntax, right_syntax, is_wrapped | ||
BUILTIN_FUNCS: dict[str, FunctionRule] = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assuming this constant doesn't have a _
prefix since it's imported from another file. In that case, shouldn't _MATH_SYMBOLS
in math_symbols.py
also have it's _
prefix removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moved _MATH_SYMBOLS
to expression_rules.MATH_SYMBOLS
|
||
|
||
@pytest.mark.parametrize( | ||
"tree,precedence", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tree -> node (or node -> tree)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yeah thanks!
Overview
This change doesn't introduce any new features.
This change moves all rule definitions for
ExpressionCodegen
toexpression_rules.py
.CC @ZibingZhang
Details
References
Blocked by