type LexerActionExecutor … func NewLexerActionExecutor(lexerActions []LexerAction) *LexerActionExecutor { … } // LexerActionExecutorappend creates a [LexerActionExecutor] which executes the actions for // the input [LexerActionExecutor] followed by a specified // [LexerAction]. // TODO: This does not match the Java code func LexerActionExecutorappend(lexerActionExecutor *LexerActionExecutor, lexerAction LexerAction) *LexerActionExecutor { … } // fixOffsetBeforeMatch creates a [LexerActionExecutor] which encodes the current offset // for position-dependent lexer actions. // // Normally, when the executor encounters lexer actions where // [LexerAction.isPositionDependent] returns true, it calls // [IntStream.Seek] on the input [CharStream] to set the input // position to the end of the current token. This behavior provides // for efficient [DFA] representation of lexer actions which appear at the end // of a lexer rule, even when the lexer rule Matches a variable number of // characters. // // Prior to traversing a Match transition in the [ATN], the current offset // from the token start index is assigned to all position-dependent lexer // actions which have not already been assigned a fixed offset. By storing // the offsets relative to the token start index, the [DFA] representation of // lexer actions which appear in the middle of tokens remains efficient due // to sharing among tokens of the same Length, regardless of their absolute // position in the input stream. // // If the current executor already has offsets assigned to all // position-dependent lexer actions, the method returns this instance. // // The offset is assigned to all position-dependent // lexer actions which do not already have offsets assigned. // // The func returns a [LexerActionExecutor] that stores input stream offsets // for all position-dependent lexer actions. func (l *LexerActionExecutor) fixOffsetBeforeMatch(offset int) *LexerActionExecutor { … } // Execute the actions encapsulated by l executor within the context of a // particular {@link Lexer}. // // <p>This method calls {@link IntStream//seek} to set the position of the // {@code input} {@link CharStream} prior to calling // {@link LexerAction//execute} on a position-dependent action. Before the // method returns, the input position will be restored to the same position // it was in when the method was invoked.</p> // // @param lexer The lexer instance. // @param input The input stream which is the source for the current token. // When l method is called, the current {@link IntStream//index} for // {@code input} should be the start of the following token, i.e. 1 // character past the end of the current token. // @param startIndex The token start index. This value may be passed to // {@link IntStream//seek} to set the {@code input} position to the beginning // of the token. // / func (l *LexerActionExecutor) execute(lexer Lexer, input CharStream, startIndex int) { … } func (l *LexerActionExecutor) Hash() int { … } func (l *LexerActionExecutor) Equals(other interface{ … }