public LexerActionExecutor fixOffsetBeforeMatch(int offset) {
		LexerAction[] updatedLexerActions = null;
		for (int i = 0; i < lexerActions.length; i++) {
			if (lexerActions[i].isPositionDependent() && !(lexerActions[i] instanceof LexerIndexedCustomAction)) {
				if (updatedLexerActions == null) {
					updatedLexerActions = lexerActions.clone();
				}

				updatedLexerActions[i] = new LexerIndexedCustomAction(offset, lexerActions[i]);
			}
		}

		if (updatedLexerActions == null) {
			return this;
		}

		return new LexerActionExecutor(updatedLexerActions);
	}
Creates a {@link LexerActionExecutor} which encodes the current offset
for position-dependent lexer actions.

<p>Normally, when the executor encounters lexer actions where
{@link LexerAction#isPositionDependent} returns {@code true}, it calls
{@link IntStream#seek} on the input {@link CharStream} to set the input
position to the <em>end</em> 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.</p>

<p>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.</p>

<p>If the current executor already has offsets assigned to all
position-dependent lexer actions, the method returns {@code this}.</p>

@param offset The current offset to assign to all position-dependent
lexer actions which do not already have offsets assigned.

@return A {@link LexerActionExecutor} which stores input stream offsets
for all position-dependent lexer actions.
runtime/Java/src/org/antlr/v4/runtime/atn/LexerActionExecutor.java