[antlr-interest] [3.1 C] Mulivalue Attribute is NULL in action after matching rule

Christian Schladetsch christian.schladetsch at gmail.com
Sat Apr 12 18:25:02 PDT 2008


I tried the more likely (num += NUMBER)+ syntax the first time. Then I got:

error C2039: 'vectors' : is not a member of 'FailParser_Ctx_struct'

When trying to compile the parser. I guess I'll just do something else....
like revert to my hand-written C++ parser :P


On Sun, Apr 13, 2008 at 1:17 AM, Gavin Lambert <antlr at mirality.co.nz> wrote:

> At 22:23 12/04/2008, Christian Schladetsch wrote:
>
> > The assertion fires on input "42" using antlr-2008-04-09.10:
> >
> > grammar Fail;
> > options { language=C; }
> > @preincludes { #include <assert.h> }
> > sequence  : num += (NUMBER+) { assert($num != 0); } ;
> > NUMBER  :  ('0'..'9')+ ;
> >
> > Is this correct behavior?
> >
>
> "Correct" is a little debatable, but you've used a syntax that's known to
> be invalid in the current version.  Try this instead:
>
> sequence : (num += NUMBER)+ ...
>
> (Basically, you can't assign a label to a block, only to a single token.)
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080413/7432226c/attachment.html 


More information about the antlr-interest mailing list