new prefix operator "!" as logic NOT
This commit is contained in:
parent
760c1ee6da
commit
6b3351b324
@ -444,8 +444,7 @@ func (parser *parser) parseGeneral(scanner *scanner, ctx parserContext, termSymb
|
|||||||
} else if tk.IsSymbol(SymStar) {
|
} else if tk.IsSymbol(SymStar) {
|
||||||
tk.SetSymbol(SymDereference)
|
tk.SetSymbol(SymDereference)
|
||||||
} else if tk.IsSymbol(SymExclamation) {
|
} else if tk.IsSymbol(SymExclamation) {
|
||||||
err = tk.Errorf("postfix opertor %q requires an operand on its left side", tk)
|
tk.SetSymbol(SymNot)
|
||||||
break
|
|
||||||
}
|
}
|
||||||
firstToken = false
|
firstToken = false
|
||||||
}
|
}
|
||||||
|
@ -26,12 +26,13 @@ func TestBool(t *testing.T) {
|
|||||||
/* 12 */ {`true or false`, true, nil},
|
/* 12 */ {`true or false`, true, nil},
|
||||||
/* 13 */ {`true or []`, true, nil},
|
/* 13 */ {`true or []`, true, nil},
|
||||||
/* 14 */ {`[] or false`, nil, errors.New(`got list as left operand type of 'OR' operator, it must be bool`)},
|
/* 14 */ {`[] or false`, nil, errors.New(`got list as left operand type of 'OR' operator, it must be bool`)},
|
||||||
|
/* 15 */ {`!true`, false, nil},
|
||||||
/* 13 */ //{`true or []`, nil, errors.New(`[1:8] left operand 'true' [bool] and right operand '[]' [list] are not compatible with operator "OR"`)},
|
/* 13 */ //{`true or []`, nil, errors.New(`[1:8] left operand 'true' [bool] and right operand '[]' [list] are not compatible with operator "OR"`)},
|
||||||
}
|
}
|
||||||
|
|
||||||
// t.Setenv("EXPR_PATH", ".")
|
// t.Setenv("EXPR_PATH", ".")
|
||||||
|
|
||||||
// runTestSuiteSpec(t, section, inputs, 1)
|
// runTestSuiteSpec(t, section, inputs, 15)
|
||||||
runTestSuite(t, section, inputs)
|
runTestSuite(t, section, inputs)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user