Formula parsing extensions
This commit is contained in:
parent
7032bd4fb0
commit
d768adb86b
@ -83,7 +83,8 @@ module BodyTracking
|
|||||||
# failing test vectors:
|
# failing test vectors:
|
||||||
# - fcall disallowed: "abs(Fats)+Energy < 10"
|
# - fcall disallowed: "abs(Fats)+Energy < 10"
|
||||||
# working test vectors:
|
# working test vectors:
|
||||||
# a.abs(Fats)+Energy < 10
|
# Fats.abs+Energy < 10
|
||||||
|
# (Energy-Calculated).abs > 10
|
||||||
identifiers = []
|
identifiers = []
|
||||||
disallowed_functions = Set.new
|
disallowed_functions = Set.new
|
||||||
|
|
||||||
@ -93,7 +94,7 @@ module BodyTracking
|
|||||||
while stree.first
|
while stree.first
|
||||||
ttype, token, *rest = stree.shift
|
ttype, token, *rest = stree.shift
|
||||||
case ttype
|
case ttype
|
||||||
when :program, :args_add_block
|
when :program, :args_add_block, :paren
|
||||||
stree.unshift(*token)
|
stree.unshift(*token)
|
||||||
when :binary
|
when :binary
|
||||||
operator, token2 = rest
|
operator, token2 = rest
|
||||||
@ -116,7 +117,7 @@ module BodyTracking
|
|||||||
when :var_ref
|
when :var_ref
|
||||||
vtype, vname, vloc = token
|
vtype, vname, vloc = token
|
||||||
identifiers << vname
|
identifiers << vname
|
||||||
when :@int
|
when :@int, :@float
|
||||||
else
|
else
|
||||||
errors << [:disallowed_token, {token: token, ttype: ttype}]
|
errors << [:disallowed_token, {token: token, ttype: ttype}]
|
||||||
end
|
end
|
||||||
|
Reference in New Issue
Block a user