lib/qlang/parser/func_parser.rb in qlang-0.0.14142135 vs lib/qlang/parser/func_parser.rb in qlang-0.0.27000000
- old
+ new
@@ -1,15 +1,14 @@
+require 'qlang/lexer/tokens'
module Qlang
module Parser
module FuncParser
include Base
- def execute(lexed)
- lexed.fix_r_txt!
- fdef_ary = lexed[0][:FDEF].split('')
- func_name = fdef_ary.shift
- args = fdef_ary.join.rms!('(', ')', ',', ' ').split('')
-
- FuncApi.execute(func_name, args, FormulaParser.execute(lexed[-1][:FOML]))
+ include Lexer::Tokens
+ def execute(string)
+ def_func, formula = string.split(/ *= */)
+ def_func =~ %r@(#{FUNCV})#{LPRN}#{ANYSP}(#{VARS_BY_CMA})#{ANYSP}#{RPRN}@
+ FuncApi.execute($1, $2.split(' *,'), FormulaParser.execute(formula))
end
module_function :execute
end
end
end