False alarm. There was some subtle abuse going on deep down in our setup of 
the parser (our tree adaptor was creating error nodes incorrectly). Apologies!

Richard

Richard Thrippleton wrote:
> I'm using the Java target with ANTLR 3.2, and having a problem in a rule in 
> my parser grammar that looks like this:
> 
> "variableInit [ String name ]
>   : ASSIGNMENT id=initializer
>     -> ^(ASSIGNMENT IDENTIFIER[$ASSIGNMENT, $name] initializer)"
> 
> In a particular case where the 'initializer' rule fails to match and issues a 
> syntax error, I'm getting a RewriteEmptyStreamException that cites "rule 
> initializer" popping up from a line that looks like this:
> 
> "// 1151:5: -> ^( ASSIGNMENT IDENTIFIER[$ASSIGNMENT, $name] initializer )
> {
>   {
>     CommonTree root_1 = (CommonTree)adaptor.nil();
>     root_1 = (CommonTree)adaptor.becomeRoot(stream_ASSIGNMENT.nextNode(), 
> root_1);
>     adaptor.addChild(root_1, (CommonTree)adaptor.create(IDENTIFIER, 
> ASSIGNMENT179, name));
>     adaptor.addChild(root_1, stream_initializer.nextTree());           
> <-------------------- ****This line****
>     adaptor.addChild(root_0, root_1);
>   }
> }"
> 
> In terms of error handling we're just using the default recovery (not 
> overriding it with 'catch'/'rulecatch'). We've overridden reportError to 
> pretty-print the RecognitionExceptions, but that's about it. Should I be 
> needing to do anything special to cope with parsing failures of subrules, or 
> should the default be sufficient to prevent these exceptions? Otherwise, 
> where is the problem likely to lie - a defect elsewhere in my grammar, or in 
> ANTLR?
> 
> Cheers,
> Richard
> 
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: 
> http://www.antlr.org/mailman/options/antlr-interest/your-email-address


-- 
\o/

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 il-antlr-inter...@googlegroups.com.
To unsubscribe from this group, send email to 
il-antlr-interest+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.

Reply via email to