update with initial syntaxer implementation
This commit is contained in:
+22
-3
@@ -66,6 +66,11 @@ public:
|
||||
}
|
||||
} v;
|
||||
|
||||
Token(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
Token(std::string s)
|
||||
: v(s)
|
||||
{
|
||||
@@ -168,9 +173,23 @@ public:
|
||||
};
|
||||
|
||||
class TreeNode {
|
||||
std::shared_ptr<Token> l; // left hand
|
||||
std::shared_ptr<Token> o; // operation
|
||||
std::shared_ptr<Token> r; // right hand
|
||||
public:
|
||||
TreeNode *l; // left hand
|
||||
TreeNode *r; // right hand
|
||||
Token o; // operator
|
||||
|
||||
~TreeNode()
|
||||
{
|
||||
if (l != nullptr)
|
||||
{
|
||||
delete l;
|
||||
}
|
||||
|
||||
if (r != nullptr)
|
||||
{
|
||||
delete r;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
+1
-1
@@ -9,4 +9,4 @@
|
||||
#define pr_debug(...) do {} while (0)
|
||||
#endif
|
||||
|
||||
#define pr_warn(...) std::cout << "[" << __func__ << ":" << __LINE__ << "] warning: " << __VA_ARGS__ << "\n"
|
||||
#define pr_warn(...) std::cout << "[" << __FILE__ << ":" << __LINE__ << " " << __func__ << "] warning: " << __VA_ARGS__ << "\n"
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
#include "expression.hpp"
|
||||
|
||||
namespace Syntax
|
||||
{
|
||||
|
||||
struct SyntaxIssue
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
std::vector<SyntaxIssue> check_syntax(std::vector<Expression::Token>& tv);
|
||||
std::shared_ptr<Expression::TreeNode> build_op_tree(std::vector<Expression::Token>& tv);
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user