lib/qlang/parser.rb in qlang-0.0.27182123 vs lib/qlang/parser.rb in qlang-0.0.27182124
- old
+ new
@@ -23,29 +23,30 @@
case lexed.token_str
when /:(vector)(\d+)/, /:(matrix)(\d+)/, /:(tmatrix)(\d+)/, /:(integral)(\d+)/, /:(def_func)(\d+)/, /:(differential)(\d+)/, /:(limit)(\d+)/, /:(sigma)(\d+)/
token_els = lexed.get_els($2)
- parsed = case $1
- when 'vector'
- VectorParser.execute(token_els)
- when 'matrix'
- MatrixParser.execute(token_els)
- when 'tmatrix'
- MatrixParser.execute(token_els, trans: true)
- when 'limit'
- LimitParser.execute(token_els)
- when 'integral'
- IntegralParser.execute(token_els)
- when 'def_func'
- FuncParser.execute(token_els)
- when 'sigma'
- SigmaParser.execute(token_els)
- when 'differential'
- del_var, formula = token_els
- "d/d#{del_var}(#{FormulaParser.execute(formula)})"
- end
+ parsed =
+ case $1
+ when 'vector'
+ VectorParser.execute(token_els)
+ when 'matrix'
+ MatrixParser.execute(token_els)
+ when 'tmatrix'
+ MatrixParser.execute(token_els, trans: true)
+ when 'limit'
+ LimitParser.execute(token_els)
+ when 'integral'
+ IntegralParser.execute(token_els)
+ when 'def_func'
+ FuncParser.execute(token_els)
+ when 'sigma'
+ SigmaParser.execute(token_els)
+ when 'differential'
+ del_var, formula = token_els
+ "d/d#{del_var}(#{FormulaParser.execute(formula)})"
+ end
lexed.parsed!(parsed, $2)
when /:LPRN(\d+):CONT(\d+):RPRN(\d+)/
tokens_range = $1.to_i..$3.to_i
token_val =
@@ -57,11 +58,12 @@
when /:LBRCS(\d+):CONT(\d+):RBRCS(\d+)/
tokens_range = $1.to_i..$3.to_i
token_val = lexed.get_value($2)
- cont = case token_val
+ cont =
+ case token_val
when /#{ONEHASH}(#{CMA}#{ONEHASH})*/
ListParser.execute(token_val)
else
token_val
end
@@ -93,8 +95,7 @@
else
str
end
end
end
-
end
end