append static method

LexerActionExecutor append(
  1. LexerActionExecutor? lexerActionExecutor,
  2. LexerAction lexerAction
)

Creates a LexerActionExecutor which executes the actions for the input lexerActionExecutor followed by a specified lexerAction.

@param lexerActionExecutor The executor for actions already traversed by the lexer while matching a token within a particular LexerATNConfig. If this is null, the method behaves as though it were an empty executor. @param lexerAction The lexer action to execute after the actions specified in lexerActionExecutor.

@return A LexerActionExecutor for executing the combine actions of lexerActionExecutor and lexerAction.

Implementation

static LexerActionExecutor append(
  LexerActionExecutor? lexerActionExecutor,
  LexerAction lexerAction,
) {
  if (lexerActionExecutor == null) {
    return LexerActionExecutor([lexerAction]);
  }

  final lexerActions =
      List<LexerAction>.from(lexerActionExecutor.lexerActions);
  lexerActions.add(lexerAction);
  return LexerActionExecutor(lexerActions);
}