summaryrefslogtreecommitdiff
path: root/prv.h
blob: 2f59ec442486042b997481bcefa64d2a707230ea (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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#ifndef PRV_H
#define PRV_H

#include "lex.h"
#include <stddef.h>

struct step
{
    enum tktype type;
    const char *id;
    int chain;
};

struct pos
{
    const struct seq *seq, *stseq;
    const struct step *step;
};

struct prv
{
    const struct tk *tk, *stk;
    struct storage *st;
    struct tdlevel *levels;
    struct pos *pos;
    struct ast *ast;
    struct type *nest;
    size_t n, i, block;
};

struct seq
{
    const struct step *steps;
    int (*fn)(const struct lex *l, struct prv *p);
    int (*end)(const struct lex *l, struct prv *p);
    const char *chain;
};

int kw(const char *s);
int prev(const struct prv *p);
int push(const struct pos *pos, struct prv *p);
int pop(const struct lex *l, struct prv *p);
char *sdup(const char *s);

#endif