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

Terence Parr parrt at cs.usfca.edu
Thu Jan 31 17:24:34 PST 2008


Hmm...scope be

scope A, B, C;

i thought.  Wow, did i forget the COMMA?

Ter
On Jan 31, 2008, at 3:36 PM, Matthieu Riou wrote:

> 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/8ecf2a9c/attachment.html 


More information about the antlr-interest mailing list