Class: Spells::Parser

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/spells/parser.rb

Instance Method Summary collapse

Constructor Details

#initializeParser

Returns a new instance of Parser.



5
6
7
8
9
10
# File 'lib/spells/parser.rb', line 5

def initialize
  Treetop.load File.expand_path('../../../grammar/spells/punctuation.treetop', __FILE__)
  Treetop.load File.expand_path('../../../grammar/spells/symbols.treetop', __FILE__)
  Treetop.load File.expand_path('../../../grammar/spells.treetop', __FILE__)
  @parser = SpellsParser.new
end

Instance Method Details

#parse(text) ⇒ Object



12
13
14
# File 'lib/spells/parser.rb', line 12

def parse(text)
  @parser.parse text
end