class Parser
Load our custom syntax node classes so the parser can use them require File.join(base_path, 'node_extensions.rb')
Public Class Methods
parse(data)
click to toggle source
puts “- Parser
created loaded”
# File lib/use_case_diagram/parser.rb, line 22 def self.parse(data) # Pass the data to the parser instance tree = @@parser.parse(data) # puts "- Data parsed" # If tree is nil then there was an error during parsing # we need to report a simple error message to help the user if(tree.nil?) puts @@parser.failure_reason puts @@parser.failure_line puts @@parser.failure_column puts "LINE WITH ERROR:#{data.split("\n")[@@parser.failure_line]}" raise Exception, "Parse error at offset: #{@@parser.index}" end diag=tree.obj diag.fill_nodes return diag end