Consider this part of the grammar:
def expression = SimpleExpression ~ opt(relation ~ SimpleExpression)
def relation = "=" | "#" | "<=" | "<" | ">=" | ">" | "IN" | "IS"
def SimpleExpression = opt("+" | "-") ~ rep1sep (term, AddOperator)
def AddOperator = "+" | "-" | "OR"
def term = factor ~ rep(MulOperator ~ factor)
def MulOperator = "*" | "/" | "DIV" | "MOD" | "&"
def factor: Parser[Any] = number | "(" ~ expression ~ ")" | "~" ~ factor
Is it necessary to rewrite parts of it to create new rules, or is there just a method (like |
vs. |||
for first vs. longest rule matching) I'm currently missing which does the necessary thing?