lib/qlang/parser/func_parser.rb in qlang-0.0.27 vs lib/qlang/parser/func_parser.rb in qlang-0.0.141
- old
+ new
@@ -1,14 +1,15 @@
-require 'qlang/lexer/tokens'
module Qlang
module Parser
module FuncParser
include Base
- 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))
+ 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, lexed[-1][:OTHER])
end
module_function :execute
end
end
end