Print the AST out
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <ostream>
|
||||
#include <vector>
|
||||
#include <optional>
|
||||
|
||||
@@ -42,8 +43,13 @@ namespace Solstice {
|
||||
Node(NodeType type, const std::vector<Node>& children) : type(type), children(children) {}
|
||||
Node(const Literal& literal) : type(NodeType::Literal), data(literal) {}
|
||||
Node(const std::string& id) : type(NodeType::Identifier), data(id) {}
|
||||
|
||||
std::optional<Literal> getLiteral() const;
|
||||
std::optional<std::string> getIdentifier() const;
|
||||
};
|
||||
|
||||
std::ostream& operator<<(std::ostream& stream, const Node& node);
|
||||
|
||||
class Parser {
|
||||
|
||||
std::vector<Token> input;
|
||||
|
||||
Reference in New Issue
Block a user