Class: Parser

Inherits:
Object
  • Object
show all
Defined in:
lib/purple/parser.rb

Constant Summary collapse

@@parser =
PurpleParser.new

Class Method Summary collapse

Class Method Details

.parse(code) ⇒ Object



8
9
10
11
12
13
# File 'lib/purple/parser.rb', line 8

def self.parse(code)
  tree = @@parser.parse code
  raise "Parse error at offset: #{@@parser.index} : #{@@parser.failure_reason}" if tree.nil?
  clean! tree
  tree.to_a
end