Mercurial > ~dholland > hg > ag > index.cgi
comparison tests/agcl/bugs/good/manykw.c @ 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 | |
2 /* | |
3 * AnaGram, A System for Syntax Directed Programming | |
4 * File generated by: ... | |
5 * | |
6 * AnaGram Parsing Engine | |
7 * Copyright 1993-2002 Parsifal Software. All Rights Reserved. | |
8 * | |
9 * This software is provided 'as-is', without any express or implied | |
10 * warranty. In no event will the authors be held liable for any damages | |
11 * arising from the use of this software. | |
12 * | |
13 * Permission is granted to anyone to use this software for any purpose, | |
14 * including commercial applications, and to alter it and redistribute it | |
15 * freely, subject to the following restrictions: | |
16 * | |
17 * 1. The origin of this software must not be misrepresented; you must not | |
18 * claim that you wrote the original software. If you use this software | |
19 * in a product, an acknowledgment in the product documentation would be | |
20 * appreciated but is not required. | |
21 * 2. Altered source versions must be plainly marked as such, and must not be | |
22 * misrepresented as being the original software. | |
23 * 3. This notice may not be removed or altered from any source distribution. | |
24 */ | |
25 | |
26 #ifndef MANYKW_H | |
27 #include "manykw.h" | |
28 #endif | |
29 | |
30 #ifndef MANYKW_H | |
31 #error Mismatched header file | |
32 #endif | |
33 | |
34 #include <ctype.h> | |
35 #include <stdio.h> | |
36 | |
37 #define RULE_CONTEXT (&((PCB).cs[(PCB).ssx])) | |
38 #define ERROR_CONTEXT ((PCB).cs[(PCB).error_frame_ssx]) | |
39 #define CONTEXT ((PCB).cs[(PCB).ssx]) | |
40 | |
41 | |
42 | |
43 manykw_pcb_type manykw_pcb; | |
44 #define PCB manykw_pcb | |
45 | |
46 #ifndef CONVERT_CASE | |
47 #define CONVERT_CASE(c) (c) | |
48 #endif | |
49 #ifndef TAB_SPACING | |
50 #define TAB_SPACING 8 | |
51 #endif | |
52 | |
53 | |
54 #define READ_COUNTS | |
55 #define WRITE_COUNTS | |
56 #undef V | |
57 #define V(i,t) (*t (&(PCB).vs[(PCB).ssx + i])) | |
58 #undef VS | |
59 #define VS(i) (PCB).vs[(PCB).ssx + i] | |
60 | |
61 #ifndef GET_CONTEXT | |
62 #define GET_CONTEXT CONTEXT = (PCB).input_context | |
63 #endif | |
64 | |
65 typedef enum { | |
66 ag_action_1, | |
67 ag_action_2, | |
68 ag_action_3, | |
69 ag_action_4, | |
70 ag_action_5, | |
71 ag_action_6, | |
72 ag_action_7, | |
73 ag_action_8, | |
74 ag_action_9, | |
75 ag_action_10, | |
76 ag_action_11, | |
77 ag_action_12 | |
78 } ag_parser_action; | |
79 | |
80 | |
81 #ifndef NULL_VALUE_INITIALIZER | |
82 #define NULL_VALUE_INITIALIZER = 0 | |
83 #endif | |
84 | |
85 static int const ag_null_value NULL_VALUE_INITIALIZER; | |
86 | |
87 static const unsigned char ag_rpx[] = { | |
88 0 | |
89 }; | |
90 | |
91 static const unsigned char ag_key_itt[] = { | |
92 0 | |
93 }; | |
94 | |
95 static const unsigned short ag_key_pt[] = { | |
96 0 | |
97 }; | |
98 | |
99 static const unsigned char ag_key_ch[] = { | |
100 0, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99,100,101,102,255, | |
101 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99,100,101,102,255, 48, | |
102 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99,100,101,102,255, 48, 49, | |
103 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99,100,101,102,255, 48, 49, 50, | |
104 51, 52, 53, 54, 55, 56, 57, 97, 98, 99,100,101,102,255, 48, 49, 50, 51, | |
105 52, 53, 54, 55, 56, 57, 97, 98, 99,100,101,102,255, 48, 49, 50, 51, 52, | |
106 53, 54, 55, 56, 57, 97, 98, 99,100,101,102,255, 48, 49, 50, 51, 52, 53, | |
107 54, 55, 56, 57, 97, 98, 99,100,101,102,255, 48, 49, 50, 51, 52, 53, 54, | |
108 55, 56, 57, 97, 98, 99,100,101,102,255, 48, 49, 50, 51, 52, 53, 54, 55, | |
109 56, 57, 97, 98, 99,100,101,102,255, 48, 49, 50, 51, 52, 53, 54, 55, 56, | |
110 57, 97, 98, 99,100,101,102,255, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, | |
111 97, 98, 99,100,101,102,255, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, | |
112 98, 99,100,101,102,255, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, | |
113 99,100,101,102,255, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, | |
114 100,101,102,255, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99,100, | |
115 101,102,255, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99,100,101, | |
116 102,255, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99,100,101,102, | |
117 255, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99,100,101,102,255, | |
118 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99,100,101,102,255, 48, | |
119 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99,100,101,102,255, 48, 49, | |
120 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99,100,101,102,255, 48, 49, 50, | |
121 51, 52, 53, 54, 55, 56, 57, 97, 98, 99,100,101,102,255, 48, 49, 50, 51, | |
122 52, 53, 54, 55, 56, 57, 97, 98, 99,100,101,102,255, 48, 49, 50, 51, 52, | |
123 53, 54, 55, 56, 57, 97, 98, 99,100,101,102,255,100,255,114,255,111,255, | |
124 119,255, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99,100,101,102, | |
125 255, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99,100,101,102,255, | |
126 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99,100,101,102,255, 48, | |
127 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99,100,101,102,255, 48, 49, | |
128 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99,100,101,102,255, 48, 49, 50, | |
129 51, 52, 53, 54, 55, 56, 57, 97, 98, 99,100,101,102,255, 48, 49, 50, 51, | |
130 52, 53, 54, 55, 56, 57, 97, 98, 99,100,101,102,255, 48, 49, 50, 51, 52, | |
131 53, 54, 55, 56, 57, 97, 98, 99,100,101,102,255, 48, 49, 50, 51, 52, 53, | |
132 54, 55,255, 49,255,100,255,114,255,111,255,119,255, 48, 49, 50, 51, 52, | |
133 53, 54, 55, 56, 57, 97, 98, 99,100,101,102,255, 48, 49, 50, 51, 52, 53, | |
134 54, 55, 56, 57, 97, 98, 99,100,101,102,255, 48, 49, 50, 51, 52, 53, 54, | |
135 55, 56, 57, 97, 98, 99,100,101,102,255, 48, 49, 50, 51, 52, 53, 54, 55, | |
136 56, 57, 97, 98, 99,100,101,102,255, 48, 49, 50, 51, 52, 53, 54, 55, 56, | |
137 57, 97, 98, 99,100,101,102,255, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, | |
138 97, 98, 99,100,101,102,255, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, | |
139 98, 99,100,101,102,255, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, | |
140 99,100,101,102,255, 48, 49, 50, 51, 52, 53, 54, 55,255, 48, 49, 50, 51, | |
141 52, 53, 54, 55, 56, 57, 97, 98, 99,100,101,102,255, 48, 49, 50, 51, 52, | |
142 53, 54, 55, 56, 57, 97, 98, 99,100,101,102,255, 48, 49, 50, 51, 52, 53, | |
143 54, 55, 56, 57, 97, 98, 99,100,101,102,255, 48, 49, 50, 51, 52, 53, 54, | |
144 55, 56, 57, 97, 98, 99,100,101,102,255, 48, 49, 50, 51, 52, 53, 54, 55, | |
145 56, 57, 97, 98, 99,100,101,102,255, 48, 49, 50, 51, 52, 53, 54, 55, 56, | |
146 57, 97, 98, 99,100,101,102,255, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, | |
147 97, 98, 99,100,101,102,255, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, | |
148 98, 99,100,101,102,255, 49, 56, 57, 97, 98, 99,100,101,102,255,100,255, | |
149 114,255,111,255,119,255 | |
150 }; | |
151 | |
152 static const unsigned char ag_key_act[] = { | |
153 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4, | |
154 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0, | |
155 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0, | |
156 0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0, | |
157 0,0,0,0,0,0,0,0,0,0,0,0,0,4,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,4,0,0,0,0, | |
158 0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0, | |
159 0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0, | |
160 0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0, | |
161 0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0, | |
162 0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0, | |
163 0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,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0,0,0,0,0,0,0,4,2,2,2,2,2, | |
178 2,2,2,2,4,2,4,2,4,2,4,2,4 | |
179 }; | |
180 | |
181 static const unsigned short ag_key_parm[] = { | |
182 0, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 0, | |
183 262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277, 0,278, | |
184 279,280,281,282,283,284,285,286,287,288,289,290,291,292,293, 0,294,295, | |
185 296,297,298,299,300,301,302,303,304,305,306,307,308,309, 0,310,311,312, | |
186 313,314,315,316,317,318,319,320,321,322,323,324,325, 0,326,327,328,329, | |
187 330,331,332,333,334,335,336,337,338,339,340,341, 0,342,343,344,345,346, | |
188 347,348,349,350,351,352,353,354,355,356,357, 0,358,359,360,361,362,363, | |
189 364,365,366,367,368,369,370,371,372,373, 0,374,375,376,377,378,379,380, | |
190 381,382,383,384,385,386,387,388,389, 0, 22, 23, 24, 25, 26, 27, 28, 29, | |
191 30, 31, 32, 33, 34, 35, 36, 37, 0, 38, 39, 40, 41, 42, 43, 44, 45, 46, | |
192 47, 48, 49, 50, 51, 52, 53, 0, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, | |
193 64, 65, 66, 67, 68, 69, 0, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, | |
194 81, 82, 83, 84, 85, 0, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, | |
195 98, 99,100,101, 0,102,103,104,105,106,107,108,109,110,111,112,113,114, | |
196 115,116,117, 0,118,119,120,121,122,123,124,125,126,127,128,129,130,131, | |
197 132,133, 0,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148, | |
198 149, 0,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165, | |
199 0,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181, 0, | |
200 182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197, 0,198, | |
201 199,200,201,202,203,204,205,206,207,208,209,210,211,212,213, 0,214,215, | |
202 216,217,218,219,220,221,222,223,224,225,226,227,228,229, 0,230,231,232, | |
203 233,234,235,236,237,238,239,240,241,242,243,244,245, 0,246,247,248,249, | |
204 250,251,252,253,254,255,256,257,258,259,260,261, 0, 0, 0, 0, 0, 0, | |
205 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
206 0, 0,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277, | |
207 0,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293, 0, | |
208 294,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309, 0,310, | |
209 311,312,313,314,315,316,317,318,319,320,321,322,323,324,325, 0,326,327, | |
210 328,329,330,331,332,333,334,335,336,337,338,339,340,341, 0,342,343,344, | |
211 345,346,347,348,349,350,351,352,353,354,355,356,357, 0,358,359,360,361, | |
212 362,363,364,365,366,367,368,369,370,371,372,373, 0,374,375,376,377,378, | |
213 379,380,381,382,383,384,385,386,387,388,389, 0, 0, 0, 0, 0, 0, 0, | |
214 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,262,263,264,265,266, | |
215 267,268,269,270,271,272,273,274,275,276,277, 0,278,279,280,281,282,283, | |
216 284,285,286,287,288,289,290,291,292,293, 0,294,295,296,297,298,299,300, | |
217 301,302,303,304,305,306,307,308,309, 0,310,311,312,313,314,315,316,317, | |
218 318,319,320,321,322,323,324,325, 0,326,327,328,329,330,331,332,333,334, | |
219 335,336,337,338,339,340,341, 0,342,343,344,345,346,347,348,349,350,351, | |
220 352,353,354,355,356,357, 0,358,359,360,361,362,363,364,365,366,367,368, | |
221 369,370,371,372,373, 0,374,375,376,377,378,379,380,381,382,383,384,385, | |
222 386,387,388,389, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,134,135,136,137, | |
223 138,139,140,141,142,143,144,145,146,147,148,149, 0,150,151,152,153,154, | |
224 155,156,157,158,159,160,161,162,163,164,165, 0,166,167,168,169,170,171, | |
225 172,173,174,175,176,177,178,179,180,181, 0,182,183,184,185,186,187,188, | |
226 189,190,191,192,193,194,195,196,197, 0,198,199,200,201,202,203,204,205, | |
227 206,207,208,209,210,211,212,213, 0,214,215,216,217,218,219,220,221,222, | |
228 223,224,225,226,227,228,229, 0,230,231,232,233,234,235,236,237,238,239, | |
229 240,241,242,243,244,245, 0,246,247,248,249,250,251,252,253,254,255,256, | |
230 257,258,259,260,261, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
231 0, 0, 0, 0, 0, 0 | |
232 }; | |
233 | |
234 static const unsigned short ag_key_jmp[] = { | |
235 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
236 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
237 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
238 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
239 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
240 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
241 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
242 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
243 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 35, 52, 69, 86,103,120,137, | |
244 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
245 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
246 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
247 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
248 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
249 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
250 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
251 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
252 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
253 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
254 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
255 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
256 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
257 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,154,171,188,205, | |
258 222,239,256,273,290,307,324,341,358,375,392, 0,409, 0,426, 0,428, 0, | |
259 430, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
260 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
261 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
262 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
263 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
264 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
265 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
266 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,434,451,468,485,502,519, | |
267 536,553, 0,570, 0,579, 0,581, 0,583, 0,585, 0, 0, 0, 0, 0, 0, | |
268 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
269 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
270 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
271 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
272 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
273 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
274 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
275 0, 0, 0, 0, 0,589,606,623,640,657,674,691,708, 0, 0, 0, 0, 0, | |
276 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
277 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
278 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
279 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
280 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
281 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
282 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
283 0, 0, 0, 0, 0, 0,725,734,751,768,785,802,819,836,853, 0,870, 0, | |
284 880, 0,882, 0,884, 0 | |
285 }; | |
286 | |
287 static const unsigned short ag_key_index[] = { | |
288 432, 0,587,886, 0, 0, 0 | |
289 }; | |
290 | |
291 static const unsigned char ag_key_ends[] = { | |
292 0 | |
293 }; | |
294 #define AG_TCV(x) (((int)(x) >= 0 && (int)(x) <= 255) ? ag_tcv[(x)] : 0) | |
295 | |
296 static const unsigned short ag_tcv[] = { | |
297 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, | |
298 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
299 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
300 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
301 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
302 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
303 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
304 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
305 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
306 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
307 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
308 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
309 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
310 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
311 0, 0, 0, 0 | |
312 }; | |
313 | |
314 #ifndef SYNTAX_ERROR | |
315 #define SYNTAX_ERROR fprintf(stderr,"%s, line %d, column %d\n", \ | |
316 (PCB).error_message, (PCB).line, (PCB).column) | |
317 #endif | |
318 | |
319 #ifndef FIRST_LINE | |
320 #define FIRST_LINE 1 | |
321 #endif | |
322 | |
323 #ifndef FIRST_COLUMN | |
324 #define FIRST_COLUMN 1 | |
325 #endif | |
326 | |
327 #ifndef PARSER_STACK_OVERFLOW | |
328 #define PARSER_STACK_OVERFLOW {fprintf(stderr, \ | |
329 "\nParser stack overflow, line %d, column %d\n",\ | |
330 (PCB).line, (PCB).column);} | |
331 #endif | |
332 | |
333 #ifndef REDUCTION_TOKEN_ERROR | |
334 #define REDUCTION_TOKEN_ERROR {fprintf(stderr, \ | |
335 "\nReduction token error, line %d, column %d\n", \ | |
336 (PCB).line, (PCB).column);} | |
337 #endif | |
338 | |
339 | |
340 typedef enum | |
341 {ag_accept_key, ag_set_key, ag_jmp_key, ag_end_key, ag_no_match_key, | |
342 ag_cf_accept_key, ag_cf_set_key, ag_cf_end_key} key_words; | |
343 | |
344 #ifndef GET_INPUT | |
345 #define GET_INPUT ((PCB).input_code = getchar()) | |
346 #endif | |
347 | |
348 | |
349 static int ag_look_ahead(void) { | |
350 if ((PCB).rx < (PCB).fx) { | |
351 return CONVERT_CASE((PCB).lab[(PCB).rx++]); | |
352 } | |
353 GET_INPUT; | |
354 (PCB).fx++; | |
355 return CONVERT_CASE((PCB).lab[(PCB).rx++] = (PCB).input_code); | |
356 } | |
357 | |
358 static void ag_get_key_word(int ag_k) { | |
359 int save_index = (PCB).rx; | |
360 const unsigned char *sp; | |
361 int ag_ch; | |
362 while (1) { | |
363 switch (ag_key_act[ag_k]) { | |
364 case ag_cf_end_key: | |
365 sp = ag_key_ends + ag_key_jmp[ag_k]; | |
366 do { | |
367 if ((ag_ch = *sp++) == 0) { | |
368 int ag_k1 = ag_key_parm[ag_k]; | |
369 int ag_k2 = ag_key_pt[ag_k1]; | |
370 if (ag_key_itt[ag_k2 + ag_look_ahead()]) goto ag_fail; | |
371 (PCB).rx--; | |
372 (PCB).token_number = (manykw_token_type) ag_key_pt[ag_k1 + 1]; | |
373 return; | |
374 } | |
375 } while (ag_look_ahead() == ag_ch); | |
376 goto ag_fail; | |
377 case ag_end_key: | |
378 sp = ag_key_ends + ag_key_jmp[ag_k]; | |
379 do { | |
380 if ((ag_ch = *sp++) == 0) { | |
381 (PCB).token_number = (manykw_token_type) ag_key_parm[ag_k]; | |
382 return; | |
383 } | |
384 } while (ag_look_ahead() == ag_ch); | |
385 case ag_no_match_key: | |
386 ag_fail: | |
387 (PCB).rx = save_index; | |
388 return; | |
389 case ag_cf_set_key: { | |
390 int ag_k1 = ag_key_parm[ag_k]; | |
391 int ag_k2 = ag_key_pt[ag_k1]; | |
392 ag_k = ag_key_jmp[ag_k]; | |
393 if (ag_key_itt[ag_k2 + (ag_ch = ag_look_ahead())]) break; | |
394 save_index = --(PCB).rx; | |
395 (PCB).token_number = (manykw_token_type) ag_key_pt[ag_k1+1]; | |
396 break; | |
397 } | |
398 case ag_set_key: | |
399 save_index = (PCB).rx; | |
400 (PCB).token_number = (manykw_token_type) ag_key_parm[ag_k]; | |
401 case ag_jmp_key: | |
402 ag_k = ag_key_jmp[ag_k]; | |
403 ag_ch = ag_look_ahead(); | |
404 break; | |
405 case ag_accept_key: | |
406 (PCB).token_number = (manykw_token_type) ag_key_parm[ag_k]; | |
407 return; | |
408 case ag_cf_accept_key: { | |
409 int ag_k1 = ag_key_parm[ag_k]; | |
410 int ag_k2 = ag_key_pt[ag_k1]; | |
411 if (ag_key_itt[ag_k2 + ag_look_ahead()]) (PCB).rx = save_index; | |
412 else { | |
413 (PCB).rx--; | |
414 (PCB).token_number = (manykw_token_type) ag_key_pt[ag_k1+1]; | |
415 } | |
416 return; | |
417 } | |
418 default: | |
419 /* not reachable; here to suppress compiler warnings */ | |
420 goto ag_fail; | |
421 } | |
422 if (ag_ch <= 255) while (ag_key_ch[ag_k] < ag_ch) ag_k++; | |
423 if (ag_ch > 255 || ag_key_ch[ag_k] != ag_ch) { | |
424 (PCB).rx = save_index; | |
425 return; | |
426 } | |
427 } | |
428 } | |
429 | |
430 | |
431 #ifndef AG_NEWLINE | |
432 #define AG_NEWLINE 10 | |
433 #endif | |
434 | |
435 #ifndef AG_RETURN | |
436 #define AG_RETURN 13 | |
437 #endif | |
438 | |
439 #ifndef AG_FORMFEED | |
440 #define AG_FORMFEED 12 | |
441 #endif | |
442 | |
443 #ifndef AG_TABCHAR | |
444 #define AG_TABCHAR 9 | |
445 #endif | |
446 | |
447 static void ag_track(void) { | |
448 int ag_k = 0; | |
449 while (ag_k < (PCB).rx) { | |
450 int ag_ch = (PCB).lab[ag_k++]; | |
451 switch (ag_ch) { | |
452 case AG_NEWLINE: | |
453 (PCB).column = 1, (PCB).line++; | |
454 case AG_RETURN: | |
455 case AG_FORMFEED: | |
456 break; | |
457 case AG_TABCHAR: | |
458 (PCB).column += (TAB_SPACING) - ((PCB).column - 1) % (TAB_SPACING); | |
459 break; | |
460 default: | |
461 (PCB).column++; | |
462 } | |
463 } | |
464 ag_k = 0; | |
465 while ((PCB).rx < (PCB).fx) (PCB).lab[ag_k++] = (PCB).lab[(PCB).rx++]; | |
466 (PCB).fx = ag_k; | |
467 (PCB).rx = 0; | |
468 } | |
469 | |
470 | |
471 static void ag_prot(void) { | |
472 int ag_k; | |
473 ag_k = 128 - ++(PCB).btsx; | |
474 if (ag_k <= (PCB).ssx) { | |
475 (PCB).exit_flag = AG_STACK_ERROR_CODE; | |
476 PARSER_STACK_OVERFLOW; | |
477 return; | |
478 } | |
479 (PCB).bts[(PCB).btsx] = (PCB).sn; | |
480 (PCB).bts[ag_k] = (PCB).ssx; | |
481 (PCB).vs[ag_k] = (PCB).vs[(PCB).ssx]; | |
482 (PCB).ss[ag_k] = (PCB).ss[(PCB).ssx]; | |
483 } | |
484 | |
485 static void ag_undo(void) { | |
486 if ((PCB).drt == -1) return; | |
487 while ((PCB).btsx) { | |
488 int ag_k = 128 - (PCB).btsx; | |
489 (PCB).sn = (PCB).bts[(PCB).btsx--]; | |
490 (PCB).ssx = (PCB).bts[ag_k]; | |
491 (PCB).vs[(PCB).ssx] = (PCB).vs[ag_k]; | |
492 (PCB).ss[(PCB).ssx] = (PCB).ss[ag_k]; | |
493 } | |
494 (PCB).token_number = (manykw_token_type) (PCB).drt; | |
495 (PCB).ssx = (PCB).dssx; | |
496 (PCB).sn = (PCB).dsn; | |
497 (PCB).drt = -1; | |
498 } | |
499 | |
500 | |
501 static const unsigned short ag_tstt[] = { | |
502 389,388,387,386,385,384,383,382,381,380,379,378,377,376,375,374,373,372,371, | |
503 370,369,368,367,366,365,364,363,362,361,360,359,358,357,356,355,354,353, | |
504 352,351,350,349,348,347,346,345,344,343,342,341,340,339,338,337,336,335, | |
505 334,333,332,331,330,329,328,327,326,325,324,323,322,321,320,319,318,317, | |
506 316,315,314,313,312,311,310,309,308,307,306,305,304,303,302,301,300,299, | |
507 298,297,296,295,294,293,292,291,290,289,288,287,286,285,284,283,282,281, | |
508 280,279,278,277,276,275,274,273,272,271,270,269,268,267,266,265,264,263, | |
509 262,261,260,259,258,257,256,255,254,253,252,251,250,249,248,247,246,245, | |
510 244,243,242,241,240,239,238,237,236,235,234,233,232,231,230,229,228,227, | |
511 226,225,224,223,222,221,220,219,218,217,216,215,214,213,212,211,210,209, | |
512 208,207,206,205,204,203,202,201,200,199,198,197,196,195,194,193,192,191, | |
513 190,189,188,187,186,185,184,183,182,181,180,179,178,177,176,175,174,173, | |
514 172,171,170,169,168,167,166,165,164,163,162,161,160,159,158,157,156,155, | |
515 154,153,152,151,150,149,148,147,146,145,144,143,142,141,140,139,138,137, | |
516 136,135,134,133,132,131,130,129,128,127,126,125,124,123,122,121,120,119, | |
517 118,117,116,115,114,113,112,111,110,109,108,107,106,105,104,103,102,101, | |
518 100,99,98,97,96,95,94,93,92,91,90,89,88,87,86,85,84,83,82,81,80,79,78, | |
519 77,76,75,74,73,72,71,70,69,68,67,66,65,64,63,62,61,60,59,58,57,56,55,54, | |
520 53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30, | |
521 29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,0,1, | |
522 2,4,5, | |
523 3,0, | |
524 389,388,387,386,385,384,383,382,381,380,379,378,377,376,375,374,373,372,371, | |
525 370,369,368,367,366,365,364,363,362,361,360,359,358,357,356,355,354,353, | |
526 352,351,350,349,348,347,346,345,344,343,342,341,340,339,338,337,336,335, | |
527 334,333,332,331,330,329,328,327,326,325,324,323,322,321,320,319,318,317, | |
528 316,315,314,313,312,311,310,309,308,307,306,305,304,303,302,301,300,299, | |
529 298,297,296,295,294,293,292,291,290,289,288,287,286,285,284,283,282,281, | |
530 280,279,278,277,276,275,274,273,272,271,270,269,268,267,266,265,264,263, | |
531 262,3,0,5, | |
532 389,388,387,386,385,384,383,382,381,380,379,378,377,376,375,374,373,372,371, | |
533 370,369,368,367,366,365,364,363,362,361,360,359,358,357,356,355,354,353, | |
534 352,351,350,349,348,347,346,345,344,343,342,341,340,339,338,337,336,335, | |
535 334,333,332,331,330,329,328,327,326,325,324,323,322,321,320,319,318,317, | |
536 316,315,314,313,312,311,310,309,308,307,306,305,304,303,302,301,300,299, | |
537 298,297,296,295,294,293,292,291,290,289,288,287,286,285,284,283,282,281, | |
538 280,279,278,277,276,275,274,273,272,271,270,269,268,267,266,265,264,263, | |
539 262,261,260,259,258,257,256,255,254,253,252,251,250,249,248,247,246,245, | |
540 244,243,242,241,240,239,238,237,236,235,234,233,232,231,230,229,228,227, | |
541 226,225,224,223,222,221,220,219,218,217,216,215,214,213,212,211,210,209, | |
542 208,207,206,205,204,203,202,201,200,199,198,197,196,195,194,193,192,191, | |
543 190,189,188,187,186,185,184,183,182,181,180,179,178,177,176,175,174,173, | |
544 172,171,170,169,168,167,166,165,164,163,162,161,160,159,158,157,156,155, | |
545 154,153,152,151,150,149,148,147,146,145,144,143,142,141,140,139,138,137, | |
546 136,135,134,3,0,4,5, | |
547 3,0, | |
548 3,0, | |
549 3,0, | |
550 | |
551 }; | |
552 | |
553 | |
554 static unsigned const char ag_astt[788] = { | |
555 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, | |
556 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, | |
557 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, | |
558 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, | |
559 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, | |
560 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, | |
561 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, | |
562 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, | |
563 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, | |
564 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, | |
565 1,1,1,1,1,1,1,1,1,1,1,1,1,1,7,0,1,1,1,3,7,1,1,1,1,1,1,1,1,1,1,1,1,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,5,5,5,5,5,5,5,5,5,5, | |
598 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, | |
599 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, | |
600 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, | |
601 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, | |
602 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, | |
603 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, | |
604 6,6,1,3,6,5, | |
605 6,4, | |
606 5,5, | |
607 4,6, | |
608 | |
609 }; | |
610 | |
611 | |
612 static const unsigned short ag_sbt[] = { | |
613 0, 389, 391, 522, 782, 784, 786, 788 | |
614 }; | |
615 | |
616 | |
617 static const unsigned short ag_sbe[] = { | |
618 384, 390, 520, 779, 783, 785, 787, 788 | |
619 }; | |
620 | |
621 | |
622 static const unsigned char ag_fl[] = { | |
623 1,2,2,2,3,3,3,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, | |
624 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, | |
625 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, | |
626 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, | |
627 1,1,1,1,1,1,1,1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 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, | |
647 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, | |
648 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, | |
649 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, | |
650 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, | |
651 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, | |
652 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, | |
653 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, | |
654 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, | |
655 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, | |
656 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, | |
657 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, | |
658 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, | |
659 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 | |
660 }; | |
661 | |
662 | |
663 static void ag_ra(void) | |
664 { | |
665 } | |
666 | |
667 #define TOKEN_NAMES manykw_token_names | |
668 const char *const manykw_token_names[390] = { | |
669 "grammar", | |
670 "grammar", | |
671 "word1", | |
672 "eof", | |
673 "word2", | |
674 "word3", | |
675 "\"word00\"", | |
676 "\"word01\"", | |
677 "\"word02\"", | |
678 "\"word03\"", | |
679 "\"word04\"", | |
680 "\"word05\"", | |
681 "\"word06\"", | |
682 "\"word07\"", | |
683 "\"word08\"", | |
684 "\"word09\"", | |
685 "\"word0a\"", | |
686 "\"word0b\"", | |
687 "\"word0c\"", | |
688 "\"word0d\"", | |
689 "\"word0e\"", | |
690 "\"word0f\"", | |
691 "\"word10\"", | |
692 "\"word11\"", | |
693 "\"word12\"", | |
694 "\"word13\"", | |
695 "\"word14\"", | |
696 "\"word15\"", | |
697 "\"word16\"", | |
698 "\"word17\"", | |
699 "\"word18\"", | |
700 "\"word19\"", | |
701 "\"word1a\"", | |
702 "\"word1b\"", | |
703 "\"word1c\"", | |
704 "\"word1d\"", | |
705 "\"word1e\"", | |
706 "\"word1f\"", | |
707 "\"word20\"", | |
708 "\"word21\"", | |
709 "\"word22\"", | |
710 "\"word23\"", | |
711 "\"word24\"", | |
712 "\"word25\"", | |
713 "\"word26\"", | |
714 "\"word27\"", | |
715 "\"word28\"", | |
716 "\"word29\"", | |
717 "\"word2a\"", | |
718 "\"word2b\"", | |
719 "\"word2c\"", | |
720 "\"word2d\"", | |
721 "\"word2e\"", | |
722 "\"word2f\"", | |
723 "\"word30\"", | |
724 "\"word31\"", | |
725 "\"word32\"", | |
726 "\"word33\"", | |
727 "\"word34\"", | |
728 "\"word35\"", | |
729 "\"word36\"", | |
730 "\"word37\"", | |
731 "\"word38\"", | |
732 "\"word39\"", | |
733 "\"word3a\"", | |
734 "\"word3b\"", | |
735 "\"word3c\"", | |
736 "\"word3d\"", | |
737 "\"word3e\"", | |
738 "\"word3f\"", | |
739 "\"word40\"", | |
740 "\"word41\"", | |
741 "\"word42\"", | |
742 "\"word43\"", | |
743 "\"word44\"", | |
744 "\"word45\"", | |
745 "\"word46\"", | |
746 "\"word47\"", | |
747 "\"word48\"", | |
748 "\"word49\"", | |
749 "\"word4a\"", | |
750 "\"word4b\"", | |
751 "\"word4c\"", | |
752 "\"word4d\"", | |
753 "\"word4e\"", | |
754 "\"word4f\"", | |
755 "\"word50\"", | |
756 "\"word51\"", | |
757 "\"word52\"", | |
758 "\"word53\"", | |
759 "\"word54\"", | |
760 "\"word55\"", | |
761 "\"word56\"", | |
762 "\"word57\"", | |
763 "\"word58\"", | |
764 "\"word59\"", | |
765 "\"word5a\"", | |
766 "\"word5b\"", | |
767 "\"word5c\"", | |
768 "\"word5d\"", | |
769 "\"word5e\"", | |
770 "\"word5f\"", | |
771 "\"word60\"", | |
772 "\"word61\"", | |
773 "\"word62\"", | |
774 "\"word63\"", | |
775 "\"word64\"", | |
776 "\"word65\"", | |
777 "\"word66\"", | |
778 "\"word67\"", | |
779 "\"word68\"", | |
780 "\"word69\"", | |
781 "\"word6a\"", | |
782 "\"word6b\"", | |
783 "\"word6c\"", | |
784 "\"word6d\"", | |
785 "\"word6e\"", | |
786 "\"word6f\"", | |
787 "\"word70\"", | |
788 "\"word71\"", | |
789 "\"word72\"", | |
790 "\"word73\"", | |
791 "\"word74\"", | |
792 "\"word75\"", | |
793 "\"word76\"", | |
794 "\"word77\"", | |
795 "\"word78\"", | |
796 "\"word79\"", | |
797 "\"word7a\"", | |
798 "\"word7b\"", | |
799 "\"word7c\"", | |
800 "\"word7d\"", | |
801 "\"word7e\"", | |
802 "\"word7f\"", | |
803 "\"word80\"", | |
804 "\"word81\"", | |
805 "\"word82\"", | |
806 "\"word83\"", | |
807 "\"word84\"", | |
808 "\"word85\"", | |
809 "\"word86\"", | |
810 "\"word87\"", | |
811 "\"word88\"", | |
812 "\"word89\"", | |
813 "\"word8a\"", | |
814 "\"word8b\"", | |
815 "\"word8c\"", | |
816 "\"word8d\"", | |
817 "\"word8e\"", | |
818 "\"word8f\"", | |
819 "\"word90\"", | |
820 "\"word91\"", | |
821 "\"word92\"", | |
822 "\"word93\"", | |
823 "\"word94\"", | |
824 "\"word95\"", | |
825 "\"word96\"", | |
826 "\"word97\"", | |
827 "\"word98\"", | |
828 "\"word99\"", | |
829 "\"word9a\"", | |
830 "\"word9b\"", | |
831 "\"word9c\"", | |
832 "\"word9d\"", | |
833 "\"word9e\"", | |
834 "\"word9f\"", | |
835 "\"worda0\"", | |
836 "\"worda1\"", | |
837 "\"worda2\"", | |
838 "\"worda3\"", | |
839 "\"worda4\"", | |
840 "\"worda5\"", | |
841 "\"worda6\"", | |
842 "\"worda7\"", | |
843 "\"worda8\"", | |
844 "\"worda9\"", | |
845 "\"wordaa\"", | |
846 "\"wordab\"", | |
847 "\"wordac\"", | |
848 "\"wordad\"", | |
849 "\"wordae\"", | |
850 "\"wordaf\"", | |
851 "\"wordb0\"", | |
852 "\"wordb1\"", | |
853 "\"wordb2\"", | |
854 "\"wordb3\"", | |
855 "\"wordb4\"", | |
856 "\"wordb5\"", | |
857 "\"wordb6\"", | |
858 "\"wordb7\"", | |
859 "\"wordb8\"", | |
860 "\"wordb9\"", | |
861 "\"wordba\"", | |
862 "\"wordbb\"", | |
863 "\"wordbc\"", | |
864 "\"wordbd\"", | |
865 "\"wordbe\"", | |
866 "\"wordbf\"", | |
867 "\"wordc0\"", | |
868 "\"wordc1\"", | |
869 "\"wordc2\"", | |
870 "\"wordc3\"", | |
871 "\"wordc4\"", | |
872 "\"wordc5\"", | |
873 "\"wordc6\"", | |
874 "\"wordc7\"", | |
875 "\"wordc8\"", | |
876 "\"wordc9\"", | |
877 "\"wordca\"", | |
878 "\"wordcb\"", | |
879 "\"wordcc\"", | |
880 "\"wordcd\"", | |
881 "\"wordce\"", | |
882 "\"wordcf\"", | |
883 "\"wordd0\"", | |
884 "\"wordd1\"", | |
885 "\"wordd2\"", | |
886 "\"wordd3\"", | |
887 "\"wordd4\"", | |
888 "\"wordd5\"", | |
889 "\"wordd6\"", | |
890 "\"wordd7\"", | |
891 "\"wordd8\"", | |
892 "\"wordd9\"", | |
893 "\"wordda\"", | |
894 "\"worddb\"", | |
895 "\"worddc\"", | |
896 "\"worddd\"", | |
897 "\"wordde\"", | |
898 "\"worddf\"", | |
899 "\"worde0\"", | |
900 "\"worde1\"", | |
901 "\"worde2\"", | |
902 "\"worde3\"", | |
903 "\"worde4\"", | |
904 "\"worde5\"", | |
905 "\"worde6\"", | |
906 "\"worde7\"", | |
907 "\"worde8\"", | |
908 "\"worde9\"", | |
909 "\"wordea\"", | |
910 "\"wordeb\"", | |
911 "\"wordec\"", | |
912 "\"worded\"", | |
913 "\"wordee\"", | |
914 "\"wordef\"", | |
915 "\"wordf0\"", | |
916 "\"wordf1\"", | |
917 "\"wordf2\"", | |
918 "\"wordf3\"", | |
919 "\"wordf4\"", | |
920 "\"wordf5\"", | |
921 "\"wordf6\"", | |
922 "\"wordf7\"", | |
923 "\"wordf8\"", | |
924 "\"wordf9\"", | |
925 "\"wordfa\"", | |
926 "\"wordfb\"", | |
927 "\"wordfc\"", | |
928 "\"wordfd\"", | |
929 "\"wordfe\"", | |
930 "\"wordff\"", | |
931 "\"word100\"", | |
932 "\"word101\"", | |
933 "\"word102\"", | |
934 "\"word103\"", | |
935 "\"word104\"", | |
936 "\"word105\"", | |
937 "\"word106\"", | |
938 "\"word107\"", | |
939 "\"word108\"", | |
940 "\"word109\"", | |
941 "\"word10a\"", | |
942 "\"word10b\"", | |
943 "\"word10c\"", | |
944 "\"word10d\"", | |
945 "\"word10e\"", | |
946 "\"word10f\"", | |
947 "\"word110\"", | |
948 "\"word111\"", | |
949 "\"word112\"", | |
950 "\"word113\"", | |
951 "\"word114\"", | |
952 "\"word115\"", | |
953 "\"word116\"", | |
954 "\"word117\"", | |
955 "\"word118\"", | |
956 "\"word119\"", | |
957 "\"word11a\"", | |
958 "\"word11b\"", | |
959 "\"word11c\"", | |
960 "\"word11d\"", | |
961 "\"word11e\"", | |
962 "\"word11f\"", | |
963 "\"word120\"", | |
964 "\"word121\"", | |
965 "\"word122\"", | |
966 "\"word123\"", | |
967 "\"word124\"", | |
968 "\"word125\"", | |
969 "\"word126\"", | |
970 "\"word127\"", | |
971 "\"word128\"", | |
972 "\"word129\"", | |
973 "\"word12a\"", | |
974 "\"word12b\"", | |
975 "\"word12c\"", | |
976 "\"word12d\"", | |
977 "\"word12e\"", | |
978 "\"word12f\"", | |
979 "\"word130\"", | |
980 "\"word131\"", | |
981 "\"word132\"", | |
982 "\"word133\"", | |
983 "\"word134\"", | |
984 "\"word135\"", | |
985 "\"word136\"", | |
986 "\"word137\"", | |
987 "\"word138\"", | |
988 "\"word139\"", | |
989 "\"word13a\"", | |
990 "\"word13b\"", | |
991 "\"word13c\"", | |
992 "\"word13d\"", | |
993 "\"word13e\"", | |
994 "\"word13f\"", | |
995 "\"word140\"", | |
996 "\"word141\"", | |
997 "\"word142\"", | |
998 "\"word143\"", | |
999 "\"word144\"", | |
1000 "\"word145\"", | |
1001 "\"word146\"", | |
1002 "\"word147\"", | |
1003 "\"word148\"", | |
1004 "\"word149\"", | |
1005 "\"word14a\"", | |
1006 "\"word14b\"", | |
1007 "\"word14c\"", | |
1008 "\"word14d\"", | |
1009 "\"word14e\"", | |
1010 "\"word14f\"", | |
1011 "\"word150\"", | |
1012 "\"word151\"", | |
1013 "\"word152\"", | |
1014 "\"word153\"", | |
1015 "\"word154\"", | |
1016 "\"word155\"", | |
1017 "\"word156\"", | |
1018 "\"word157\"", | |
1019 "\"word158\"", | |
1020 "\"word159\"", | |
1021 "\"word15a\"", | |
1022 "\"word15b\"", | |
1023 "\"word15c\"", | |
1024 "\"word15d\"", | |
1025 "\"word15e\"", | |
1026 "\"word15f\"", | |
1027 "\"word160\"", | |
1028 "\"word161\"", | |
1029 "\"word162\"", | |
1030 "\"word163\"", | |
1031 "\"word164\"", | |
1032 "\"word165\"", | |
1033 "\"word166\"", | |
1034 "\"word167\"", | |
1035 "\"word168\"", | |
1036 "\"word169\"", | |
1037 "\"word16a\"", | |
1038 "\"word16b\"", | |
1039 "\"word16c\"", | |
1040 "\"word16d\"", | |
1041 "\"word16e\"", | |
1042 "\"word16f\"", | |
1043 "\"word170\"", | |
1044 "\"word171\"", | |
1045 "\"word172\"", | |
1046 "\"word173\"", | |
1047 "\"word174\"", | |
1048 "\"word175\"", | |
1049 "\"word176\"", | |
1050 "\"word177\"", | |
1051 "\"word178\"", | |
1052 "\"word179\"", | |
1053 "\"word17a\"", | |
1054 "\"word17b\"", | |
1055 "\"word17c\"", | |
1056 "\"word17d\"", | |
1057 "\"word17e\"", | |
1058 "\"word17f\"", | |
1059 | |
1060 }; | |
1061 | |
1062 #ifndef MISSING_FORMAT | |
1063 #define MISSING_FORMAT "Missing %s" | |
1064 #endif | |
1065 #ifndef UNEXPECTED_FORMAT | |
1066 #define UNEXPECTED_FORMAT "Unexpected %s" | |
1067 #endif | |
1068 #ifndef UNNAMED_TOKEN | |
1069 #define UNNAMED_TOKEN "input" | |
1070 #endif | |
1071 | |
1072 | |
1073 static void ag_diagnose(void) { | |
1074 int ag_snd = (PCB).sn; | |
1075 int ag_k = ag_sbt[ag_snd]; | |
1076 | |
1077 if (*TOKEN_NAMES[ag_tstt[ag_k]] && ag_astt[ag_k + 1] == ag_action_8) { | |
1078 sprintf((PCB).ag_msg, MISSING_FORMAT, TOKEN_NAMES[ag_tstt[ag_k]]); | |
1079 } | |
1080 else if (ag_astt[ag_sbe[(PCB).sn]] == ag_action_8 | |
1081 && (ag_k = (int) ag_sbe[(PCB).sn] + 1) == (int) ag_sbt[(PCB).sn+1] - 1 | |
1082 && *TOKEN_NAMES[ag_tstt[ag_k]]) { | |
1083 sprintf((PCB).ag_msg, MISSING_FORMAT, TOKEN_NAMES[ag_tstt[ag_k]]); | |
1084 } | |
1085 else if ((PCB).token_number && *TOKEN_NAMES[(PCB).token_number]) { | |
1086 sprintf((PCB).ag_msg, UNEXPECTED_FORMAT, TOKEN_NAMES[(PCB).token_number]); | |
1087 } | |
1088 else if (isprint((*(PCB).lab)) && (*(PCB).lab) != '\\') { | |
1089 char buf[20]; | |
1090 sprintf(buf, "\'%c\'", (char) (*(PCB).lab)); | |
1091 sprintf((PCB).ag_msg, UNEXPECTED_FORMAT, buf); | |
1092 } | |
1093 else sprintf((PCB).ag_msg, UNEXPECTED_FORMAT, UNNAMED_TOKEN); | |
1094 (PCB).error_message = (PCB).ag_msg; | |
1095 | |
1096 | |
1097 } | |
1098 static int ag_action_1_r_proc(void); | |
1099 static int ag_action_2_r_proc(void); | |
1100 static int ag_action_3_r_proc(void); | |
1101 static int ag_action_4_r_proc(void); | |
1102 static int ag_action_1_s_proc(void); | |
1103 static int ag_action_3_s_proc(void); | |
1104 static int ag_action_1_proc(void); | |
1105 static int ag_action_2_proc(void); | |
1106 static int ag_action_3_proc(void); | |
1107 static int ag_action_4_proc(void); | |
1108 static int ag_action_5_proc(void); | |
1109 static int ag_action_6_proc(void); | |
1110 static int ag_action_7_proc(void); | |
1111 static int ag_action_8_proc(void); | |
1112 static int ag_action_9_proc(void); | |
1113 static int ag_action_10_proc(void); | |
1114 static int ag_action_11_proc(void); | |
1115 static int ag_action_8_proc(void); | |
1116 | |
1117 | |
1118 static int (*const ag_r_procs_scan[])(void) = { | |
1119 ag_action_1_r_proc, | |
1120 ag_action_2_r_proc, | |
1121 ag_action_3_r_proc, | |
1122 ag_action_4_r_proc | |
1123 }; | |
1124 | |
1125 static int (*const ag_s_procs_scan[])(void) = { | |
1126 ag_action_1_s_proc, | |
1127 ag_action_2_r_proc, | |
1128 ag_action_3_s_proc, | |
1129 ag_action_4_r_proc | |
1130 }; | |
1131 | |
1132 static int (*const ag_gt_procs_scan[])(void) = { | |
1133 ag_action_1_proc, | |
1134 ag_action_2_proc, | |
1135 ag_action_3_proc, | |
1136 ag_action_4_proc, | |
1137 ag_action_5_proc, | |
1138 ag_action_6_proc, | |
1139 ag_action_7_proc, | |
1140 ag_action_8_proc, | |
1141 ag_action_9_proc, | |
1142 ag_action_10_proc, | |
1143 ag_action_11_proc, | |
1144 ag_action_8_proc | |
1145 }; | |
1146 | |
1147 | |
1148 static int ag_action_10_proc(void) { | |
1149 int ag_t = (PCB).token_number; | |
1150 (PCB).btsx = 0, (PCB).drt = -1; | |
1151 do { | |
1152 ag_track(); | |
1153 if ((PCB).rx < (PCB).fx) { | |
1154 (PCB).input_code = (PCB).lab[(PCB).rx++]; | |
1155 (PCB).token_number = (manykw_token_type) AG_TCV((PCB).input_code);} | |
1156 else { | |
1157 GET_INPUT; | |
1158 (PCB).lab[(PCB).fx++] = (PCB).input_code; | |
1159 (PCB).token_number = (manykw_token_type) AG_TCV((PCB).input_code); | |
1160 (PCB).rx++; | |
1161 } | |
1162 if (ag_key_index[(PCB).sn]) { | |
1163 unsigned ag_k = ag_key_index[(PCB).sn]; | |
1164 int ag_ch = CONVERT_CASE((PCB).input_code); | |
1165 if (ag_ch < 255) { | |
1166 while (ag_key_ch[ag_k] < ag_ch) ag_k++; | |
1167 if (ag_key_ch[ag_k] == ag_ch) ag_get_key_word(ag_k); | |
1168 } | |
1169 } | |
1170 } while ((PCB).token_number == (manykw_token_type) ag_t); | |
1171 (PCB).rx = 0; | |
1172 return 1; | |
1173 } | |
1174 | |
1175 static int ag_action_11_proc(void) { | |
1176 int ag_t = (PCB).token_number; | |
1177 | |
1178 (PCB).btsx = 0, (PCB).drt = -1; | |
1179 do { | |
1180 (PCB).vs[(PCB).ssx] = *(PCB).lab; | |
1181 (PCB).ssx--; | |
1182 ag_track(); | |
1183 ag_ra(); | |
1184 if ((PCB).exit_flag != AG_RUNNING_CODE) return 0; | |
1185 (PCB).ssx++; | |
1186 if ((PCB).rx < (PCB).fx) { | |
1187 (PCB).input_code = (PCB).lab[(PCB).rx++]; | |
1188 (PCB).token_number = (manykw_token_type) AG_TCV((PCB).input_code);} | |
1189 else { | |
1190 GET_INPUT; | |
1191 (PCB).lab[(PCB).fx++] = (PCB).input_code; | |
1192 (PCB).token_number = (manykw_token_type) AG_TCV((PCB).input_code); | |
1193 (PCB).rx++; | |
1194 } | |
1195 if (ag_key_index[(PCB).sn]) { | |
1196 unsigned ag_k = ag_key_index[(PCB).sn]; | |
1197 int ag_ch = CONVERT_CASE((PCB).input_code); | |
1198 if (ag_ch < 255) { | |
1199 while (ag_key_ch[ag_k] < ag_ch) ag_k++; | |
1200 if (ag_key_ch[ag_k] == ag_ch) ag_get_key_word(ag_k); | |
1201 } | |
1202 } | |
1203 } | |
1204 while ((PCB).token_number == (manykw_token_type) ag_t); | |
1205 (PCB).rx = 0; | |
1206 return 1; | |
1207 } | |
1208 | |
1209 static int ag_action_3_r_proc(void) { | |
1210 int ag_sd = ag_fl[(PCB).ag_ap] - 1; | |
1211 if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd]; | |
1212 (PCB).btsx = 0, (PCB).drt = -1; | |
1213 (PCB).reduction_token = (manykw_token_type) ag_ptt[(PCB).ag_ap]; | |
1214 ag_ra(); | |
1215 return (PCB).exit_flag == AG_RUNNING_CODE; | |
1216 } | |
1217 | |
1218 static int ag_action_3_s_proc(void) { | |
1219 int ag_sd = ag_fl[(PCB).ag_ap] - 1; | |
1220 if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd]; | |
1221 (PCB).btsx = 0, (PCB).drt = -1; | |
1222 (PCB).reduction_token = (manykw_token_type) ag_ptt[(PCB).ag_ap]; | |
1223 ag_ra(); | |
1224 return (PCB).exit_flag == AG_RUNNING_CODE; | |
1225 } | |
1226 | |
1227 static int ag_action_4_r_proc(void) { | |
1228 int ag_sd = ag_fl[(PCB).ag_ap] - 1; | |
1229 if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd]; | |
1230 (PCB).reduction_token = (manykw_token_type) ag_ptt[(PCB).ag_ap]; | |
1231 return 1; | |
1232 } | |
1233 | |
1234 static int ag_action_2_proc(void) { | |
1235 (PCB).btsx = 0, (PCB).drt = -1; | |
1236 if ((PCB).ssx >= 128) { | |
1237 (PCB).exit_flag = AG_STACK_ERROR_CODE; | |
1238 PARSER_STACK_OVERFLOW; | |
1239 } | |
1240 (PCB).vs[(PCB).ssx] = *(PCB).lab; | |
1241 (PCB).ss[(PCB).ssx] = (PCB).sn; | |
1242 (PCB).ssx++; | |
1243 (PCB).sn = (PCB).ag_ap; | |
1244 ag_track(); | |
1245 return 0; | |
1246 } | |
1247 | |
1248 static int ag_action_9_proc(void) { | |
1249 if ((PCB).drt == -1) { | |
1250 (PCB).drt=(PCB).token_number; | |
1251 (PCB).dssx=(PCB).ssx; | |
1252 (PCB).dsn=(PCB).sn; | |
1253 } | |
1254 ag_prot(); | |
1255 (PCB).vs[(PCB).ssx] = ag_null_value; | |
1256 (PCB).ss[(PCB).ssx] = (PCB).sn; | |
1257 (PCB).ssx++; | |
1258 (PCB).sn = (PCB).ag_ap; | |
1259 (PCB).rx = 0; | |
1260 return (PCB).exit_flag == AG_RUNNING_CODE; | |
1261 } | |
1262 | |
1263 static int ag_action_2_r_proc(void) { | |
1264 (PCB).ssx++; | |
1265 (PCB).sn = (PCB).ag_ap; | |
1266 return 0; | |
1267 } | |
1268 | |
1269 static int ag_action_7_proc(void) { | |
1270 --(PCB).ssx; | |
1271 (PCB).rx = 0; | |
1272 (PCB).exit_flag = AG_SUCCESS_CODE; | |
1273 return 0; | |
1274 } | |
1275 | |
1276 static int ag_action_1_proc(void) { | |
1277 ag_track(); | |
1278 (PCB).exit_flag = AG_SUCCESS_CODE; | |
1279 return 0; | |
1280 } | |
1281 | |
1282 static int ag_action_1_r_proc(void) { | |
1283 (PCB).exit_flag = AG_SUCCESS_CODE; | |
1284 return 0; | |
1285 } | |
1286 | |
1287 static int ag_action_1_s_proc(void) { | |
1288 (PCB).exit_flag = AG_SUCCESS_CODE; | |
1289 return 0; | |
1290 } | |
1291 | |
1292 static int ag_action_4_proc(void) { | |
1293 int ag_sd = ag_fl[(PCB).ag_ap] - 1; | |
1294 (PCB).reduction_token = (manykw_token_type) ag_ptt[(PCB).ag_ap]; | |
1295 (PCB).btsx = 0, (PCB).drt = -1; | |
1296 (PCB).vs[(PCB).ssx] = *(PCB).lab; | |
1297 if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd]; | |
1298 else (PCB).ss[(PCB).ssx] = (PCB).sn; | |
1299 ag_track(); | |
1300 while ((PCB).exit_flag == AG_RUNNING_CODE) { | |
1301 unsigned ag_t1 = ag_sbe[(PCB).sn] + 1; | |
1302 unsigned ag_t2 = ag_sbt[(PCB).sn+1] - 1; | |
1303 do { | |
1304 unsigned ag_tx = (ag_t1 + ag_t2)/2; | |
1305 if (ag_tstt[ag_tx] < (unsigned short)(PCB).reduction_token) ag_t1 = ag_tx + 1; | |
1306 else ag_t2 = ag_tx; | |
1307 } while (ag_t1 < ag_t2); | |
1308 (PCB).ag_ap = ag_pstt[ag_t1]; | |
1309 if ((ag_s_procs_scan[ag_astt[ag_t1]])() == 0) break; | |
1310 } | |
1311 return 0; | |
1312 } | |
1313 | |
1314 static int ag_action_3_proc(void) { | |
1315 int ag_sd = ag_fl[(PCB).ag_ap] - 1; | |
1316 (PCB).btsx = 0, (PCB).drt = -1; | |
1317 (PCB).vs[(PCB).ssx] = *(PCB).lab; | |
1318 if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd]; | |
1319 else (PCB).ss[(PCB).ssx] = (PCB).sn; | |
1320 ag_track(); | |
1321 (PCB).reduction_token = (manykw_token_type) ag_ptt[(PCB).ag_ap]; | |
1322 ag_ra(); | |
1323 while ((PCB).exit_flag == AG_RUNNING_CODE) { | |
1324 unsigned ag_t1 = ag_sbe[(PCB).sn] + 1; | |
1325 unsigned ag_t2 = ag_sbt[(PCB).sn+1] - 1; | |
1326 do { | |
1327 unsigned ag_tx = (ag_t1 + ag_t2)/2; | |
1328 if (ag_tstt[ag_tx] < (unsigned short)(PCB).reduction_token) ag_t1 = ag_tx + 1; | |
1329 else ag_t2 = ag_tx; | |
1330 } while (ag_t1 < ag_t2); | |
1331 (PCB).ag_ap = ag_pstt[ag_t1]; | |
1332 if ((ag_s_procs_scan[ag_astt[ag_t1]])() == 0) break; | |
1333 } | |
1334 return 0; | |
1335 } | |
1336 | |
1337 static int ag_action_8_proc(void) { | |
1338 ag_undo(); | |
1339 (PCB).rx = 0; | |
1340 (PCB).exit_flag = AG_SYNTAX_ERROR_CODE; | |
1341 ag_diagnose(); | |
1342 SYNTAX_ERROR; | |
1343 {(PCB).rx = 1; ag_track();} | |
1344 return (PCB).exit_flag == AG_RUNNING_CODE; | |
1345 } | |
1346 | |
1347 static int ag_action_5_proc(void) { | |
1348 int ag_sd = ag_fl[(PCB).ag_ap]; | |
1349 (PCB).btsx = 0, (PCB).drt = -1; | |
1350 if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd]; | |
1351 else { | |
1352 (PCB).ss[(PCB).ssx] = (PCB).sn; | |
1353 } | |
1354 (PCB).rx = 0; | |
1355 (PCB).reduction_token = (manykw_token_type) ag_ptt[(PCB).ag_ap]; | |
1356 ag_ra(); | |
1357 while ((PCB).exit_flag == AG_RUNNING_CODE) { | |
1358 unsigned ag_t1 = ag_sbe[(PCB).sn] + 1; | |
1359 unsigned ag_t2 = ag_sbt[(PCB).sn+1] - 1; | |
1360 do { | |
1361 unsigned ag_tx = (ag_t1 + ag_t2)/2; | |
1362 if (ag_tstt[ag_tx] < (unsigned short)(PCB).reduction_token) ag_t1 = ag_tx + 1; | |
1363 else ag_t2 = ag_tx; | |
1364 } while (ag_t1 < ag_t2); | |
1365 (PCB).ag_ap = ag_pstt[ag_t1]; | |
1366 if ((ag_r_procs_scan[ag_astt[ag_t1]])() == 0) break; | |
1367 } | |
1368 return (PCB).exit_flag == AG_RUNNING_CODE; | |
1369 } | |
1370 | |
1371 static int ag_action_6_proc(void) { | |
1372 int ag_sd = ag_fl[(PCB).ag_ap]; | |
1373 (PCB).reduction_token = (manykw_token_type) ag_ptt[(PCB).ag_ap]; | |
1374 if ((PCB).drt == -1) { | |
1375 (PCB).drt=(PCB).token_number; | |
1376 (PCB).dssx=(PCB).ssx; | |
1377 (PCB).dsn=(PCB).sn; | |
1378 } | |
1379 if (ag_sd) { | |
1380 (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd]; | |
1381 } | |
1382 else { | |
1383 ag_prot(); | |
1384 (PCB).vs[(PCB).ssx] = ag_null_value; | |
1385 (PCB).ss[(PCB).ssx] = (PCB).sn; | |
1386 } | |
1387 (PCB).rx = 0; | |
1388 while ((PCB).exit_flag == AG_RUNNING_CODE) { | |
1389 unsigned ag_t1 = ag_sbe[(PCB).sn] + 1; | |
1390 unsigned ag_t2 = ag_sbt[(PCB).sn+1] - 1; | |
1391 do { | |
1392 unsigned ag_tx = (ag_t1 + ag_t2)/2; | |
1393 if (ag_tstt[ag_tx] < (unsigned short)(PCB).reduction_token) ag_t1 = ag_tx + 1; | |
1394 else ag_t2 = ag_tx; | |
1395 } while (ag_t1 < ag_t2); | |
1396 (PCB).ag_ap = ag_pstt[ag_t1]; | |
1397 if ((ag_r_procs_scan[ag_astt[ag_t1]])() == 0) break; | |
1398 } | |
1399 return (PCB).exit_flag == AG_RUNNING_CODE; | |
1400 } | |
1401 | |
1402 | |
1403 void init_manykw(void) { | |
1404 (PCB).rx = (PCB).fx = 0; | |
1405 (PCB).ss[0] = (PCB).sn = (PCB).ssx = 0; | |
1406 (PCB).exit_flag = AG_RUNNING_CODE; | |
1407 (PCB).line = FIRST_LINE; | |
1408 (PCB).column = FIRST_COLUMN; | |
1409 (PCB).btsx = 0, (PCB).drt = -1; | |
1410 } | |
1411 | |
1412 void manykw(void) { | |
1413 init_manykw(); | |
1414 (PCB).exit_flag = AG_RUNNING_CODE; | |
1415 while ((PCB).exit_flag == AG_RUNNING_CODE) { | |
1416 unsigned ag_t1 = ag_sbt[(PCB).sn]; | |
1417 if (ag_tstt[ag_t1]) { | |
1418 unsigned ag_t2 = ag_sbe[(PCB).sn] - 1; | |
1419 if ((PCB).rx < (PCB).fx) { | |
1420 (PCB).input_code = (PCB).lab[(PCB).rx++]; | |
1421 (PCB).token_number = (manykw_token_type) AG_TCV((PCB).input_code);} | |
1422 else { | |
1423 GET_INPUT; | |
1424 (PCB).lab[(PCB).fx++] = (PCB).input_code; | |
1425 (PCB).token_number = (manykw_token_type) AG_TCV((PCB).input_code); | |
1426 (PCB).rx++; | |
1427 } | |
1428 if (ag_key_index[(PCB).sn]) { | |
1429 unsigned ag_k = ag_key_index[(PCB).sn]; | |
1430 int ag_ch = CONVERT_CASE((PCB).input_code); | |
1431 if (ag_ch < 255) { | |
1432 while (ag_key_ch[ag_k] < ag_ch) ag_k++; | |
1433 if (ag_key_ch[ag_k] == ag_ch) ag_get_key_word(ag_k); | |
1434 } | |
1435 } | |
1436 do { | |
1437 unsigned ag_tx = (ag_t1 + ag_t2)/2; | |
1438 if (ag_tstt[ag_tx] > (unsigned short)(PCB).token_number) | |
1439 ag_t1 = ag_tx + 1; | |
1440 else ag_t2 = ag_tx; | |
1441 } while (ag_t1 < ag_t2); | |
1442 if (ag_tstt[ag_t1] != (unsigned short)(PCB).token_number) | |
1443 ag_t1 = ag_sbe[(PCB).sn]; | |
1444 } | |
1445 (PCB).ag_ap = ag_pstt[ag_t1]; | |
1446 (ag_gt_procs_scan[ag_astt[ag_t1]])(); | |
1447 } | |
1448 } | |
1449 | |
1450 | |
1451 | |
1452 int main(void) { | |
1453 manykw(); | |
1454 return 0; | |
1455 } |