[prev in list] [next in list] [prev in thread] [next in thread] 

List:       antlr-interest
Subject:    Re: [antlr-interest] C# antlr-dotnet-tool-3.3.1.7705 issue
From:       "Sam Harwell" <sharwell () pixelminegames ! com>
Date:       2011-02-25 20:01:06
Message-ID: 007d01cbd526$bdf5fec0$39e1fc40$ () pixelminegames ! com
[Download RAW message or body]

Hi David,

Can you add the following template to the CSharp3 target's ST.stg which is
used for generating code. Let me know if it resolves the issue for you. If
this works, I'll clean it up (only overriding the necessary portion) and get
it checked in for the next release.

ruleLabelDefs() ::= <<
<[ruleDescriptor.tokenLabels,ruleDescriptor.tokenListLabels,ruleDescriptor.w
ildcardTreeLabels,ruleDescriptor.wildcardTreeListLabels]
    :{<labelType> <it.label.text> = default(<labelType>);}; separator="\n"
>
<ruleDescriptor.tokenListLabels
    :{List\<<labelType>\> list_<it.label.text> = null;}; separator="\n"
>
<ruleDescriptor.ruleListLabels
    :{List\<<StringTemplate>\> list_<it.label.text> = null;}; separator="\n"
>
<ruleDescriptor.wildcardTreeListLabels
    :{List\<<ASTLabelType>\> list_<it.label.text> = null;}; separator="\n"
>
<ruleDescriptor.ruleLabels:ruleLabelDef(label=it); separator="\n">
<ruleDescriptor.ruleListLabels:ruleLabelDef(label=it); separator="\n">
>>


Thanks,
Sam

-----Original Message-----
From: antlr-interest-bounces@antlr.org
[mailto:antlr-interest-bounces@antlr.org] On Behalf Of David Daeschler
Sent: Friday, February 25, 2011 1:25 PM
To: antlr-interest@antlr.org
Subject: [antlr-interest] C# antlr-dotnet-tool-3.3.1.7705 issue with
collected template list

Hello,

I am using antlr-dotnet-tool-3.3.1.7705 and beginning work on a template to
translate from a high level language to bytecode.

One of my rules looks something like this:

script : (g+=globalVar)+
-> file(globalVars={$g})

globalVar
: ^(VAR_DECL TYPE ID .?)
-> vardec(type={$TYPE.text}, id={$ID.text})
;

It appears that the code being generated in this case to collect the
templates is slightly off. The type of list to hold the returned result is:

List<MyAST> list_g = null;

But when the collection is done, it is expecting the list to hold a
stringtemplate:

if (list_g==null) list_g=new List<StringTemplate>();
list_g.Add(g.Template);

I have confirmed my output is set correctly:

options {
language = 'CSharp3';
tokenVocab = MyVocab;
ASTLabelType = MyAST;
output = template;
}


Is there anything else I need to do?

Thank you very much for any help.
-- 
David Daeschler

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org/mailman/options/antlr-interest/your-email-address


List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic