// parser.h #ifndef _ZIG0_PARSE_H__ #define _ZIG0_PARSE_H__ #include "ast.h" #include "common.h" #include #include typedef struct { const char* source; uint32_t source_len; TokenizerTag* token_tags; AstIndex* token_starts; uint32_t tokens_len; AstTokenIndex tok_i; AstNodeList nodes; AstNodeIndexSlice extra_data; AstNodeIndexSlice scratch; bool has_warn; bool has_compile_errors; char err_buf[ERR_BUF_SIZE]; } Parser; // warn records a non-fatal parse error (like Zig's Parse.warn). // Parsing continues. static inline void warn(Parser* p) { p->has_warn = true; } Parser* parserInit(const char* source, uint32_t len); void parserDeinit(Parser* parser); void parseRoot(Parser* parser); #endif