Class: Antlr4::Runtime::LexerTypeAction
- Inherits:
-
LexerAction
- Object
- LexerAction
- Antlr4::Runtime::LexerTypeAction
- Defined in:
- lib/antlr4/runtime/lexer_type_action.rb
Instance Attribute Summary collapse
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #action_type ⇒ Object
- #eql?(other) ⇒ Boolean
- #execute(lexer) ⇒ Object
- #hash ⇒ Object
-
#initialize(type) ⇒ LexerTypeAction
constructor
A new instance of LexerTypeAction.
- #position_dependent? ⇒ Boolean
- #to_s ⇒ Object
Constructor Details
#initialize(type) ⇒ LexerTypeAction
Returns a new instance of LexerTypeAction.
6 7 8 |
# File 'lib/antlr4/runtime/lexer_type_action.rb', line 6 def initialize(type) @type = type end |
Instance Attribute Details
#type ⇒ Object (readonly)
Returns the value of attribute type.
4 5 6 |
# File 'lib/antlr4/runtime/lexer_type_action.rb', line 4 def type @type end |
Instance Method Details
#action_type ⇒ Object
10 11 12 |
# File 'lib/antlr4/runtime/lexer_type_action.rb', line 10 def action_type LexerActionType::TYPE end |
#eql?(other) ⇒ Boolean
37 38 39 40 41 42 43 44 45 |
# File 'lib/antlr4/runtime/lexer_type_action.rb', line 37 def eql?(other) if other == self return true else return false unless other.is_a? LexerTypeAction end @type == other.type end |
#execute(lexer) ⇒ Object
18 19 20 |
# File 'lib/antlr4/runtime/lexer_type_action.rb', line 18 def execute(lexer) lexer._type = @type end |
#hash ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/antlr4/runtime/lexer_type_action.rb', line 22 def hash return @_hash unless @_hash.nil? hash_code = RumourHash.calculate([action_type, @type]) unless @_hash.nil? if hash_code == @_hash puts 'Same hash_code for LexerTypeAction' else puts 'Different hash_code for LexerTypeAction' end end @_hash = hash_code end |
#position_dependent? ⇒ Boolean
14 15 16 |
# File 'lib/antlr4/runtime/lexer_type_action.rb', line 14 def position_dependent? false end |
#to_s ⇒ Object
47 48 49 |
# File 'lib/antlr4/runtime/lexer_type_action.rb', line 47 def to_s 'type(' << @type << ')' end |