aboutsummaryrefslogtreecommitdiff
path: root/src/parse.h
blob: 52d3aa9e1d5eaf84e980ae83c7c69537989f9c9b (plain) (blame)
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
#ifndef SKHD_PARSE_H
#define SKHD_PARSE_H

#include "tokenize.h"
#include <stdbool.h>

struct parser
{
    struct token previous_token;
    struct token current_token;
    struct tokenizer tokenizer;
    bool error;
};

struct table;
void parse_config(struct parser *parser, struct table *hotkey_map);

struct token parser_peek(struct parser *parser);
struct token parser_previous(struct parser *parser);
bool parser_eof(struct parser *parser);
struct token parser_advance(struct parser *parser);
bool parser_check(struct parser *parser, enum token_type type);
bool parser_match(struct parser *parser, enum token_type type);
bool parser_init(struct parser *parser, char *file);
void parser_destroy(struct parser *parser);

#endif