[antlr-interest] Error reporting

Terence Parr parrt at cs.usfca.edu
Tue Aug 14 09:59:53 PDT 2007


Hi.

.+ consumes until EOF I think in parser...match strings in lexer.

Ter
On Aug 14, 2007, at 1:44 AM, Matthias Schnelte wrote:

> No ideas? anybody?
> I have tried the same grammar with javacc and it reports all the  
> three possibilities as error message.
> Any idea how to implement this in ANTLR?
>
> Matthias
>> ----- Ursprüngliche Nachricht -----
>> Von: mschnelte at gmx.de
>> Gesendet: 13.08.07 13:38 Uhr
>> An: antlr-interest at antlr.org
>> Betreff: [antlr-interest] Error reporting
>>
>> Hi everyone,
>>
>> I have the following grammar:
>>
>> ===
>> sp2: WENN condition DANN;
>>
>>
>> condition  :    simpleCondition (('und' ^|'oder' ^)  
>> simpleCondition)*;
>>
>> simpleCondition :    ie iv 'ist';
>>
>> ie     :    QUOTE! .+ QUOTE!;
>> iv    :    QUOTE! .+ QUOTE!;
>>
>>
>> If the parser reads the following string: "wenn "bla" "blub" ist"  
>> it reports as error:
>>
>> "mismatched input '<EOF>' expecting DANN"
>>
>> Ok, "DANN" would produce a correct statement but "und" or "oder"  
>> can follow a simpleCondition as well.
>> How can I get the parser to print out all possible inputs on a  
>> decision point?
>> I want to implement a code completion and such thing would of  
>> course be very useful.
>>
>> Matthias
>>



More information about the antlr-interest mailing list