aboutsummaryrefslogtreecommitdiffstats
path: root/parser.h
blob: 24c2c89fdfc3d7077b9ea69bf7ce47363b742862 (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
30
31
32
33
34
35
36
37
#ifndef PARSER_H_
#define PARSER_H_

#include <variable.h>

typedef variable *stack_t;

typedef struct {
	variable *vars;
	char **vnames;
	stack_t *stack;
	uint32_t stidx;
	variable ***lines;
	uint32_t lnidx;
	int8_t indent;
	uint8_t sindent;
	variable *ret;
} interpreter;

#define SKIP (1 << 7)

typedef int (*func_t)(interpreter *);

void iinit(interpreter *);
void iend(interpreter *it);

void iskip(interpreter *it);

variable *inew_string(interpreter *, const char *, char *);
variable *inew_integer(interpreter *, const char *, int32_t);
variable *inew_float(interpreter *, const char *, float);
void inew_cfunc(interpreter *, const char *, func_t);

int idoline(interpreter *, const char *);
variable *idoexpr(interpreter *interp, const char *line);

#endif // PARSER_H_