Mercurial > ~dholland > hg > ag > index.cgi
comparison tests/agcl/contrib/good/parse.h @ 0:13d2b8934445
Import AnaGram (near-)release tree into Mercurial.
author | David A. Holland |
---|---|
date | Sat, 22 Dec 2007 17:52:45 -0500 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:13d2b8934445 |
---|---|
1 #ifndef PARSE_H | |
2 #define PARSE_H | |
3 | |
4 typedef union { | |
5 long alignment; | |
6 char ag_vt_2[sizeof(int)]; | |
7 char ag_vt_4[sizeof(struct LocaleNode *)]; | |
8 char ag_vt_5[sizeof(unsigned)]; | |
9 char ag_vt_6[sizeof(Object *)]; | |
10 char ag_vt_7[sizeof(struct String *)]; | |
11 } parse_vs_type; | |
12 | |
13 typedef enum { | |
14 parse_WhiteSpace_token = 1, parse_StringBody_token = 3, | |
15 parse_LineParse_token, parse_Terminated_Line_token, parse_Line_token = 8, | |
16 parse_VariableList_token = 12, parse_Group_token = 14, | |
17 parse_VariableDecl_token = 17, parse_Comparison_token = 19, | |
18 parse_Comparisons_token, parse_VariableListWork_token = 22, | |
19 parse_VariListMemb_token, parse_VariNum_token = 27, | |
20 parse_Assignment_token, parse_Expression_token = 32, | |
21 parse_FunctionCall_token, parse_ArgumentList_token, parse_Product_token, | |
22 parse_PowerFactor_token = 38, parse_Factor_token = 40, | |
23 parse_ALNUM_token = 43, parse_WS_token, parse_WSDISREGARD_token, | |
24 parse_ANYTHING_token = 47, parse_VariNumStr_token = 58 | |
25 } parse_token_type; | |
26 | |
27 typedef struct parse_pcb_struct{ | |
28 parse_token_type token_number, reduction_token, error_frame_token; | |
29 int input_code; | |
30 int input_value; | |
31 int line, column; | |
32 int ssx, sn, error_frame_ssx; | |
33 int drt, dssx, dsn; | |
34 int ss[1000]; | |
35 parse_vs_type vs[1000]; | |
36 int ag_ap; | |
37 const char *error_message; | |
38 char read_flag; | |
39 char exit_flag; | |
40 int bts[1000], btsx; | |
41 int lab[7], rx, fx; | |
42 const unsigned char *key_sp; | |
43 int save_index, key_state; | |
44 char ag_msg[82]; | |
45 } parse_pcb_type; | |
46 | |
47 #ifndef PRULE_CONTEXT | |
48 #define PRULE_CONTEXT(pcb) (&((pcb).cs[(pcb).ssx])) | |
49 #define PERROR_CONTEXT(pcb) ((pcb).cs[(pcb).error_frame_ssx]) | |
50 #define PCONTEXT(pcb) ((pcb).cs[(pcb).ssx]) | |
51 #endif | |
52 | |
53 #ifndef AG_RUNNING_CODE | |
54 /* PCB.exit_flag values */ | |
55 #define AG_RUNNING_CODE 0 | |
56 #define AG_SUCCESS_CODE 1 | |
57 #define AG_SYNTAX_ERROR_CODE 2 | |
58 #define AG_REDUCTION_ERROR_CODE 3 | |
59 #define AG_STACK_ERROR_CODE 4 | |
60 #define AG_SEMANTIC_ERROR_CODE 5 | |
61 #endif | |
62 | |
63 extern parse_pcb_type parse_pcb; | |
64 void init_parse(void); | |
65 void parse(void); | |
66 #endif | |
67 |