Code Monkey home page Code Monkey logo

Comments (4)

VinGarcia avatar VinGarcia commented on May 30, 2024

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.

VinGarcia avatar VinGarcia commented on May 30, 2024

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.

 avatar commented on May 30, 2024

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.

VinGarcia avatar VinGarcia commented on May 30, 2024

Hehe that's good. But feel free to open a new issue if you have one.

from cparse.

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.