Hi, I have set of commands which I need to parse. This is my sample grammar file. It is able to parse if command is
"TESTCMD CNT=2 VAL=TYPE:test123" 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. Also similarly i have set of different commands. If the parser finds any unknown command it returns error and breaks the parsing. But i want to continue to parse other commands. How to resume the parsing even if there are any unknown commands found? grammar testcmds; tokens{ RTEST='TESTCMD'; } commands: command+; //command:TESTCMD CNT= number 'VAL' '=' 'TYPE:' literal ; command: RTEST count_value type_value; count_value: 'CNT' '=' NUMBER; type_value: 'VAL' '=' 'TYPE' ':' value; value: literal; literal : (NUMBER|ALPHA|STRING)+ ; NUMBER : (DIGIT)+; ALPHA : ('a'..'z'|'A'..'Z')+ ; STRING: ('!' | '#'..'/' | '>'..'@' | '['..'`' | '{'..'~')+; fragment DIGIT : '0'..'9'; WHITESPACE : ( '\t' | ' ' | '\r' | '\n'| '\u000C' )+ { $channel = HIDDEN; }; Any help is highly appreciated. Thanks in advance. - Virg --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "il-antlr-interest" group. To post to this group, send email to il-antlr-interest@googlegroups.com 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:8080/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org:8080/mailman/options/antlr-interest/your-email-address