Recognizer#action with the
rule and action indexes assigned to the custom action. The implementation of
a custom action is added to the generated code for the lexer in an override
of Recognizer#action when the grammar is compiled.
This class may represent embedded actions created with the {...}
syntax in ANTLR 4, as well as actions created for lexer commands where the
command argument could not be evaluated when the grammar was compiled.
| Modifier and Type | Field and Description |
|---|---|
| private final int | |
| private final int |
| Access | Constructor and Description |
|---|---|
| public | LexerCustomAction(int
The rule index to use for calls to
ruleIndex, int Recognizer#action.The action index to use for calls to
actionIndex)Recognizer#action.Constructs a custom lexer action with the specified rule and action indexes. |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | equals(Object
the reference object with which to compare. obj)Overrides java. |
| public void | execute(Lexer
The lexer instance. lexer)Implements org. Lexer.
|
| public int | Returns: The action index for the custom action.Gets the action index to use for calls to |
| public LexerActionType | Returns: This method returnsLexerActionType#CUSTOM.Implements org. |
| public int | Returns: The rule index for the custom action.Gets the rule index to use for calls to |
| public int | |
| public boolean | Returns: This method returnstrue.Implements org. |
| actionIndex | back to summary |
|---|---|
| private final int actionIndex | |
| ruleIndex | back to summary |
|---|---|
| private final int ruleIndex | |
| LexerCustomAction | back to summary |
|---|---|
| public LexerCustomAction(int ruleIndex, int actionIndex) Constructs a custom lexer action with the specified rule and action indexes.
| |
| 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) Implements org. Doc from org. Execute the lexer action in the context of the specified For position-dependent actions, the input stream must already be positioned correctly prior to calling this method. Custom actions are implemented by calling | |
| getActionIndex | back to summary |
|---|---|
| public int getActionIndex() Gets the action index to use for calls to
| |
| getActionType | back to summary |
|---|---|
| public LexerActionType getActionType() Implements org. Doc from org. Gets the serialization type of the lexer action.
| |
| getRuleIndex | back to summary |
|---|---|
| public int getRuleIndex() Gets the rule index to use for calls to
| |
| 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
| |
| isPositionDependent | back to summary |
|---|---|
| public boolean isPositionDependent() Implements org. Gets whether the lexer action is position-dependent. Position-dependent
actions may have different semantics depending on the Custom actions are position-dependent since they may represent a
user-defined embedded action which makes calls to methods like
| |