[antlr-interest] Additional tokens not being passed to Create(IToken token) ?
Johannes Luber
jaluber at gmx.de
Tue Oct 21 14:03:32 PDT 2008
Dejas Ninethousand schrieb:
> I see the problem now. I put a breakpoint in the parser and that
> production was never hit. The reason is that in my root production
> namespace_decl is preceded by non-terminal filler:
>
> cs_file : filler namespace_decl LBRACE ((comment)* class_def)*
> RBRACE;
>
>
> filler : ( options {greedy=false;} : . )*;
>
> removing filler causes my case statement breakpoint to be hit. I must
> have misunderstood the nature of "greedy=false". I interpreted that to
> mean "consume all characters that could not constitute other non
> terminals". I saw this construct in an example grammar file for block
> comments:
>
> COMMENT_BLOCK
> : '/*' ( options {greedy=false;} : . )* '*/'
>
> If indeed my interpretation is wrong, then how does the (.)* regex
> avoid eating the closing */ in a block comment?
Actually, with greedy=true; - the default - the lexer would consume
everything until the last '*/'. greedy=false; says: Stop at the first
'*/'. To solve your little filler problem, you have put some kind of
literal after the *. Or just be more explicit, what constitutes a filler.
Johannes
>
> -- Matt
>
> On Tue, Oct 21, 2008 at 3:33 PM, Terence Parr <parrt at cs.usfca.edu
> <mailto:parrt at cs.usfca.edu>> wrote:
>
>
> On Oct 21, 2008, at 1:31 PM, Dejas Ninethousand wrote:
>
> I attached the whole parser file last reply, but here is the
> namespace_decl production:
>
>
> right you have to make it as easy as possible on people so they are
> willing to help. We are all lazy ;)
>
> Anyhoo, your problem seems strange because it clearly calls
>
>
> adaptor.AddChild(root_0,
> adaptor.Create(NAMESPACE_COMPLETE, "blort"));
>
> create. If you set a breakpoint at it does not get there, the only
> explanation is that an exception occurs or something else that
> prevents it from going there.
>
> Ter
>
>
>
> ------------------------------------------------------------------------
>
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address
>
More information about the antlr-interest
mailing list