Skip to content

Commit

Permalink
Fixing bugs with subtraction.
Browse files Browse the repository at this point in the history
  • Loading branch information
Pulover committed Oct 26, 2020
1 parent 0b82a7c commit 5c4f425
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
4 changes: 1 addition & 3 deletions Eval.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -488,8 +488,6 @@ ExprCompile(e)
ExprEval(e,lp,eo,el)
{
c1:=Chr(1)
While (RegExMatch(e,c1 "l-[\d\.]++(?!" c1 "o)"))
e:=RegExReplace(e,c1 "l-([\d\.]+)",c1 "l$1" c1 "o-")
Loop,Parse,e,%c1%
{
lf:=A_LoopField,tt:=SubStr(lf,1,1),t:=SubStr(lf,2)
Expand Down Expand Up @@ -717,7 +715,7 @@ Exprt(e)
m2:=StrReplace(m2,".","'2E",,1)
e1.=SubStr(e,f1,f-f1) . m1 . c1 . "n" . m2 . c1,f+=StrLen(m),f1:=f
}
e:=e1 . SubStr(e,f1),e1:="",e:=RegExReplace(e,"S)(^|\(|[^" . c1 . "-])-" . c1 . "n","$1" . c1 . "n'2D")
e:=e1 . SubStr(e,f1),e1:="" ; ,e:=RegExReplace(e,"S)(^|\(|[^" . c1 . "-])-" . c1 . "n","$1" . c1 . "n'2D")
, e:=StrReplace(e,c1 "n",c1 "l")
, e:=RegExReplace(e,"\\\.(\d+)\.(\d+)",c1 . "l$1'2E$2" . c1)
, e:=RegExReplace(RegExReplace(e,"S)(%[\w#@\$]{1,253})%","$1"),"S)(?:^|[^\w#@\$'" . c1 . "])\K[\w#@\$]{1,253}(?=[^\(\w#@\$]|$)",c1 . "v$0" . c1),f:=1,f1:=1
Expand Down
2 changes: 1 addition & 1 deletion Examples/EvalExamples.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ MsgBox, 1, Operators, % "Expression: `n`n" Expression "`n`n`nResults:`n`n" r
IfMsgBox, Cancel, ExitApp

; Variable Assignment
Expression := "A := 100, B := A - 5 - 10 - 15, B, VarA := 123,VarB := VarA - 23,VarX := ""First,Second,Third,Fourth"""
Expression := "A := 100, B := A - 5 - 10 - 15, B, C := A - B - 5, VarA := 123,VarB := VarA - 23,VarX := ""First,Second,Third,Fourth"""
Result := Eval(Expression)
r := StrJoin(Result, "`n")
MsgBox, 1, Variable Assignment, % "Expression: `n`n" Expression "`n`n`nResults:`n`n" r
Expand Down

0 comments on commit 5c4f425

Please sign in to comment.