[antlr-interest] Enforcing that a statement parm is onlyspecified one time
Brisard, Fred D
Fred.Brisard at ca.com
Wed Oct 29 19:48:46 PDT 2008
Ok - so the parser should just accept whatever is valid syntax and then
worry about the semantics (duplicate parameter) by traversing the AST.
Right?
-----Original Message-----
From: antlr-interest-bounces at antlr.org
[mailto:antlr-interest-bounces at antlr.org] On Behalf Of Terence Parr
Sent: Wednesday, October 29, 2008 6:13 PM
To: Jim Idle
Cc: antlr-interest at antlr.org
Subject: Re: [antlr-interest] Enforcing that a statement parm is
onlyspecified one time
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
List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org/mailman/options/antlr-interest/your-email-addr
ess
More information about the antlr-interest
mailing list