lib/graphviz/parser.rb in ruby-graphviz-0.9.3 vs lib/graphviz/parser.rb in ruby-graphviz-0.9.4

- old
+ new

@@ -42,12 +42,12 @@ end end class Graph < Treetop::Runtime::SyntaxNode def eval( context, hOpts ) - puts "GRAPH TYPE = #{type.text_value}" - puts "GRAPH NAME = #{name.text_value}" + # puts "GRAPH TYPE = #{type.text_value}" + # puts "GRAPH NAME = #{name.text_value}" hOpts = hOpts[0].merge( {:type => type.text_value} ) # Create Graph context.graph = GraphViz.new( name.text_value.gsub(/"/, ""), hOpts ) @@ -67,44 +67,44 @@ end end class GraphPreference < Treetop::Runtime::SyntaxNode def eval( context ) - puts "GRAPH PREFERENCE : " - puts " #{key.text_value} = #{value.text_value.gsub(/"/, "")}" + # puts "GRAPH PREFERENCE : " + # puts " #{key.text_value} = #{value.text_value.gsub(/"/, "")}" context.graph[key.text_value] = value.text_value.gsub(/"/, "") end end class NamedGraphPreference < Treetop::Runtime::SyntaxNode def eval( context ) - puts "GRAPH PREFERENCES :" + # puts "GRAPH PREFERENCES :" options.eval().each do |k,v| context.graph[k] = v end end end class NodePreference < Treetop::Runtime::SyntaxNode def eval( context ) - puts "NODE PREFERENCES :" + # puts "NODE PREFERENCES :" context.options[:node] = context.options[:node].merge( options.eval() ) end end class EdgePreference < Treetop::Runtime::SyntaxNode def eval( context ) - puts "EDGE PREFERENCES :" + # puts "EDGE PREFERENCES :" context.options[:edge] = context.options[:edge].merge( options.eval() ) end end class Node < Treetop::Runtime::SyntaxNode def eval( context ) node_name = name.text_value.gsub( /"/, "" ) - puts "NODE NAME = #{node_name}" - puts "OPTIONS = " + # puts "NODE NAME = #{node_name}" + # puts "OPTIONS = " # Create node node = context.nodes[node_name] || context.graph.add_node( node_name ) # Add global options @@ -124,11 +124,11 @@ end end class Edge < Treetop::Runtime::SyntaxNode def create_node( name, context ) - puts " NEED TO CREATE NODE : #{name}" + # puts " NEED TO CREATE NODE : #{name}" # Create the node node = context.graph.add_node( name ) # Add global options context.options[:node].each do |k, v| @@ -158,14 +158,14 @@ end def eval( context ) one_name = node_one.text_value.gsub( /"/, "" ) two_name = node_two.text_value.gsub( /"/, "" ) - puts "EDGE" - puts "NODE ONE = #{one_name}" - puts "NODE TWO = #{two_name}" - puts "OPTIONS = " + # puts "EDGE" + # puts "NODE ONE = #{one_name}" + # puts "NODE TWO = #{two_name}" + # puts "OPTIONS = " # Get or create node one one = context.nodes[one_name] || create_node( one_name, context ) # Get or create node two @@ -179,11 +179,11 @@ create_edge( one, two, edge_options, context ) last_node = two other_nodes.elements.each do |e| new_node_name = e.next_node.text_value.gsub( /"/, "" ) - puts "OTHER NODE : #{new_node_name}" + # puts "OTHER NODE : #{new_node_name}" new_node = context.nodes[new_node_name] || create_node( new_node_name, context ) create_edge( last_node, new_node, edge_options, context ) last_node = new_node @@ -191,11 +191,11 @@ end end class Subgraph < Treetop::Runtime::SyntaxNode def eval( context ) - puts "CREATE SUBGRAPH : #{name.text_value}" + # puts "CREATE SUBGRAPH : #{name.text_value}" # Save options saved_options = context.options.clone # Save graph saved_graph = context.graph @@ -218,13 +218,13 @@ class Options < Treetop::Runtime::SyntaxNode def eval options = {} elements[2].elements.each do |e| - puts " #{e.elements[0].text_value} = #{e.elements[4].text_value}" + # puts " #{e.elements[0].text_value} = #{e.elements[4].text_value}" options[e.elements[0].text_value] = e.elements[4].text_value.gsub( /"/, "" ) end - puts " #{elements[3].text_value} = #{elements[7].text_value}" + # puts " #{elements[3].text_value} = #{elements[7].text_value}" options[elements[3].text_value] = elements[7].text_value.gsub( /"/, "" ) return options end end