aboutsummaryrefslogtreecommitdiffstats
path: root/parser.h
blob: 822adf0e68beea1b3e337f369fad58ee2559ca74 (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
38
#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;
	char **lines;
	uint32_t lnidx;
	uint8_t indent;
} interpreter;

typedef void (*func_t)(interpreter *);

void iinit(interpreter *);

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

int idoline(interpreter *, const char *);

variable *igetarg(interpreter *, uint32_t);
char *igetarg_string(interpreter *, uint32_t);
int igetarg_integer(interpreter *, uint32_t); 
float igetarg_float(interpreter *, uint32_t);

char *iget_string(interpreter *, const char *);
int iget_integer(interpreter *, const char *);
float iget_float(interpreter *, const char *);

#endif // PARSER_H_