All Downloads are FREE. Search and download functionalities are using the official Maven repository.

templates.cpp.TokenManagerBoilerPlateMethods.template Maven / Gradle / Ivy

There is a newer version: 4.1.5
Show newest version
  /** Reinitialise parser. */
  void ${tokMgrClassName}::ReInit(JAVACC_CHARSTREAM *stream, int lexState, ${parserClassName} *parserArg) {
    if (input_stream) delete input_stream;
    jjmatchedPos = jjnewStateCnt = 0;
    curLexState = lexState;
    input_stream = stream;
    ReInitRounds();
    debugStream = stdout; // init
    SwitchTo(lexState);
    parser = parserArg;
    errorHandler = new TokenManagerErrorHandler();
    errorHandlerCreated = true;
  }

  void ${tokMgrClassName}::ReInitRounds() {
    int i;
    jjround = 0x80000001;
    for (i = ${stateSetSize}; i-- > 0;)
      jjrounds[i] = 0x80000000;
  }

  /** Switch to specified lex state. */
  void ${tokMgrClassName}::SwitchTo(int lexState) {
    if (lexState >= ${lexStateNameLength} || lexState < 0)
      assert(false);
      //throw 1;//new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE);
    else
      curLexState = lexState;
  }

  /** Constructor. */
  ${tokMgrClassName}::${tokMgrClassName} (JAVACC_CHARSTREAM *stream, int lexState, ${parserClassName} *parserArg)
#if TOKEN_MANAGER_SUPER_CLASS
  : ${TOKEN_MANAGER_SUPER_CLASS}()
#fi
  {
    input_stream = NULL;
    ReInit(stream, lexState, parserArg);
  }

  // Destructor
  ${tokMgrClassName}::~${tokMgrClassName} () {
    if (input_stream) delete input_stream;
    if (errorHandlerCreated) delete errorHandler;
  }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy