[antlr-interest] [C] scope pop function

Jim Idle jimi at temporal-wave.com
Wed Nov 30 17:26:35 PST 2011


Looks like a bug in the stringtemplates that were changed for ST4 in this
version of ANTLR. You might want to try 4.2 until I can fix this.

Jim

-----Original Message-----
From: antlr-interest-bounces at antlr.org
[mailto:antlr-interest-bounces at antlr.org] On Behalf Of Gonzague Reydet
Sent: Wednesday, November 30, 2011 11:25 PM
To: antlr-interest at antlr.org
Subject: [antlr-interest] [C] scope pop function

Hi all,

When I try to use a scope in my tree parser, I encounter an error in the
generated code.
The scope pop function is generated as follow (I removed the generated
comments to make it more readable) :

void pmyparser_tree_myScopePop(pmyparser_tree ctx) {
    if    (SCOPE_TOP(myScope)->free != NULL)
    {
        SCOPE_TOP(myScope)->free(SCOPE_TOP(myScope));
    }

    ctx->pmyparser_tree_myScopeStack_limit--;
    SCOPE_TOP(myScope) =
(pmyparser_tree_myScope_SCOPE)(ctx->pmyparser_tree_myScopeStack->get(ctx->
,
ctx->pmyparser_tree_myScopeStack_limit - 1));
}

As you can see in the last function line, the first parameter of the get
function call is missing a field descriptor: "get(ctx->, ...)".
Is there something wrong in my parser to provoque this issue? Is this a
known issue of ANTLR 3.4?

The tree parser generator outputs the following messages that I don't
really understand :

ASTTreeParser.stg 321:25: anonymous template has 0 arg(s) but mapped
across
1 value(s)
ASTTreeParser.stg 323:25: anonymous template has 0 arg(s) but mapped
across
1 value(s)
context [/outputFile /treeParser /genericParser /_sub50
/globalAttributeScopeFuncMacro] 24:112 no such template: /bscopeStack
context [/outputFile /treeParser /genericParser /_sub50
/globalAttributeScopeFuncMacro] 24:113 passed 1 arg(s) to template null
with 0 declared arg(s) context [/outputFile /treeParser /genericParser
/_sub50 /globalAttributeScopeFuncMacro] 24:113 attribute sname isn't
defined context [/outputFile /treeParser /genericParser /rule
/ruleCleanUp] 13:5 passed 1 arg(s) to template /_sub16 with 0 declared
arg(s) context [/outputFile /treeParser /genericParser /rule /ruleCleanUp]
15:5 passed 1 arg(s) to template /_sub17 with 0 declared arg(s) ...
context [/outputFile /treeParser /genericParser /rule /ruleCleanUp] 13:5
passed 1 arg(s) to template /_sub16 with 0 declared arg(s) context
[/outputFile /treeParser /genericParser /rule /ruleCleanUp] 15:5 passed 1
arg(s) to template /_sub17 with 0 declared arg(s)


Regards,
Gonzague

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