Class ReservedWordLexer

java.lang.Object
eu.bandm.tools.xantlrtdom.ReservedWordLexer

public class ReservedWordLexer extends Object
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.
  • Field Details

  • 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 of eu.bandm.tools.keywordgrammar.runtime.Lexer
      This version runs with antlr-2.7.4
      The typical call of this method can be found in eu.bandm.bpm.bpmn.test.Test (or in eu.bandm.bpm.hr.base.Reposit)
         final KeywordLexer lexer 
            = new KeywordLexer(in){
                {ReservedWordLexer.link(BpmnParserTokenTypes.class, this, this.literal
                }};