summaryrefslogtreecommitdiffstats
path: root/src/parse.hpp
blob: 86aa095a0a53cdd7065cb0889363ccb7dfafc108 (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
26
27
28
29
#pragma once


#include "grammar.hpp"

enum parse_token_t {
	TOK_BLOCK = 256,
	TOK_CHAR = 257,
	TOK_EXTRA_ARG = 258,
	TOK_HEADER = 259,
	TOK_SOURCE = 260,
	TOK_STRING = 261,
	TOK_SYMBOL = 262,
	TOK_SYMBOL_LC = 263,
	TOK_SYMBOL_UC = 264,
	TOK_TYPE = 265,
};

typedef struct parse_token_value {
	char c;
	std::string * str;
} parse_token_value_t;

typedef struct parse_context parse_context_t;

parse_context_t * parse_alloc(void *(*alloc_func)(size_t));
void parse_free(parse_context_t *parser, void (*free_func)(void *));

int parse_push(parse_context_t *parser, int token, const parse_token_value_t *value, __attribute__((unused)) solar::grammar_t * grammar);