On Nov 21, 2010, at 11:13 PM, Sam Harwell wrote:
> This attribute was added to the CSharp3 target in CL 6464 while fixing an
> issue with delegate grammars.
Interesting. says
* Add a HasDelegates property to Grammar
but that was to your antlrcs stuff, right? It has never appeared in my
Grammar.java.
> I tried adding a CSharp3Target.java file, but ran into the following
> problems:
>
> 1. The Java version of the tool doesn't implement rule visibility (despite
> having it as part of the grammars). It results in all rule methods in the
> grammar being private (the default in C#).
can't you just add "public" to your templates?
> 2. GrammarAST needed a getCharPositionInLine() method added to be compatible
> with the v3 grammars I'm using.
should it just call getColumn? that's "almost" the same value.
> 3. Grammar needed a getHasDelegates() method:
>
> public boolean getHasDelegates() {
> return !getDelegates().isEmpty();
> }
done.
>
> 4. The Java version of the tool doesn't implement actions for attribute
> scopes. In the C# version, you can have scopes like the following:
>
> scope S @scopeinit{$S::value=true;} {boolean value;}
What can I do quickly to help you?
>
> ==== On a side note, the token constants can be stabilized by (it really
> cleans up the output):
>
> 1. Use TreeMap for AssignTokenTypesBehavior.stringLiterals, tokens, and
> aliases
doesn't LinkedHashMap keep the order?
> 1. Use a TreeMap for CompositeGrammar.tokenIDToTypeMap and
> stringLiteralToTypeMap
cool. fixed
public Map tokenIDToTypeMap = new LinkedHashMap();
public Map<String, Integer> stringLiteralToTypeMap = new
LinkedHashMap<String, Integer>();
> 2. In CodeGenerator.genTokenTypeConstants, output the list in order by
> value. I believe you could use the code from genTokenTypeNames, but I did
> the following:
>
>
can i just emit in order defined as in now with LinkedHashMap defs?
Iterator tokenIDs = grammar.getTokenIDs().iterator();
while (tokenIDs.hasNext()) {
...
submitted
Thanks!
Ter
_______________________________________________
antlr-dev mailing list
[email protected]
http://www.antlr.org/mailman/listinfo/antlr-dev