[antlr-interest] table's in template from rule.

craig at palantir.co.za craig at palantir.co.za
Tue Jul 22 06:31:16 PDT 2008


Hi,

Given the following production:
rule
scope 			{Dictionary<XNamespace, string> xnamespaces; }
@init			{$rule::xnamespaces = new Dictionary<XNamespace, string>(); }
:				path condition
				-> rule(path={$path.st}, condition={$condition.st}, xnamespaces={new
Hashtable($rule::xnamespaces)})
                ;

I am creating a hashtable (one of the supported template parameters).
Unfortunately I cannot seem to get access to the set of keys.

The template
<xnamespaces:{ x | K:<x> V:<xnamespaces.(x)> }>

Gives me the values not the keys. I understand the M/V separation issues, but
surely there is some way to iterate a set of name value pairs. Must I change
the dictionary to a list of instances of a class with a specific name and
value, surely there is a simple shortcut for iterating a dictionary or finding
a dictinoary value in a template?

I am using 3.1 (C# target).

Cheers
Regards
Craig.

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.




More information about the antlr-interest mailing list