At 18:56 1/12/2008, virg g wrote:
>If the command is
>TESTCMD CNT=2 VAL=TYPE:CNT
>
>It returs error "EarlyExitException" , if i change lexer rules i 
>get Mismatchtokenexception. But command is never successful. I 
>have figured out that If the literal contains any of these 
>keywords CNT, VAL, TYPE, RTEST parsing fails, that means it 
>igonres these tokens while parsing by parser eventhough these 
>tokens(eg CNT) is/are created by Lexer.
>How can i resolve this kind of problems. I cannot avoid having 
>these tokens in my command as the literal can be any of form. 
>Really i am stuck here.

Step 1: realise that using quoted literals in parser rules results 
in automatic creation of corresponding lexer rules with a funny 
name.  It's often clearer if you try to avoid doing this.

Step 2: realise that in ANTLR, the lexer runs to completion up 
front and outside of parser control.  So parser context has no 
influence on how things get tokenised.

Step 3: notice how your 'literal' rule doesn't mention any of the 
other literal tokens mentioned in step 1, so it's not surprising 
that it doesn't match them.

Step 4: realise that you can now fix it.

...

Step N: profit!  :)


List: http://www.antlr.org:8080/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org:8080/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
-~----------~----~----~----~------~----~------~--~---

Reply via email to