lark
lark copied to clipboard
Extracting terminals in Transformer?
I am trying to extract terminals in the Transform method. The way I have the rule set up is the following:
rel_op: "==" | "<" | ">" | "<=" | ">=" | "!=" | "<:" | "≠" | "≤" | "≥"
I have a function:
def rel_op(self, items):
# print("rel_op", items)
return items
But it always prints out a []
Whenever I try to make this rule a terminal by capitalizing it to REL_OP and replacing it with all old occurrences of rel_op, I get the following...
lark.exceptions.UnexpectedToken: Unexpected token Token('LESSTHAN', '<') at line 155, column 16.
The rule:
REL_OP: "==" | "<" | ">" | "<=" | ">=" | "!=" | "<:" | "≠" | "≤" | "≥"
Why does changing the rule to a terminal now cause this issue?
Thank you!