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

Peter Crowther peter.crowther at melandra.com
Thu Feb 24 04:14:37 PST 2011


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


More information about the antlr-interest mailing list