Hans-Georg,

A very relevant problem. 
"ANTLR collapses my AST completely to a single error token if some kinds of
mismatches happen."

I would also like to know if a solution is found..

-mari

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Hans-Georg Winkler
Sent: Thursday, November 10, 2011 9:51 AM
To: [email protected]
Subject: [antlr-interest] Accepting Erroneus Code in AST construction


Hello,


i'm currently writing a Pascal like language grammar for an editor with
intellisense like features.
It is important that the tree is constructed roughly correct despite
possible errors in the code.
Thats the point where i'm facing some issues with my ANTLR parser.
I already solved some cases but the main problems is that ANTLR collapses my
AST completely to a single error token if some kinds of mismatches happen.


Exapmle:

while_statement
      : WHILE^ expression DO
              statement_section
              END_WHILE
      ;


if i have any kind of correct surrounding code (or none) and simply start
typing a new while statement in my editor the parser reduces my complete AST
to a single error token as long as this single statement is incomplete:


<mismatched token: [@11,48:48='<EOF>',<-1>,9:0],
resync=...correctcode...while...correctcode...>


As those mismatches happen in various other szenarios i would like to know
if theres a way to make antlr simply put the error token at the point where
the first mismatch happend instead of making the whole code a mismatch.
I was thinking of changing the recovery but as i'm still new to antlr i
don't really know what should/could be done there.


I hope someone can help me
Georg
                                          

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org/mailman/options/antlr-interest/your-email-address



List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

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

Reply via email to