-
-
Notifications
You must be signed in to change notification settings - Fork 394
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
Transformer Not Applying Expected Transformations in Lark Parser #1416
Comments
I think that you're right that your function isn't being called. That's because you defined it as |
Thank you for your assistance and explanation regarding the behavior of the ? prefix in Lark's grammar rules. Following your guidance, I have conducted further tests and confirmed that removing the ? prefix indeed allows the acos_func transformation method to be called as expected. Additionally, I discovered that if I retain the ? prefix in the rule ?acos_func: ("acos" | "ACOS") "(" NUMBER ")" but append -> acos_func at the end, the transformation method acos_func also gets called correctly. Could you please advise which solution is considered more optimal or appropriate in terms of Lark's best practices? Are there any considerations regarding performance, readability, or future maintenance that I should be aware of when choosing between these two approaches? Thank you once again for your support. Your explanation was instrumental in helping me understand and resolve the issue. |
Expected Behavior
I expect the output to be:
This is based on the transformation defined in
MyTransformer
class for theacos_func
.Actual Behavior
Instead of the expected string, the output is just:
This suggests that the transformation
acos_func
inMyTransformer
is not being applied.Environment
The text was updated successfully, but these errors were encountered: