Class: Dhaka::ParseSuccessResult

Inherits:
ParseTreeCompositeNode show all
Defined in:
lib/dhaka/parser/parse_result.rb

Overview

Returned on successful parsing of the input token stream.

Instance Attribute Summary collapse

Attributes inherited from ParseTreeCompositeNode

#child_nodes, #production

Instance Method Summary collapse

Methods inherited from ParseTreeCompositeNode

#head_node?, #linearize, #to_s, #tokens

Constructor Details

#initialize(parse_tree) ⇒ ParseSuccessResult

:nodoc:



7
8
9
10
# File 'lib/dhaka/parser/parse_result.rb', line 7

def initialize(parse_tree) #:nodoc:
  super
  @parse_tree = parse_tree
end

Instance Attribute Details

#parse_treeObject Also known as: syntax_tree

Contains the parse result.



5
6
7
# File 'lib/dhaka/parser/parse_result.rb', line 5

def parse_tree
  @parse_tree
end

Instance Method Details

#has_error?Boolean

This is false.

Returns:

  • (Boolean)


13
14
15
# File 'lib/dhaka/parser/parse_result.rb', line 13

def has_error? 
  false
end

#to_dotObject

Returns the dot representation of the parse tree



18
19
20
21
22
# File 'lib/dhaka/parser/parse_result.rb', line 18

def to_dot
  Dot::Digraph.new(:fontsize => 10, :shape => :box, :size => 5) do |g|
    parse_tree.to_dot(g)
  end.to_dot
end