[antlr-interest] Antlr 3.3, CSharp3 target, StringTemplate: Invalid code generated for a template rewrite

Sam Harwell sharwell at pixelminegames.com
Thu Feb 24 06:46:41 PST 2011


Hi Peter,

This is fixed in the 3.3.1 release from last week. Here is a link to the
instructions which I keep updated. It includes a link to release 3.3.1 in
section 1.3.

http://www.tunnelvisionlabs.com/downloads/antlr/ANTLRCSharp3_VS2010.xps

Thanks,
Sam

-----Original Message-----
From: antlr-interest-bounces at antlr.org
[mailto:antlr-interest-bounces at antlr.org] On Behalf Of Peter Crowther
Sent: Thursday, February 24, 2011 6:15 AM
To: antlr-interest at antlr.org
Subject: [antlr-interest] Antlr 3.3, CSharp3 target, StringTemplate: Invalid
code generated for a template rewrite

Source fragment (it's a tree grammar, long story):
-- snip --
federation_query    : ^(FEDERATIONQUERY namespace_part? warranties_part?
select_statement) -> federation_query(select={select_statement}) ;
-- snip --

Generated code fragment:
-- snip --
            // TEMPLATE REWRITE
            // 15:89: -> federation_query(select=select_statement)
            {
                retval.Template =
templateLib.GetInstanceOf("federation_query",
                new STAttrMap().put("select", select_statement));
            }


            }
-- snip --

Error:
-- snip --
The type or namespace name 'STAttrMap' could not be found (are you missing a
using directive or an assembly reference?)
-- snip --

In C#, the second parameter of GetInstanceOf() is
IDictionary<string,object>.  Note that IDictionary does not define put(key,
value) - the .Net equivalent is Add(key, value).  Is this a holdover from an
incomplete Java translation?  How might I debug it?

All ideas welcome!

- Peter
--
Peter Crowther, Director, Melandra Limited

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