Meena Vinod wrote:
Hi,
   I have a .g file.If i give invalid values as input,most of them report the error:"cannot match to predicted input" .Is there any way by which i can generate different errors.I inserted a new exception macro in antlr3exception.h file but since my rule is for eg:
  

new_cmd: new_verb (new_options)* (target_Instance)*  ..here the valid input would be "cd -k ./dir" (or) cd (or) cd -k (or) cd ./dir

(note :-   new_verb:cd,  new_options=-k,  target_Instance=./dir  )

 but if i give cd -g which is invalid and i try to catch the new error in the new_options rule in parser.c file it doesnt catch the error as it is optional and goes to the next rule which is target_Instance.How do i catch the error in the second rule only even though its optional.Pls help

What target are you sing? I presume taht you mean the C target, in which case please read the API docs or past posts.

For the C target see:

http://www.antlr.org/api/C/index.html

and follow "Using the ANTLR3 C Target"

Look at displayRecognitionError

Also see specifically, for an example of @parser::apifuncs

http://antlr.org/api/C/group__apistructures.html


For the Java target see:

http://www.antlr.org/wiki/display/ANTLR3/Error+reporting+and+recovery



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