aboutsummaryrefslogtreecommitdiff
path: root/tools/re2c/parse.h
blob: 92077cacd0403e46ff8e858d044f0b5789eb5d61 (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
#ifndef re2c_parse_h
#define re2c_parse_h

#include <stdio.h>
#include "tools/re2c/scanner.h"
#include "tools/re2c/re.h"

typedef struct Symbol {
    struct Symbol		*next;
    Str			name;
    RegExp		*re;
} Symbol;

void Symbol_init(Symbol *, const SubStr*);
static Symbol *Symbol_new(const SubStr*);
Symbol *Symbol_find(const SubStr*);

void line_source(FILE *, unsigned int);
void parse(FILE *, FILE *);

static Symbol *
Symbol_new(const SubStr *str)
{
    Symbol *r = malloc(sizeof(Symbol));
    Symbol_init(r, str);
    return r;
}

#endif