Class: Exalted::MathsParser
- Inherits:
-
Treetop::Runtime::CompiledParser
- Object
- Treetop::Runtime::CompiledParser
- Exalted::MathsParser
- 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
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/exalted_math.rb', line 9 def ast(text) txt = text.dup txt.strip! txt.gsub!(/\s+/," ") result = parse(txt) if result [true, result.ast] else [false, failure_reason] end end |