From 234759158c6666986838c6baebe4d8be7e23c9bc Mon Sep 17 00:00:00 2001 From: Celestino Amoroso Date: Sat, 13 Jul 2024 18:10:04 +0200 Subject: [PATCH] scanner: disabled prefix operator '()' --- scanner.go | 8 ++++---- t_funcs_test.go | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/scanner.go b/scanner.go index bae23e1..bca0b4f 100644 --- a/scanner.go +++ b/scanner.go @@ -269,11 +269,11 @@ func (scanner *scanner) fetchNextToken() (tk *Token) { tk = scanner.makeToken(SymDollar, ch) } case '(': - if next, _ := scanner.peek(); next == ')' { - tk = scanner.moveOn(SymOpenClosedRound, ch, next) - } else { +// if next, _ := scanner.peek(); next == ')' { +// tk = scanner.moveOn(SymOpenClosedRound, ch, next) +// } else { tk = scanner.makeToken(SymOpenRound, ch) - } +// } case ')': tk = scanner.makeToken(SymClosedRound, ch) case '[': diff --git a/t_funcs_test.go b/t_funcs_test.go index cebcb51..ebec3aa 100644 --- a/t_funcs_test.go +++ b/t_funcs_test.go @@ -30,13 +30,14 @@ func TestFuncs(t *testing.T) { /* 17 */ {`f=func(x,n){1}; f(3,4,)`, nil, `[1:24] expected "function-param-value", got ")"`}, /* 18 */ {`factory=func(base){func(){@base=base+1}}; inc10=factory(10); inc5=factory(5); inc10(); inc5(); inc10()`, int64(12), nil}, /* 19 */ {`f=func(a,y=1,z="sos"){}; string(f)`, `f(a, y=1, z="sos"):any{}`, nil}, +// /* 20 */ {`a=[func(){3}]; a[0]()`, int64(3), nil}, // /* 20 */ {`m={}; m["f"]=func(){3}; m["f"]()`, int64(3), nil}, // /* 18 */ {`f=func(a){a*2}`, nil, errors.New(`[1:24] expected "function-param-value", got ")"`)}, } // t.Setenv("EXPR_PATH", ".") - // runTestSuiteSpec(t, section, inputs, 20) + //runTestSuiteSpec(t, section, inputs, 20) runTestSuite(t, section, inputs) }