-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathparse.h
53 lines (40 loc) · 1.26 KB
/
parse.h
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
46
47
48
49
50
51
52
53
#ifndef PARSE_H
#define PARSE_H
#include "ll.h"
/*
* parse and eval are the two major functions in parse.h
* parse() does not fully parse an expression. since, each
* command accepts different, often unique arguments, the
* unparsed expression are relegated to be parsed by the
* functions that implement these commands
*/
typedef struct parse_t parse_t;
/* parse */
/* parse an expression and return a parse_t object pointer */
parse_t *parse(char *exp);
/*
* Parse the address part of a expression, return the first character at
* the end of an address
*/
char *parse_address(parse_t *pt, char *addr);
int isaddresschar(char *a);
char *skipspaces(char *s);
node_t *pt_from(parse_t *pt);
parse_t *pt_make();
void pt_set(parse_t *pt, node_t *from, node_t *to, char cmd, char *rest);
char pt_command(parse_t *pt);
/*
* Lets functions know that the values of
* parse memebers are default values i.e.
* were not modified by parse functions
*/
extern _Bool parse_defaults;
extern char *gbl_commands;
/* eval */
#define FIRST_ASCII_CHAR '\n'
#define LAST_ASCII_CHAR 'z'
/* Size of fptr_table; accomodates all the characters that could be a command */
#define FPTR_ARRAY_SIZE (LAST_ASCII_CHAR - FIRST_ASCII_CHAR + 1)
void eval(parse_t *pt);
void fptr_init();
#endif