Greetings!

On Monday 02 March 2009 10:51:20 am Paul Bouché (NSN) wrote:
> I have the following grammer, problem described below.
> start   :   outerPropertynode | EOF;
> outerPropertynode   :   outerProperties;
> properties   : (property delim)*; // simplified
> property   : key '=' value;
> value   :   plain | '{' propertynode '}'
>
> As you can see the value rule recursively calls the propertynode rule.
> Empty propertynode values are ok. This is what the grammar expresses.

Ok, I believe you. But the above grammar fragment does not express that - in 
fact the fragment is incomplete and so it is really hard to infer anything 
about it.

> Yet, now I installed error recovery on the rule property, which says
> that if there is an erroneous token found in rule property consume
> everything until you find a delimiter, effectively discarding this
> property. Yet from the start if there is an erroneous token for key the
> lookahead in rule properties will decide that this has to match as an
> empty property and an exception occurs in the start rule. In the case of
> a non empty stream and when parsing from the start I would like to force
> rule invocation of rule property even though the look ahead decides for
> empty match. I still want the non empty stream to be matched correctly
> without error generation, but anyother input to be tried to be matched
> by rule property.

I am sorry but I am really confused by what it is you are trying to 
accomplish.

Can you please post the smallest - yet COMPLETE - example grammar of your 
problem?

Speculating on what your problem might be ... have you tried something like 
this (untested):

start  : ( key '=' value delim )* EOF ;
value = plain | '{' propertynode ? '}' ;
propertynode : /* the non-empty version of whatever this is */ ;
key = /* whatever this is */ ;
delim = /* whatever this is */ ;

Hope this helps
   -jbb
(looking forward to finding out more about your problem)


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