On 04/09/2010 11:50 AM, Bart Kiers wrote:
> On Fri, Apr 9, 2010 at 10:56 AM, Dietmar Schaefer<[email protected]>wrote:
>
>
Well - that explains everything.
I moved - at a first solution - the VALUE rule before the ID rule - it
works.
Thank you and Chris for your help.
regards
Dietmar
> When stumbling upon the 'A' from 'A1200', the lexer tries to complete an
> ID-rule. Try moving the VALUE-rule before the ID-rule:
>
> grammar Test;
>
> scenario
> : statement
> ;
>
>
> statement
> : sequenceStatement
> ;
>
> sequenceStatement
> : 'DefSequence' ID '{' VALUE '}' ';'?
> ;
>
> VALUE
> : ('A' | 'B' | 'C') DIGIT DIGIT DIGIT DIGIT
> | ('-')*
> ;
>
> ID
> : LETTER (LETTER | DIGIT | '_')*
> ;
>
> fragment
> DIGIT
> : '0'..'9'
> ;
>
> fragment
> LETTER
> : 'a'..'z' | 'A'..'Z'
> ;
>
> WHITESPACE
> : ('\t' | ' ' | '\n' | '\r')+ {$channel = HIDDEN;}
> ;
>
> But note that your ID's can then not start with 'A', 'B' or 'C'! If you want
> that, look into semantic predicates:
> http://www.antlr.org/doc/glossary.html#Predicate,_semantic
>
> Regards,
>
> Bart.
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe:
> http://www.antlr.org/mailman/options/antlr-interest/your-email-address
>
>
List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org/mailman/options/antlr-interest/your-email-address
--
You received this message because you are subscribed to the Google Groups
"il-antlr-interest" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/il-antlr-interest?hl=en.