This commit is contained in:
2024-12-22 22:40:01 +02:00
parent db35aa7722
commit a9c4b5c7ab
7 changed files with 253 additions and 205 deletions

View File

@@ -1,11 +1,12 @@
// parser.h
#ifndef _ZIG1_PARSE_H__
#define _ZIG1_PARSE_H__
#include "ast.h"
#include <stdbool.h>
#include <stdint.h>
#include "ast.h"
// Standard slice
typedef struct {
uint32_t len;
uint32_t cap;
@@ -13,8 +14,15 @@ typedef struct {
} ParserNodeIndexSlice;
typedef struct {
uint32_t len;
AstNodeIndex lhs;
AstNodeIndex rhs;
bool trailing;
} Members;
typedef struct Parser {
const char* source;
const uint32_t source_len;
uint32_t source_len;
TokenizerTag* token_tags;
AstIndex* token_starts;
@@ -27,6 +35,8 @@ typedef struct {
ParserNodeIndexSlice scratch;
} Parser;
int parseRoot(Parser*);
Parser* parserInit(const char* source, uint32_t len);
void parserDeinit(Parser* parser);
int parseRoot(Parser* parser);
#endif