[antlr-interest] No match

Micheal J open.zone at virgin.net
Sat May 26 18:59:22 PDT 2007


Since matching nothing is also valid, you may want to investigate adding in
"error alternatives" specifically to catch the most common forms of invalid
input you expect to come across. Basically, a bunch of rules or alternatives
that intentionally match invalid input. You can then output appropriate
error messages.
 
You could also look at hooking into ANTLR's error recovery mechanism but,
that would be tricky in this instance since nothing is also valid input.
What version of ANTLR are you using anyhows?
 
 
Micheal
 

-----------------------
The best way to contact me is via the list/forum. My time is very limited. 

-----Original Message-----
From: Jason Hocker [mailto:jkh at datatel.com] 
Sent: 27 May 2007 02:53
To: Micheal J
Cc: antlr-interest at antlr.org; antlr-interest-bounces at antlr.org
Subject: Re: [antlr-interest] No match



I mean that the rule doesn't match... so the loop breaks out... so there is
code that I want the parser to parse, but the parser has finished its
method. 

Matching nothing is also valid, so I want to keep it at zero-to-many.  What
I want to add is that if I have bad code there is an error reported. 



Jason Hocker, SCJP (1.4), SCWCD (1.3, 1.4), SCMAD, SCDJWS 
Senior Developer
Datatel, Inc.
How higher education does business.

Voice: 703-653-1221
Fax: 703-802-3965
E-Mail: jkh at datatel.com
www.datatel.com




"Micheal J" <open.zone at virgin.net> 
Sent by: antlr-interest-bounces at antlr.org 


05/26/2007 09:45 PM 


To
<antlr-interest at antlr.org> 

cc

Subject
Re: [antlr-interest] No match

	




You could start by making the rule non-optional. 
  
    code:    (ruleA | ruleB ... ruleD)+ ; 
  
When you say the parser continues and ends, what exactly do you mean?. 
  
Micheal 
  

-----------------------
The best way to contact me is via the list/forum. My time is very limited. 


-----Original Message-----
From: antlr-interest-bounces at antlr.org
[mailto:antlr-interest-bounces at antlr.org] On Behalf Of Jason Hocker
Sent: 27 May 2007 02:38
To: antlr-interest at antlr.org
Subject: [antlr-interest] No match


We have a rule like: 

code: (ruleA | ruleB | ruleC | ruleD)*; 

So if we try to parse code that is wrong... it won't match any of these
rules, and the parser continues and end. 

How can we better implement error handling? 




-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20070527/606e3fcc/attachment.html 


More information about the antlr-interest mailing list