Class: Dhaka::ParseTreeLeafNode
- Inherits:
-
Object
- Object
- Dhaka::ParseTreeLeafNode
- Defined in:
- lib/dhaka/parser/parse_tree.rb
Overview
These are leaf nodes of syntax trees. They contain tokens.
Instance Attribute Summary collapse
-
#token ⇒ Object
readonly
Returns the value of attribute token.
Instance Method Summary collapse
-
#head_node? ⇒ Boolean
:nodoc:.
-
#initialize(token) ⇒ ParseTreeLeafNode
constructor
:nodoc:.
-
#linearize ⇒ Object
:nodoc:.
-
#to_dot(graph) ⇒ Object
Returns the dot representation of this node.
-
#to_s ⇒ Object
:nodoc:.
- #tokens ⇒ Object
Constructor Details
#initialize(token) ⇒ ParseTreeLeafNode
:nodoc:
41 42 43 |
# File 'lib/dhaka/parser/parse_tree.rb', line 41 def initialize(token) #:nodoc: @token = token end |
Instance Attribute Details
#token ⇒ Object (readonly)
Returns the value of attribute token.
39 40 41 |
# File 'lib/dhaka/parser/parse_tree.rb', line 39 def token @token end |
Instance Method Details
#head_node? ⇒ Boolean
:nodoc:
62 63 64 |
# File 'lib/dhaka/parser/parse_tree.rb', line 62 def head_node? #:nodoc: false end |
#linearize ⇒ Object
:nodoc:
45 46 47 |
# File 'lib/dhaka/parser/parse_tree.rb', line 45 def linearize #:nodoc: [] end |
#to_dot(graph) ⇒ Object
Returns the dot representation of this node.
58 59 60 |
# File 'lib/dhaka/parser/parse_tree.rb', line 58 def to_dot(graph) graph.node(self, :label => token) end |
#to_s ⇒ Object
:nodoc:
53 54 55 |
# File 'lib/dhaka/parser/parse_tree.rb', line 53 def to_s #:nodoc: "LeafNode: #{token}" end |
#tokens ⇒ Object
49 50 51 |
# File 'lib/dhaka/parser/parse_tree.rb', line 49 def tokens [token] end |