[antlr-interest] Impossible to reference more than one global scope?

Matthieu Riou matthieu at offthelip.org
Thu Jan 31 15:36:15 PST 2008


I found the solution by looking into the codegen grammar. Apparently several
scopes should be declared simply by separating them with a space like this:

process
scope BPELScope Parent;
        :           ...

Maybe this should be documented somewhere (it's not in the book) and the
grammar posted online( [1] which seems to be indicating colons in the
ruleScopeSpec rule) should be updated?

Thanks,
Matthieu

[1] http://www.antlr.org/grammar/ANTLR/ANTLRv3.g

On Jan 31, 2008 3:15 PM, Matthieu Riou <matthieu at offthelip.org> wrote:

> Hi,
>
> I've having some problems with a rule that needs to reference two global
> scopes:
>
> scope BPELScope { OScope oscope; }
> scope Parent { OActivity activity; }
> ...
> process
> scope BPELScope, Parent;
>         :           ...
>
> This leads to a "expecting SEMI, found ',' " error. Moreover the java code
> generated is missing a stack push as I only have the following:
>
> Parent_stack.push(new Parent_scope());
>
> The BPELScope stack should also be pushed a new value but it's not,
> resulting in an EmptyStackException at runtime. I also tried specifying the
> two scopes as two different lines like this:
>
> process
> scope BPELScope;
> scope Parent;
>         :           ...
>
> The error disappears but the call to push a new value in the stack is
> still missing resulting in the same EmptyStackException. Am I missing the
> right way to specify several global scope references or is it a bug?
>
> Thanks,
> Matthieu
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080131/355288f4/attachment.html 


More information about the antlr-interest mailing list