Merge pull request #736 from sharwell/codegen-tokennames

Provide tokenNames to the code generator
This commit is contained in:
Sam Harwell 2014-10-05 14:49:23 -05:00
commit 39c3f4b4dd
1 changed files with 10 additions and 0 deletions

View File

@ -48,6 +48,15 @@ public abstract class Recognizer extends OutputModelObject {
public String grammarName;
public String grammarFileName;
public Map<String,Integer> tokens;
/**
* @deprecated This field is provided only for compatibility with code
* generation targets which have not yet been updated to use
* {@link #literalNames} and {@link #symbolicNames}.
*/
@Deprecated
public String[] tokenNames;
public String[] literalNames;
public String[] symbolicNames;
public Set<String> ruleNames;
@ -84,6 +93,7 @@ public abstract class Recognizer extends OutputModelObject {
}
CodeGenerator gen = factory.getGenerator();
tokenNames = translateTokenStringsToTarget(g.getTokenDisplayNames(), gen);
literalNames = translateTokenStringsToTarget(g.getTokenLiteralNames(), gen);
symbolicNames = translateTokenStringsToTarget(g.getTokenSymbolicNames(), gen);
}