12 template<
typename T>
struct ErrorOr
15 std::shared_ptr<T> get()
30 ErrorOr(T* ptr) : m_ptr(ptr), m_is_error(
false)
34 ErrorOr(
const std::string& error,
const Token& error_tok)
35 : m_error(error), m_is_error(
true), error_tok(error_tok)
48 std::unique_ptr<Token> error_tok;
49 std::shared_ptr<T> m_ptr;
56 ErrorOr<ExprNode> walk_expr();
57 ErrorOr<NumberNode> walk_number();
62 void save_current_position();
63 void restore_current_position();
71 std::shared_ptr<ASTNode>
parse();
std::vector< Token > TokenStream
Definition: Lexer.h:7
~Parser()
Definition: Parser.cpp:7
static std::shared_ptr< Parser > new_parser(const TokenStream &tokens)
Definition: Parser.cpp:11
std::shared_ptr< ASTNode > parse()
Definition: Parser.cpp:17
void throw_error(const Location &loc, const std::string line_text, const std::string &details)
Definition: Error.cpp:41