Class: Antlr4::Runtime::TerminalNodeImpl
- Inherits:
-
TerminalNode
- Object
- ParseTree
- TerminalNode
- Antlr4::Runtime::TerminalNodeImpl
- Defined in:
- lib/antlr4/runtime/terminal_node_impl.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#parent ⇒ Object
Returns the value of attribute parent.
-
#symbol ⇒ Object
Returns the value of attribute symbol.
Instance Method Summary collapse
- #accept(visitor) ⇒ Object
- #child(_i) ⇒ Object
- #child_count ⇒ Object
-
#initialize(symbol) ⇒ TerminalNodeImpl
constructor
A new instance of TerminalNodeImpl.
- #payload ⇒ Object
- #source_interval ⇒ Object
- #text ⇒ Object
- #to_s ⇒ Object
- #to_string_tree(_parser = nil) ⇒ Object
Constructor Details
#initialize(symbol) ⇒ TerminalNodeImpl
Returns a new instance of TerminalNodeImpl.
9 10 11 |
# File 'lib/antlr4/runtime/terminal_node_impl.rb', line 9 def initialize(symbol) @symbol = symbol end |
Instance Attribute Details
#parent ⇒ Object
Returns the value of attribute parent.
7 8 9 |
# File 'lib/antlr4/runtime/terminal_node_impl.rb', line 7 def parent @parent end |
#symbol ⇒ Object
Returns the value of attribute symbol.
6 7 8 |
# File 'lib/antlr4/runtime/terminal_node_impl.rb', line 6 def symbol @symbol end |
Instance Method Details
#accept(visitor) ⇒ Object
32 33 34 |
# File 'lib/antlr4/runtime/terminal_node_impl.rb', line 32 def accept(visitor) visitor.visit_terminal(self) end |
#child(_i) ⇒ Object
13 14 15 |
# File 'lib/antlr4/runtime/terminal_node_impl.rb', line 13 def child(_i) nil end |
#child_count ⇒ Object
28 29 30 |
# File 'lib/antlr4/runtime/terminal_node_impl.rb', line 28 def child_count 0 end |
#payload ⇒ Object
17 18 19 |
# File 'lib/antlr4/runtime/terminal_node_impl.rb', line 17 def payload @symbol end |
#source_interval ⇒ Object
21 22 23 24 25 26 |
# File 'lib/antlr4/runtime/terminal_node_impl.rb', line 21 def source_interval return Interval.invalid if @symbol.nil? token_index = @symbol.token_index Interval.new(token_index, token_index) end |
#text ⇒ Object
36 37 38 |
# File 'lib/antlr4/runtime/terminal_node_impl.rb', line 36 def text @symbol.text end |
#to_s ⇒ Object
44 45 46 47 48 |
# File 'lib/antlr4/runtime/terminal_node_impl.rb', line 44 def to_s return '<EOF>' if @symbol.type == Token::EOF @symbol.text end |
#to_string_tree(_parser = nil) ⇒ Object
40 41 42 |
# File 'lib/antlr4/runtime/terminal_node_impl.rb', line 40 def to_string_tree(_parser = nil) to_s end |