W103 Alternative that an earlier one shadowsΒΆ

An alternative starts with everything that an earlier alternative of its choice consists of, or repeats it. Where the earlier one matches, the choice takes it. Where it fails, the later one fails at the same place. So the later alternative never matches. Fields and aliases make no difference to this, since they change the tree and not what is matched.

start: call
call: NAME "(" ")" | NAME "(" ")" "?" -> optional_call
NAME: [a-z]+
grammar.fpeg:2:22: warning[W103]: this alternative never matches, since it starts with the whole of an earlier one

Put the longer alternative first.

start: call
call: NAME "(" ")" "?" -> optional_call | NAME "(" ")"
NAME: [a-z]+