The executor tracks position information for position-dependent lexer actions
efficiently, ensuring that actions appearing only at the end of the rule do
not cause bloating of the DFA created for the lexer.
| Modifier and Type | Field and Description |
|---|---|
| private final int | hashCode
Caches the result of |
| private final LexerAction[] |
| Access | Constructor and Description |
|---|---|
| public | LexerActionExecutor(LexerAction[]
The lexer actions to execute. lexerActions)Constructs an executor for a sequence of |
| Modifier and Type | Method and Description |
|---|---|
| public static LexerActionExecutor | Returns: ALexerActionExecutor for executing the combine actions
of lexerActionExecutor and lexerAction.The executor for actions already traversed by
the lexer while matching a token within a particular
lexerActionExecutor, LexerAction LexerATNConfig. If this is null, the method behaves as
though it were an empty executor.The lexer action to execute after the actions
specified in lexerAction)lexerActionExecutor.Creates a |
| public boolean | equals(Object
the reference object with which to compare. obj)Overrides java. |
| public void | execute(Lexer
The lexer instance. lexer, CharStream The input stream which is the source for the current token.
When this method is called, the current input, int IntStream#index for
input should be the start of the following token, i.e. 1
character past the end of the current token.The token start index. This value may be passed to
startIndex)IntStream#seek to set the input position to the beginning
of the token.Execute the actions encapsulated by this executor within the context of a
particular |
| public LexerActionExecutor | Returns: ALexerActionExecutor which stores input stream offsets
for all position-dependent lexer actions.The current offset to assign to all position-dependent
lexer actions which do not already have offsets assigned. offset)Creates a |
| public LexerAction[] | Returns: The lexer actions to be executed by this executor.Gets the lexer actions to be executed by this executor. |
| public int |
| hashCode | back to summary |
|---|---|
| private final int hashCode Caches the result of | |
| lexerActions | back to summary |
|---|---|
| private final LexerAction[] lexerActions | |
| LexerActionExecutor | back to summary |
|---|---|
| public LexerActionExecutor(LexerAction[] lexerActions) Constructs an executor for a sequence of
| |
| append | back to summary |
|---|---|
| public static LexerActionExecutor append(LexerActionExecutor lexerActionExecutor, LexerAction lexerAction) Creates a
| |
| equals | back to summary |
|---|---|
| public boolean equals(Object obj) Overrides java. Doc from java. Indicates whether some other object is "equal to" this one.
The
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes. | |
| execute | back to summary |
|---|---|
| public void execute(Lexer lexer, CharStream input, int startIndex) Execute the actions encapsulated by this executor within the context of a
particular This method calls
| |
| fixOffsetBeforeMatch | back to summary |
|---|---|
| public LexerActionExecutor fixOffsetBeforeMatch(int offset) Creates a Normally, when the executor encounters lexer actions where
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
| |
| getLexerActions | back to summary |
|---|---|
| public LexerAction[] getLexerActions() Gets the lexer actions to be executed by this executor.
| |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Doc from java. Returns a hash code value for this object. This method is
supported for the benefit of hash tables such as those provided by
The general contract of
| |