Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Xtext and error recovery in block-level statements
Xtext and error recovery in block-level statements [message #45521] Tue, 26 May 2009 22:02 Go to previous message
Shane Beasley is currently offline Shane Beasley
Messages: 6
Registered: July 2009
Junior Member
Consider the following grammar and input:

Model :
( outers += Outer ';' )* ;
Outer :
'create' 'outer' name = ID
( inners += Inner ';' )*
'end' 'outer' ;
Inner : 'create' 'inner' name = ID ;

create outer Foo TYPO create inner X; create inner Y; end outer;
create outer Bar create inner X; create inner Y; end outer;

Because of the unexpected token TYPO, the Outline Pane shows a node for
Foo but not for Foo/X, Foo/Y, or Bar or its children.

http://wiki.eclipse.org/Xtext/Documentation mentions error recovery in
passing, but I don't think it describes anything that would help here.

I've seen the following technique in ANTLR grammars to recover from
errors inside the block:

Outer :
'create' 'outer' name = ID
( inners += Inner ';' | !'end' )*
'end' 'outer' ;

Unfortunately, Xtext does not accept terminal negation (!'end') in a
nonterminal rule.

Are there any other tricks for getting better error recovery, or should
I just file an enhancement request for the above (or both)? :)

Thanks!
 
Read Message
Read Message
Read Message
Read Message
Previous Topic:[XText] best practices for variable handling
Next Topic:[XText] a standalone Java application that parses text to model
Goto Forum:
  


Current Time: Wed May 22 02:53:41 EDT 2013

Powered by FUDForum. Page generated in 0.01819 seconds