[antlr-interest] Additional tokens not being passed to Create(IToken token) ?

Dejas Ninethousand dejas9000 at gmail.com
Tue Oct 21 13:47:02 PDT 2008


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?

-- Matt

On Tue, Oct 21, 2008 at 3:33 PM, Terence Parr <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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20081021/52e5f7b3/attachment.html 


More information about the antlr-interest mailing list