[antlr-interest] Disabling look ahead or ???
"Paul Bouché (NSN)"
paul.bouche at nsn.com
Mon Mar 2 07:51:20 PST 2009
Hi,
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.
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.
Thanks,
Paul
--
Paul Bouché
Voice: +49 30 590080-1284
Nokia Siemens Networks GmbH & Co. KG, An den Treptowers 1, 12435 Berlin, Germany
Sitz der Gesellschaft: München / Registered office: Munich
Registergericht: München / Commercial registry: Munich, HRA 88537
WEEE-Reg.-Nr.: DE 52984304
Persönlich haftende Gesellschafterin / General Partner: Nokia Siemens Networks Management GmbH
Geschäftsleitung / Board of Directors: Lydia Sommer, Olaf Horsthemke
Vorsitzender des Aufsichtsrats / Chairman of supervisory board: Lauri Kivinen
Sitz der Gesellschaft: München / Registered office: Munich
Registergericht: München / Commercial registry: Munich, HRB 163416
More information about the antlr-interest
mailing list