I don't get any exception. BTW, it is good to match the entire 'phrase' as
one token in the lexical analysis itself. Something like:

 

PHRASE      :    ( '0'..'9' | 'A'..'Z' | ' ' | '\t')+ ;

 

and modify stmt to:

 

stmt :    SUBJ_TOK COLON PHRASE NL+ ;

 

Else, you'll end up creating too many tokens (one per each char).

 

Cheers, Indhu

 

 

From: [email protected]
[mailto:[email protected]] On Behalf Of Sylvain, Gregory
[USA]
Sent: Monday, June 08, 2009 6:03 PM
To: [email protected]
Subject: [antlr-interest] Newbie grammar question...

 

Hello all,

 

I thought I've done a million times, but that was a while ago and now I
can't get this to work.  Can someone point me in the right direction:

 

 

stmt :    SUBJ_TOK COLON PHRASE+ NL+ ;

 

SUBJ_TOK   :     'SUBJECT' ;

COLON        :     ':' ;

PHRASE      :    ( '0'..'9' | 'A'..'Z' | ' ' | '\t') ;

NL                :    ( '\r' | '\n' ) ;

 

 

I keep getting EarlyExitException on all input when the ANTLR get to the
PHRASE.

 

"SUBJECT: FOO\n" ==> reads SUBJECT_TOK COLON "F" EarlyExitException and
Resync

 

Thanks in advance for your clarifications.

Greg

 


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

Reply via email to