Giter Site home page Giter Site logo

Comments (10)

uklimaschewski avatar uklimaschewski commented on June 20, 2024 2

I plan a release after some more issues are fixed, will be soon.

from evalex.

HSGamer avatar HSGamer commented on June 20, 2024 1

After debugging some nonsense & evaluable strings, I think the culprit is in this line

When I try the normal expressions, the operandStack size is mostly 1 so it'll take the whole tokenized node.
However, when I try the nonsense strings, the operandStack size is higher than 1 (Test 2 + 2 2 + 3 would be 3) and the line would take the last node in the stack.

I think we should include another exception check when operandStack is higher than 1 after the Shunting Yard conversion.

EDIT: Is there any legit case where the operandStack size is higher than 1? Because I could be wrong since I only tested with a little part of the Unit Tests.

from evalex.

HSGamer avatar HSGamer commented on June 20, 2024 1

When looking at it quickly back then, I also noticed this. There may be some use case if you use functions with multiple parameters. You could try how it behaves for an if call for example.

It's verified that the size is also 1 (IF(5 + 2 > 3, 5 + 2, 2 + 3) + FLOOR(11.2)).
I'll make a PR and wait for the owner to reply further more.

from evalex.

RobertZenz avatar RobertZenz commented on June 20, 2024

I believe that is implicit multiplication at work.

Test 2 + 2 2 + 3
   0 2 + 2 2 + 3
   0*2 + 2*2 + 3
   0   +  4  + 3 = 7

Basically, but seems like the first one is dropped somewhen before the actual evaluation because the variable is not set.

from evalex.

Maxr1998 avatar Maxr1998 commented on June 20, 2024

I don't think that's the case. An unset variable should error out, but it doesn't because it's already dropped before the abstract syntax tree is evaluated.

Another example: 2 3 + 4 evaluates to 7, which completely ignores the 2. If it was implicit multiplication, it should result in 9.

from evalex.

RobertZenz avatar RobertZenz commented on June 20, 2024

That's true, then I'm out of ideas.

from evalex.

HSGamer avatar HSGamer commented on June 20, 2024

Test World would become {"type":"VARIABLE_OR_CONSTANT","value":"World"}
Test World Hello would become {"type":"VARIABLE_OR_CONSTANT","value":"Hello"}
Test World 1 would become {"type":"NUMBER_LITERAL","value":"1"}

So, same issue I guess.

from evalex.

Maxr1998 avatar Maxr1998 commented on June 20, 2024

When looking at it quickly back then, I also noticed this. There may be some use case if you use functions with multiple parameters. You could try how it behaves for an if call for example.

from evalex.

Maxr1998 avatar Maxr1998 commented on June 20, 2024

Thanks for the fix and merge! Will there be a patch release with this fix applied in the near future?

from evalex.

Maxr1998 avatar Maxr1998 commented on June 20, 2024

Alright, no rush, thanks for the info though!

from evalex.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.