Comments (5)
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.
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.
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.
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.
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)
- Tag for release 4.0.9 HOT 2
- Missing header HOT 1
- README says that the version is 4.0.9 but the last tag is 4.0.8 HOT 2
- how to switch rad or gra when use trigonometric function HOT 2
- Incorrect Assignment Multiplication HOT 1
- Inconsistent Use of Signedness for Binary and Hex Numbers
- Feature Request: Add an Octal Value Reader
- logic operator lack shor-circuit feature
- 4.0.10 FTBFS HOT 1
- constant starting with letter 'o' HOT 5
- Example fails on macOS HOT 7
- int to bool conversion HOT 3
- type checking HOT 1
- xor is listed in the documentation but not implemented HOT 3
- Is it possible to directly represent a matrix instead of using many lines to define it? HOT 4
- FunTan and FunSin error HOT 2
- Is matrix algebra in SetExpr possible? HOT 2
- UnknownException when defining variables with dot (.) HOT 3
- Integer test causes floating point exceptions? HOT 1
- Assuming clang as the only compiler on Apple plaform. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from muparserx.