Comments (4)
Uhmm, it should work.
The packToken type can be printed or converted to a string:
std::cout << scope["fpdProject"] << std::endl;
scope["fpdProject"].str()
This should help us understand what's going on.
from cparse.
I have come up with a small sample with this same trick that works in gcc, maybe testing it on your environment could help us isolate the problem:
#include <iostream>
#include <memory>
#include <string>
#include "cparse/shunting-yard.h"
#include "cparse/builtin-features.inc"
namespace datamanager {
// Some stub fake of you FPDProject class:
struct FPDProject {
std::string name;
FPDProject(std::string name) : name(name) {}
};
}
int main() {
// Initialize built-in features:
cparse_startup();
auto _project = std::make_shared<datamanager::FPDProject>("test");
TokenMap scope;
scope["project"] = reinterpret_cast<int64_t>(_project.get());
// This should show up a number of type "integer":
std::cout << calculator::calculate("project", scope) << std::endl;
std::cout << calculator::calculate("type(project)", scope) << std::endl;
// This should not throw:
auto project = reinterpret_cast<datamanager::FPDProject*>(scope["project"].asInt());
}
I compiled this with:
g++ --std=c++11 core-shunting-yard.o main.cpp
I hope this helps =]
from cparse.
Totally on me , i did not use the same key to write then read my bad thanks again !! (i'm starting to understand the design of the parser better hopefully you won't see me here again)
from cparse.
Hehe that's good. But feel free to open a new issue if you have one.
from cparse.
Related Issues (20)
- exception on simple calculatorexample
- Segmentation fault on bad inputs
- group/vector operation possible? Naive iteration can be expensive when number of elements is huge HOT 5
- terminating with uncaught exception of type syntax_error: Invalid operator: - HOT 4
- Token names cannot have UTF8 characters HOT 4
- Project doesn't install anything HOT 10
- Syntax errors cause crashes HOT 21
- Hexadecimal number computation HOT 4
- calculator ignores variable HOT 3
- Consider adding a namespace to cparse code HOT 6
- Program treats "." in numeric "0.x" as an operator and throw an exception! HOT 5
- Thread Safety HOT 4
- Is not operator supported? HOT 1
- Warning c4099 is everywhere. HOT 3
- Invalid operators, but with ALL operators HOT 1
- It doesn't compile in Windows and Linux, am I doing something wrong? HOT 3
- Buffer-overflow (out-of-bounds read) occured in two positions HOT 1
- cparse/builtin-features/operators.inc HOT 9
- Solved. Errors with Linux emulator using GCC. HOT 22
- TokenMap value change to None,when using getChild() HOT 6
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 cparse.