govaluate icon indicating copy to clipboard operation
govaluate copied to clipboard

Error nil for Invalid Expression ((amount > 100 &&) == false)

Open ankuagarwal opened this issue 6 years ago • 4 comments

Version: 3.0.0 Revision: d216395917cc49052c7c7094cf57f09657ca08a8 Expression: (amount > '100' &&) == false

When I am trying _, err := govaluate.NewEvaluableExpression((amount > '100' &&) == false), the value of err is nil.

The expression is syntactically incorrect, still no error is raised.

ankuagarwal avatar May 18 '18 12:05 ankuagarwal

It may be 100 not '100'. And amount > 100 && is still weird. There's nothing behind &&?

shenwei356 avatar May 18 '18 12:05 shenwei356

@shenwei356 Its showing valid expression for both '100' or 100. There is nothing behind &&, thats the major issue.

ankuagarwal avatar May 18 '18 12:05 ankuagarwal

You're correct, that's a bug. I've got a fix, but there are a series of other changes I'm looking to make, and i'm not sure what order / version these things will fall out in. So it's not in master branch yet - but soon.

Knetic avatar Jun 17 '18 19:06 Knetic

You'll also need to address these cases too.

ParsingFailureTest{

	Name:     "Hanging equality operation, followed by clause-close (#92)",
	Input:    "(amount > '100' !=) == false",
	Expected: INVALID_TOKEN_TRANSITION,
},
ParsingFailureTest{

	Name:     "Hanging comparison operation, followed by clause-close (#92)",
	Input:    "(amount > '100' >) == false",
	Expected: INVALID_TOKEN_TRANSITION,
},

hyprhare avatar Oct 11 '18 19:10 hyprhare