New, more flexible, parser context datatype that includes and extends
the previous flags allowForest and allowVarRef. Added binary operator (work in progress). Better implementation of +=,-=,*=, and /= (new) operators.
This commit is contained in:
+6
-6
@@ -17,13 +17,13 @@ func TestExpr(t *testing.T) {
|
||||
/* 3 */ {`builtin "os.file"; f=fileOpen("test-file.txt"); line=fileReadText(f); fileClose(f); line`, "uno", nil},
|
||||
/* 4 */ {`mynot=func(v){int(v)?{true}::{false}}; mynot(0)`, true, nil},
|
||||
/* 5 */ {`1 ? {1} : [1+0] {3*(1+1)}`, int64(6), nil},
|
||||
/* 6 */ {`a=3; a+=1`, int64(4), nil},
|
||||
/* 7 */ {`a=3; a-=1`, int64(2), nil},
|
||||
/* 8 */ {`a=3; a*=2`, int64(6), nil},
|
||||
/* 6 */ {`a=3; a+=1; a`, int64(4), nil},
|
||||
/* 7 */ {`a=3; a-=1; a`, int64(2), nil},
|
||||
/* 8 */ {`a=3; a*=2; a`, int64(6), nil},
|
||||
/* 9 */ {`v=[10,20,30]; v[0]+=1; v[0]`, int64(11), nil},
|
||||
/* 10 */ {`r={"a":10}; r["a"]+=1; r["a"]`, int64(11), nil},
|
||||
/* 11 */ {`a=3; a/=2`, nil, `[1:8] left operand of "=" must be a variable or a collection's item`},
|
||||
/* 12 */ {`*=2`, nil, `[1:2] left operand of "*=" must be a variable or a variable expression`},
|
||||
/* 11 */ {`a=3; a/=2`, int64(1), nil},
|
||||
/* 12 */ {`*=2`, nil, `[1:2] infix operator "*=" requires two non-nil operands, got 1`},
|
||||
/* 13 */ {`a=3; a*=2+1; a`, int64(9), nil},
|
||||
/* 14 */ {`a=3; (a*=2)+1; a`, int64(6), nil},
|
||||
/* 15 */ {`a=3; a*=2)+1; a`, nil, `[1:11] unexpected token ")"`},
|
||||
@@ -44,6 +44,6 @@ func TestExpr(t *testing.T) {
|
||||
}
|
||||
// t.Setenv("EXPR_PATH", ".")
|
||||
|
||||
// runTestSuiteSpec(t, section, inputs, 17)
|
||||
// runTestSuiteSpec(t, section, inputs, 6, 7, 8, 9)
|
||||
runTestSuite(t, section, inputs)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user