Robert Fox
Robert Fox
I have a rule that basically does: `number_over_number: NUMBER FORWARD_SLASH NUMBER` Then I need to validate that this number is a fraction. If it is "1/2" I've been able to...
How could I validate that the first number is less than the second number? I've been parsing and then post-processing...
Ok here is my complete example: ``` import logging from lark import Lark, Transformer, Token, Tree, logger from lark.visitors import Transformer_InPlace identifier_grammar = ''' start: token+ token: NUMBER -> number...
Basically my `number_over_number` is my *potential* fraction that I'm validating on the back end. If it doesn't turn out to be a fraction then I'd like to restore the tree...
Yes! That would be exactly what I need. It would make my code very nice to read.
First of all let me say THANK YOU for the fast response! It took me a bit to clone from github in a way that cooperated with my conda environment...
The new code seems to work fine--but there is one thing that really threw me for a loop in using a Transformer. If you specify a transformer in the Lark...
Here is my complete test on version 10 of lark-parser: ``` import logging from pprint import pprint from lark import Lark, Transformer, Token, Tree, logger from lark.visitors import Transformer_InPlace identifier_grammar...
@MegaIng I see your point. But I suppose I would prefer that returning the input would yield "no change". I suppose you would need to pass in all of the...
I see you points thank you. I would say 1) sometimes you want the option not to change (like in my example) and 2) creating / destroying objects every time...