1#pragma once
 2
 3#include "lexer.h"
 4#include "runtime.h"
 5#include "utils.h"
 6
 7#include <string>
 8#include <stdexcept>
 9
10namespace jinja {
11
12// parse from a list of tokens into an AST (program)
13// may throw parser_exception on error
14program parse_from_tokens(const lexer_result & lexer_res);
15
16struct parser_exception : public std::runtime_error {
17    parser_exception(const std::string & msg, const std::string & source, size_t pos)
18        : std::runtime_error(fmt_error_with_source("parser", msg, source, pos)) {}
19};
20
21} // namespace jinja