Mercurial > ~dholland > hg > ag > index.cgi
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/agcl/examples/good/ts.h Sat Dec 22 17:52:45 2007 -0500 @@ -0,0 +1,91 @@ +#ifndef TS_H +#define TS_H + +typedef union { + long alignment; + char ag_vt_2[sizeof(int)]; + char ag_vt_4[sizeof(token)]; +} ts_vs_type; + +typedef enum { + ts_simple_token_token = 1, ts_expanded_token_token, + ts_initial_arg_element_token, ts_ws_token, ts_eol_token, + ts_macro_definition_header_token, ts_input_file_token, ts_section_token, + ts_eof_token = 12, ts_newline_token, ts_space_token, + ts_control_line_token = 19, ts_conditional_block_token, + ts_true_if_section_token, ts_endif_line_token, ts_skip_else_section_token, + ts_false_if_section_token, ts_else_section_token, ts_true_condition_token, + ts_true_else_condition_token, ts_false_condition_token, + ts_skip_section_token, ts_false_else_condition_token, + ts_skip_line_token = 35, ts_skip_if_section_token, ts_any_text_token = 41, + ts_skip_else_line_token = 44, ts_not_control_mark_token = 54, + ts_any_text_char_token, ts_name_string_token = 59, ts_if_header_token, + ts_else_if_header_token, ts_include_header_token, + ts_parameter_list_token = 69, ts_names_token = 71, ts_word_token = 73, + ts_separator_token, ts_qualified_real_token, ts_integer_constant_token, + ts_expanded_word_token, ts_variable_token, ts_simple_macro_token, + ts_macro_token, ts_macro_arg_list_token, ts_defined_token, + ts_macro_args_token = 84, ts_increment_ta_token, ts_arg_elements_token, + ts_arg_element_token, ts_string_literal_token, + ts_character_constant_token, ts_operator_token, + ts_nested_elements_token = 92, ts_punctuation_token, ts_blank_token = 95, + ts_comment_token, ts_comment_head_token = 98, + ts_real_constant_token = 114, ts_floating_qualifier_token, ts_real_token, + ts_simple_real_token = 119, ts_exponent_token, ts_confusion_token, + ts_decimal_integer_token, ts_octal_integer_token, + ts_integer_qualifier_token = 128, ts_octal_constant_token = 130, + ts_decimal_constant_token, ts_hex_constant_token, + ts_hex_integer_token = 135, ts_hex_digit_token = 137, + ts_string_chars_token = 139, ts_string_char_token = 141, + ts_simple_chars_token = 143, ts_simple_char_token = 145, ts_letter_token +} ts_token_type; + +typedef struct ts_pcb_struct{ + ts_token_type token_number, reduction_token, error_frame_token; + int input_code; + int input_value; + int line, column; + int ssx, sn, error_frame_ssx; + int drt, dssx, dsn; + int ss[128]; + ts_vs_type vs[128]; + int ag_ap; + const char *error_message; + char read_flag; + char exit_flag; + location input_context; + location cs[128]; + int bts[128], btsx; + int (* const *gt_procs)(void); + int (* const *r_procs)(void); + int (* const *s_procs)(void); + int lab[9], rx, fx; + const unsigned char *key_sp; + int save_index, key_state; + int ag_error_depth, ag_min_depth, ag_tmp_depth; + int ag_rss[2*128], ag_lrss; + char ag_msg[82]; + const int *ag_dtl; + int ag_dsn; + int ag_resynch_active; +} ts_pcb_type; + +#ifndef PRULE_CONTEXT +#define PRULE_CONTEXT(pcb) (&((pcb).cs[(pcb).ssx])) +#define PERROR_CONTEXT(pcb) ((pcb).cs[(pcb).error_frame_ssx]) +#define PCONTEXT(pcb) ((pcb).cs[(pcb).ssx]) +#endif + +#ifndef AG_RUNNING_CODE +/* PCB.exit_flag values */ +#define AG_RUNNING_CODE 0 +#define AG_SUCCESS_CODE 1 +#define AG_SYNTAX_ERROR_CODE 2 +#define AG_REDUCTION_ERROR_CODE 3 +#define AG_STACK_ERROR_CODE 4 +#define AG_SEMANTIC_ERROR_CODE 5 +#endif +void init_ts(void); +void ts(void); +#endif +