aboutsummaryrefslogtreecommitdiff
path: root/include/parser.h
blob: e90871fe6a44794fae322352af2538f4cc8819e9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#ifndef AMALGAM_PARSER_H
#define AMALGAM_PARSER_H

#include "buffer.h"
#include "buffer_view.h"
#include "tokenizer.h"
#include "scoped_allocator.h"

#define PARSER_OK 0
/* General error */
#define PARSER_ERR -1
#define PARSER_UNEXPECTED_TOKEN -2

typedef struct {
    Tokenizer tokenizer;
    ScopedAllocator allocator;
    Buffer ast_objects;
} Parser;

CHECK_RESULT int parser_init(Parser *self);
void parser_deinit(Parser *self);

CHECK_RESULT int parser_parse_buffer(Parser *self, BufferView code_buffer);

#endif