Package eu.bandm.tools.xantlrtdom
Class ReservedWordLexer
java.lang.Object
eu.bandm.tools.xantlrtdom.ReservedWordLexer
An auxiliary class needed to back-link one and the same
pre-defined antlr-lexer (from a runtime system) to one of many
varying, newly generated parsers generated against this lexer.
This is needed in case the parser defines specific keywords which are (naturally) not known to the common basic lexer.
This is needed in case the parser defines specific keywords which are (naturally) not known to the common basic lexer.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
keyword_prefix
- See Also:
-
-
Constructor Details
-
ReservedWordLexer
public ReservedWordLexer()
-
-
Method Details
-
link
public static void link(Class<?> tokenTypes, antlr.CharScanner lexer, Hashtable<antlr.ANTLRHashString, Integer> hash) Links the token definitions in the Class type argument to the hashtable of the given lexer. Reflection is used.
Since the token table is protected, it must be given to this method as a separate argument. The "lexer" argument is needed because this token table contains special "hash strings", which can only be created knowing the lexer.
The first use was with the pre-defined runtime system ofeu.bandm.tools.keywordgrammar.runtime.Lexer
This version runs with antlr-2.7.4
The typical call of this method can be found ineu.bandm.bpm.bpmn.test.Test
(or ineu.bandm.bpm.hr.base.Reposit
)final KeywordLexer lexer = new KeywordLexer(in){ {ReservedWordLexer.link(BpmnParserTokenTypes.class, this, this.literal }};
-