Class: LexerPushModeAction
- Inherits:
-
LexerAction
- Object
- LexerAction
- LexerPushModeAction
- Defined in:
- lib/antlr4/atn/LexerAction.rb
Overview
Implements the pushMode lexer action by calling Lexer#pushMode 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#pushMode with the value provided by #getMode.</p>.
- #hash ⇒ Object
-
#initialize(_mode) ⇒ LexerPushModeAction
constructor
A new instance of LexerPushModeAction.
- #to_s ⇒ Object
Methods inherited from LexerAction
Constructor Details
#initialize(_mode) ⇒ LexerPushModeAction
Returns a new instance of LexerPushModeAction.
93 94 95 96 |
# File 'lib/antlr4/atn/LexerAction.rb', line 93 def initialize(_mode) super(LexerActionType::PUSH_MODE) self.mode = _mode end |
Instance Attribute Details
#mode ⇒ Object
Returns the value of attribute mode.
92 93 94 |
# File 'lib/antlr4/atn/LexerAction.rb', line 92 def mode @mode end |
Instance Method Details
#==(other) ⇒ Object
108 109 110 |
# File 'lib/antlr4/atn/LexerAction.rb', line 108 def ==(other) self.equal?(other) or other.kind_of?(LexerPushModeAction) and self.mode == other.mode end |
#execute(lexer) ⇒ Object
<p>This action is implemented by calling Lexer#pushMode with the value provided by #getMode.</p>
100 101 102 |
# File 'lib/antlr4/atn/LexerAction.rb', line 100 def execute(lexer) lexer.pushMode(self.mode) end |
#hash ⇒ Object
104 105 106 |
# File 'lib/antlr4/atn/LexerAction.rb', line 104 def hash "#{self.actionType}#{self.mode}".hash end |
#to_s ⇒ Object
112 113 114 |
# File 'lib/antlr4/atn/LexerAction.rb', line 112 def to_s "pushMode(#{self.mode})" end |