Giter Club home page Giter Club logo

Comments (5)

GoogleCodeExporter avatar GoogleCodeExporter commented on July 21, 2024
The current SVN development snapshot does not contain a method for retrieving 
the rpn. I see the rpn more as an implementation detail not meant for public 
access. In case of expression optimization there is no guarantee that tokens 
present in the rpn represent an actual expression token. They could also be the 
result of merging several tokens into a new one. Why do you need access to the 
rpn?

Original comment by [email protected] on 29 Jul 2013 at 9:56

from muparserx.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 21, 2024
My apologies... I just checked our code vs. the latest SVN, and found out that 
we must have changed the library source to access the RPN.

Looks like we added:
const RPN* GetRPN() const {return &m_rpn;} in mpparserbase.h

Accessing the RPN is very useful to us. For instance, after we Eval() or 
GetExprVar(), we use the RPN to get all the constants / values etc found by the 
parser and their values. In this way we can use it as a parser too, not only to 
evaluate the expressions. In one instance we us the RPN to pre-process the 
expressions before Eval() (e.g. we use GetExprVar()) and then we change the 
expression and call Eval() after that. That's how we discovered the m_nPosExpr 
issue I mentioned above.

Is there a design reason why m_nPosExpr is shared across all tokens with same 
identity or just didn't come up because m_nPosExpr it's never really used by 
the engine? thank you

Original comment by [email protected] on 30 Jul 2013 at 12:34

from muparserx.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 21, 2024
Thanks for the additional information. The expression position is really only 
ever used when emitting parsing erros. In those cases the parsing stops so 
there is no chance for invalidating it later on. You can change this behaviour 
easily by modifying two lines in TokenReader::IsVarOrConstTok. Just replace 
both occurences of

a_Tok = item->second 

with 

a_Tok = ptr_tok_type(item->second->Clone());

I added those lines to the current SVN head revision and I don't see an 
immediate problem with cloning the tokens instead of using the original one. 

Original comment by [email protected] on 30 Jul 2013 at 12:11

from muparserx.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 21, 2024
Thank you very much, I will change the code as suggested and test it. I will 
report back if we find any issues. thanks again for your help and for a 
FANTASTIC library.

Original comment by [email protected] on 1 Aug 2013 at 12:57

from muparserx.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 21, 2024
Closed, fixed in SVN head revision

Original comment by [email protected] on 30 Aug 2013 at 11:47

  • Changed state: Fixed

from muparserx.

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.