]> git.lizzy.rs Git - nothing.git/blob - src/script/parser.h
(#283) Extract parser related stuff to a separate trans unit
[nothing.git] / src / script / parser.h
1 #ifndef PARSER_H_
2 #define PARSER_H_
3
4 #include <stdbool.h>
5 #include "script/expr.h"
6
7 struct ParseResult
8 {
9     bool is_error;
10     union {
11         struct Expr expr;
12         const char *error;
13     };
14 };
15
16 struct ParseResult parse_success(struct Expr expr);
17 struct ParseResult parse_failure(const char *error);
18
19 struct ParseResult create_expr_from_str(const char *str,
20                                         size_t *cursor,
21                                         size_t n);
22
23
24 #endif  // PARSER_H_