Class: ExaltedMath::MathsParser

Inherits:
Treetop::Runtime::CompiledParser
  • Object
show all
Includes:
Maths
Defined in:
lib/exalted_math.rb,
lib/exalted_math/math.rb

Instance Method Summary collapse

Methods included from Maths

#_nt_additive, #_nt_list, #_nt_max, #_nt_min, #_nt_multitive, #_nt_number, #_nt_primary, #_nt_space, #_nt_spec, #_nt_stat, #root

Instance Method Details

#ast(text) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/exalted_math.rb', line 12

def ast(text)
  txt = text.dup
  txt.strip!
  txt.gsub!(/\s+/," ")
  result = parse(txt)
  if result
    result.ast
  else
    raise ParseFailedError, failure_reason
  end
end