tags:

views:

48

answers:

1

Hi, i like to define a very simple rule, which should represent identifiers. This works quite well for identifiers which are longer than one characters, but for identifiers with exactly one character I get a MismatchedTokenException(64!=45). This is the rule:

ID : ('a'..'z' | 'A'..'Z')+ ;

What is wrong with that?

Thanks!

+1  A: 

You're absolutely right, the rule on its own is fine, but I figured out that a lot in ANTLR depends on the order of rules. I had another rule before, which did already match the ID rule. Finally it makes sense, because the Lexer cannot decide which rule to take.

Thanks!

stebln
If you've solved your own problem, please accept your own answer to get the question out of everyone's way.
bemace