[antlr-interest] Enforcing that a statement parm is only specified one time

Terence Parr parrt at cs.usfca.edu
Wed Oct 29 15:12:47 PDT 2008


On Oct 29, 2008, at 1:45 PM, Jim Idle wrote:
> Warning line 2, offset nn : You have said 'plumber' 12 times in the  
> same construct. Are you campaigning?
> wink joe the plumber plumber joe wink joe the bloody plumber plumber  
> plumber
>                      ^                               ^       ^       ^
>
> Basically, for anything other than a one off script parser or  
> something, never try to do things like this in the grammar itself,  
> ALWAYS accept anything that is vaguely legal, count or flag what is  
> present, then give specific errors. Similar things include:
>
> Error: line 2, offset nn : You cannot combine 'baseball' and 'obama'  
> in the same timeslot.
> schedule blah blah obama blah blah baseball
>                                    ^

Error: line 2, offset nn: You're not an idiot, you're a maverick,  
you're VP is a maverick, and your mother looks like one too.  The  
horse you rode in on is a maverick too.

Terence


More information about the antlr-interest mailing list