Mercurial > ~dholland > hg > ag > index.cgi
comparison tests/agcl/examples/good/ts.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 TS_H | |
2 #define TS_H | |
3 | |
4 typedef union { | |
5 long alignment; | |
6 char ag_vt_2[sizeof(int)]; | |
7 char ag_vt_4[sizeof(token)]; | |
8 } ts_vs_type; | |
9 | |
10 typedef enum { | |
11 ts_simple_token_token = 1, ts_expanded_token_token, | |
12 ts_initial_arg_element_token, ts_ws_token, ts_eol_token, | |
13 ts_macro_definition_header_token, ts_input_file_token, ts_section_token, | |
14 ts_eof_token = 12, ts_newline_token, ts_space_token, | |
15 ts_control_line_token = 19, ts_conditional_block_token, | |
16 ts_true_if_section_token, ts_endif_line_token, ts_skip_else_section_token, | |
17 ts_false_if_section_token, ts_else_section_token, ts_true_condition_token, | |
18 ts_true_else_condition_token, ts_false_condition_token, | |
19 ts_skip_section_token, ts_false_else_condition_token, | |
20 ts_skip_line_token = 35, ts_skip_if_section_token, ts_any_text_token = 41, | |
21 ts_skip_else_line_token = 44, ts_not_control_mark_token = 54, | |
22 ts_any_text_char_token, ts_name_string_token = 59, ts_if_header_token, | |
23 ts_else_if_header_token, ts_include_header_token, | |
24 ts_parameter_list_token = 69, ts_names_token = 71, ts_word_token = 73, | |
25 ts_separator_token, ts_qualified_real_token, ts_integer_constant_token, | |
26 ts_expanded_word_token, ts_variable_token, ts_simple_macro_token, | |
27 ts_macro_token, ts_macro_arg_list_token, ts_defined_token, | |
28 ts_macro_args_token = 84, ts_increment_ta_token, ts_arg_elements_token, | |
29 ts_arg_element_token, ts_string_literal_token, | |
30 ts_character_constant_token, ts_operator_token, | |
31 ts_nested_elements_token = 92, ts_punctuation_token, ts_blank_token = 95, | |
32 ts_comment_token, ts_comment_head_token = 98, | |
33 ts_real_constant_token = 114, ts_floating_qualifier_token, ts_real_token, | |
34 ts_simple_real_token = 119, ts_exponent_token, ts_confusion_token, | |
35 ts_decimal_integer_token, ts_octal_integer_token, | |
36 ts_integer_qualifier_token = 128, ts_octal_constant_token = 130, | |
37 ts_decimal_constant_token, ts_hex_constant_token, | |
38 ts_hex_integer_token = 135, ts_hex_digit_token = 137, | |
39 ts_string_chars_token = 139, ts_string_char_token = 141, | |
40 ts_simple_chars_token = 143, ts_simple_char_token = 145, ts_letter_token | |
41 } ts_token_type; | |
42 | |
43 typedef struct ts_pcb_struct{ | |
44 ts_token_type token_number, reduction_token, error_frame_token; | |
45 int input_code; | |
46 int input_value; | |
47 int line, column; | |
48 int ssx, sn, error_frame_ssx; | |
49 int drt, dssx, dsn; | |
50 int ss[128]; | |
51 ts_vs_type vs[128]; | |
52 int ag_ap; | |
53 const char *error_message; | |
54 char read_flag; | |
55 char exit_flag; | |
56 location input_context; | |
57 location cs[128]; | |
58 int bts[128], btsx; | |
59 int (* const *gt_procs)(void); | |
60 int (* const *r_procs)(void); | |
61 int (* const *s_procs)(void); | |
62 int lab[9], rx, fx; | |
63 const unsigned char *key_sp; | |
64 int save_index, key_state; | |
65 int ag_error_depth, ag_min_depth, ag_tmp_depth; | |
66 int ag_rss[2*128], ag_lrss; | |
67 char ag_msg[82]; | |
68 const int *ag_dtl; | |
69 int ag_dsn; | |
70 int ag_resynch_active; | |
71 } ts_pcb_type; | |
72 | |
73 #ifndef PRULE_CONTEXT | |
74 #define PRULE_CONTEXT(pcb) (&((pcb).cs[(pcb).ssx])) | |
75 #define PERROR_CONTEXT(pcb) ((pcb).cs[(pcb).error_frame_ssx]) | |
76 #define PCONTEXT(pcb) ((pcb).cs[(pcb).ssx]) | |
77 #endif | |
78 | |
79 #ifndef AG_RUNNING_CODE | |
80 /* PCB.exit_flag values */ | |
81 #define AG_RUNNING_CODE 0 | |
82 #define AG_SUCCESS_CODE 1 | |
83 #define AG_SYNTAX_ERROR_CODE 2 | |
84 #define AG_REDUCTION_ERROR_CODE 3 | |
85 #define AG_STACK_ERROR_CODE 4 | |
86 #define AG_SEMANTIC_ERROR_CODE 5 | |
87 #endif | |
88 void init_ts(void); | |
89 void ts(void); | |
90 #endif | |
91 |