Getting: warning, rule cannot be matched

Review the order of your rules because it's important for example!

  1 [.] 
  2 "foo"

here the second rule will never be matched.


The warning tells you that anything that might be matched by {cteI} will always be matched by some earlier rule. In your case, it indicates that a rule doesn't match what you expect it does, probably due to a typo. In your case, its the {id} rule, which you define as:

([a-z]|[A-Z)([a-z]|[A-Z]|[0-9])*

Notice the nesting of the parentheses and square brackets. Adding spaces for clarity, this is

( [a-z] | [A-Z)([a-z] | [A-Z] | [0-9] )*

This will match any sequence of letters, digits, or the characters ( ) or [. You probably meant:

([a-z]|[A-Z])([a-z]|[A-Z]|[0-9])*

which can be more clearly written as

[a-zA-Z][a-zA-Z0-9]*