-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreader.h
More file actions
39 lines (30 loc) · 689 Bytes
/
Copy pathreader.h
File metadata and controls
39 lines (30 loc) · 689 Bytes
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 __READER_H_
#define __READER_H_
#include "value.h"
#include "vm.h"
#include "assert.h"
#include <ctype.h>
typedef struct stream_s {
char const * code;
unsigned long index;
unsigned long length;
char pop(bool p_is_string) {
assert(index < length);
if (p_is_string == false) {
return toupper(code[index++]);
} else {
return code[index++];
}
}
char pop() {
return pop(false);
}
void restore() {
index--;
}
} stream_t;
stream_t *stream_create(char const *code);
void stream_destroy(stream_t *);
int reader(vm_t *p_vm, stream_t *p_stream, bool p_in_list);
value_t *read(vm_t *p_vm);
#endif /* __READER_H_ */