[antlr-interest] litterals and semantic or syntactic predicates?

Terence Parr parrt at cs.usfca.edu
Thu Jun 2 10:16:43 PDT 2005


On Jun 2, 2005, at 9:48 AM, Magne Andreassen wrote:

> hi,
>
> having two parser rules like:
>
> ruleone : "say" ( "hello-world" | subrule ) ;
>
> ruletwo : "hello" ( subrule )+ ;
>
> subrule : INT ;
>
> trying to parse:
> say hello-world
> hello 42
>
> i get an error message saying:
> line 1:1: unexpected token: hello
>
> the first "hello-world" is counted as two tokens?

Yes, well 3 probably.  Most likely you don't have a token rule that  
matches '-' in a word.

Ter


More information about the antlr-interest mailing list