Class: LexerModeAction
- Inherits:
-
LexerAction
- Object
- LexerAction
- LexerModeAction
- Defined in:
- lib/antlr4/atn/LexerAction.rb
Overview
Implements the mode lexer action by calling Lexer#mode with the assigned mode.
Instance Attribute Summary collapse
-
#mode ⇒ Object
Returns the value of attribute mode.
Attributes inherited from LexerAction
#actionType, #isPositionDependent
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#execute(lexer) ⇒ Object
<p>This action is implemented by calling Lexer#mode with the value provided by #getMode.</p>.
- #hash ⇒ Object
-
#initialize(_mode) ⇒ LexerModeAction
constructor
A new instance of LexerModeAction.
- #to_s ⇒ Object
Methods inherited from LexerAction
Constructor Details
#initialize(_mode) ⇒ LexerModeAction
Returns a new instance of LexerModeAction.
174 175 176 177 |
# File 'lib/antlr4/atn/LexerAction.rb', line 174 def initialize(_mode) super(LexerActionType::MODE) self.mode = _mode end |
Instance Attribute Details
#mode ⇒ Object
Returns the value of attribute mode.
173 174 175 |
# File 'lib/antlr4/atn/LexerAction.rb', line 173 def mode @mode end |
Instance Method Details
#==(other) ⇒ Object
189 190 191 |
# File 'lib/antlr4/atn/LexerAction.rb', line 189 def ==(other) self.equal?(other)or other.kind_of?(LexerModeAction)and self.mode == other.mode end |
#execute(lexer) ⇒ Object
<p>This action is implemented by calling Lexer#mode with the value provided by #getMode.</p>
181 182 183 |
# File 'lib/antlr4/atn/LexerAction.rb', line 181 def execute(lexer) lexer.mode = self.mode end |
#hash ⇒ Object
185 186 187 |
# File 'lib/antlr4/atn/LexerAction.rb', line 185 def hash "#{self.actionType}#{self.mode}".hash end |
#to_s ⇒ Object
193 194 195 |
# File 'lib/antlr4/atn/LexerAction.rb', line 193 def to_s "mode(#{self.mode})" end |