Mercurial > ~dholland > hg > ag > index.cgi
comparison tests/agcl/oldagsrc/good/y2ag.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 Y2AG_H | |
2 #define Y2AG_H | |
3 | |
4 typedef enum { | |
5 y2ag_name_token = 1, y2ag_grammar_token, y2ag_elc_token, | |
6 y2ag_definition_block_token = 5, y2ag_mark_token, y2ag_c_code_block_token, | |
7 y2ag_rule_section_token = 9, y2ag_tail_token, y2ag_eof_token, | |
8 y2ag_definitions_token = 13, y2ag_white_token, y2ag_comment_token = 16, | |
9 y2ag_comment_text_token, y2ag_anything_token = 20, y2ag_blc_token = 24, | |
10 y2ag_clc_token, y2ag_definition_token, y2ag_start_token, | |
11 y2ag_identifier_token, y2ag_union_token, y2ag_union_text_token, | |
12 y2ag_token_token, y2ag_print_token_list_token, y2ag_left_token, | |
13 y2ag_print_prec_list_token, y2ag_right_token = 36, y2ag_nonassoc_token, | |
14 y2ag_type_token, y2ag_type_name_token, y2ag_expect_statement_token, | |
15 y2ag_decl_token = 42, y2ag_decl_name_token = 44, y2ag_decl_white_token, | |
16 y2ag_decl_star_token, y2ag_decl_term_token, y2ag_number_token = 59, | |
17 y2ag_tag_token = 80, y2ag_c_text_token = 84, y2ag_action_token = 86, | |
18 y2ag_embedded_c_token, y2ag_c_char_token = 89, y2ag_simple_c_char_token, | |
19 y2ag_c_code_comment_token = 92, y2ag_nested_c_text_token, | |
20 y2ag_c_literal_character_token = 95, y2ag_literal_string_token, | |
21 y2ag_c_code_comment_text_token = 98, y2ag_digit_token, | |
22 y2ag_octal_digits_token = 102, y2ag_string_character_token = 104, | |
23 y2ag_production_token = 107, y2ag_production_head_token = 111, | |
24 y2ag_complete_rules_token, y2ag_complete_rule_token = 114, | |
25 y2ag_rule_set_continuation_token, y2ag_rule_token = 117, | |
26 y2ag_explicit_precedence_token, y2ag_rule_name_continuation_token = 120, | |
27 y2ag_rule_literal_continuation_token, y2ag_literal_token, | |
28 y2ag_explicit_precedence_head_token, y2ag_prec_token, | |
29 y2ag_literal_character_token = 128, y2ag_octal_number_token = 135, | |
30 y2ag_dot_token = 138, y2ag_tail_code_token | |
31 } y2ag_token_type; | |
32 | |
33 typedef struct y2ag_pcb_struct{ | |
34 y2ag_token_type token_number, reduction_token, error_frame_token; | |
35 int input_code; | |
36 int input_value; | |
37 int line, column; | |
38 int ssx, sn, error_frame_ssx; | |
39 int drt, dssx, dsn; | |
40 int ss[128]; | |
41 int vs[128]; | |
42 int ag_ap; | |
43 const char *error_message; | |
44 char read_flag; | |
45 char exit_flag; | |
46 int bts[128], btsx; | |
47 int lab[10], rx, fx; | |
48 const unsigned char *key_sp; | |
49 int save_index, key_state; | |
50 char ag_msg[82]; | |
51 } y2ag_pcb_type; | |
52 | |
53 #ifndef PRULE_CONTEXT | |
54 #define PRULE_CONTEXT(pcb) (&((pcb).cs[(pcb).ssx])) | |
55 #define PERROR_CONTEXT(pcb) ((pcb).cs[(pcb).error_frame_ssx]) | |
56 #define PCONTEXT(pcb) ((pcb).cs[(pcb).ssx]) | |
57 #endif | |
58 | |
59 #ifndef AG_RUNNING_CODE | |
60 /* PCB.exit_flag values */ | |
61 #define AG_RUNNING_CODE 0 | |
62 #define AG_SUCCESS_CODE 1 | |
63 #define AG_SYNTAX_ERROR_CODE 2 | |
64 #define AG_REDUCTION_ERROR_CODE 3 | |
65 #define AG_STACK_ERROR_CODE 4 | |
66 #define AG_SEMANTIC_ERROR_CODE 5 | |
67 #endif | |
68 | |
69 extern y2ag_pcb_type y2ag_pcb; | |
70 void init_y2ag(void); | |
71 void y2ag(void); | |
72 #endif | |
73 |