mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-21 09:52:16 -07:00
Update peglib.h
This commit is contained in:
parent
c19d0355eb
commit
4288cd0703
4 changed files with 3722 additions and 2454 deletions
|
|
@ -51,9 +51,9 @@ double Expression::eval(const peg::Ast &ast)
|
|||
{
|
||||
const auto &nodes = ast.nodes;
|
||||
if (ast.name == "NUMBER") {
|
||||
return stod(ast.token);
|
||||
return stod(std::string(ast.token));
|
||||
} else if (ast.name == "FUNCTION") {
|
||||
QString name = QString::fromStdString(nodes[0]->token);
|
||||
QString name = QString::fromStdString(std::string(nodes[0]->token));
|
||||
if (!fns.contains(name))
|
||||
return 0;
|
||||
return fns[name](eval(*nodes[1]));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue