Mercurial > ~dholland > hg > ag > index.cgi
comparison tests/agcl/examples/good/ts.cpp @ 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 * AnaGram, a System for Syntax Directed Programming | |
3 * C Macro preprocessor and parser | |
4 * TS.SYN: Token Scanner Module | |
5 * | |
6 * Copyright 1993-2000 Parsifal Software. All Rights Reserved. | |
7 * | |
8 * This software is provided 'as-is', without any express or implied | |
9 * warranty. In no event will the authors be held liable for any damages | |
10 * arising from the use of this software. | |
11 * | |
12 * Permission is granted to anyone to use this software for any purpose, | |
13 * including commercial applications, and to alter it and redistribute it | |
14 * freely, subject to the following restrictions: | |
15 * | |
16 * 1. The origin of this software must not be misrepresented; you must not | |
17 * claim that you wrote the original software. If you use this software | |
18 * in a product, an acknowledgment in the product documentation would be | |
19 * appreciated but is not required. | |
20 * 2. Altered source versions must be plainly marked as such, and must not be | |
21 * misrepresented as being the original software. | |
22 * 3. This notice may not be removed or altered from any source distribution. | |
23 */ | |
24 | |
25 #include "mpp.h" | |
26 | |
27 | |
28 // context structure for diagnostics | |
29 | |
30 struct location { unsigned line, column; }; | |
31 | |
32 | |
33 /* | |
34 * AnaGram, A System for Syntax Directed Programming | |
35 * File generated by: ... | |
36 * | |
37 * AnaGram Parsing Engine | |
38 * Copyright 1993-2002 Parsifal Software. All Rights Reserved. | |
39 * | |
40 * This software is provided 'as-is', without any express or implied | |
41 * warranty. In no event will the authors be held liable for any damages | |
42 * arising from the use of this software. | |
43 * | |
44 * Permission is granted to anyone to use this software for any purpose, | |
45 * including commercial applications, and to alter it and redistribute it | |
46 * freely, subject to the following restrictions: | |
47 * | |
48 * 1. The origin of this software must not be misrepresented; you must not | |
49 * claim that you wrote the original software. If you use this software | |
50 * in a product, an acknowledgment in the product documentation would be | |
51 * appreciated but is not required. | |
52 * 2. Altered source versions must be plainly marked as such, and must not be | |
53 * misrepresented as being the original software. | |
54 * 3. This notice may not be removed or altered from any source distribution. | |
55 */ | |
56 | |
57 #ifndef TS_H | |
58 #include "ts.h" | |
59 #endif | |
60 | |
61 #ifndef TS_H | |
62 #error Mismatched header file | |
63 #endif | |
64 | |
65 #include <ctype.h> | |
66 #include <stdio.h> | |
67 | |
68 #define RULE_CONTEXT (&((PCB).cs[(PCB).ssx])) | |
69 #define ERROR_CONTEXT ((PCB).cs[(PCB).error_frame_ssx]) | |
70 #define CONTEXT ((PCB).cs[(PCB).ssx]) | |
71 | |
72 | |
73 #define CHANGE_REDUCTION(x) ts_change_reduction(ts_##x##_token) | |
74 int ts_change_reduction(ts_token_type); | |
75 | |
76 | |
77 #line - "ts.syn" | |
78 // Embedded C | |
79 #include "array.h" // \AnaGram\classlib\include\array.h | |
80 #include "stack.h" // \AnaGram\classlib\include\stack.h | |
81 #if defined(__MSDOS__) || defined(__WIN32__) | |
82 #include <io.h> // If not found, not necessary | |
83 #endif | |
84 #include <sys/types.h> // If not found, not necessary | |
85 #include <sys/stat.h> | |
86 #include <fcntl.h> | |
87 | |
88 | |
89 // Macro Definitions | |
90 | |
91 #define SYNTAX_ERROR syntax_error_scanning(PCB.error_message) | |
92 #define GET_CONTEXT (CONTEXT.line = PCB.line, CONTEXT.column = PCB.column) | |
93 #define GET_INPUT (PCB.input_code = getc(input.file)) | |
94 #define PCB input.pcb | |
95 | |
96 | |
97 // Structure Definition | |
98 | |
99 struct file_descriptor { | |
100 char *name; // name of file | |
101 FILE *file; // source of input characters | |
102 ts_pcb_type pcb; // parser control block for file | |
103 }; | |
104 | |
105 typedef stack<file_descriptor> file_descriptor_stack; | |
106 | |
107 // Static Data Declarations | |
108 | |
109 static const char *error_modifier = ""; | |
110 static file_descriptor input; | |
111 static stack<token_sink *> save_sink(5); | |
112 static file_descriptor_stack active_files(20); | |
113 | |
114 // Syntax Error Reporting | |
115 /* | |
116 syntax_error() provides an error diagnostic procedure for those | |
117 parsers which are called by the token scanner. error_modifier is set | |
118 by expand() so that an error encountered during a macro expansion | |
119 will be so described. Otherwise, the diagnostic will not make | |
120 sense. | |
121 | |
122 Since all other parsers are called from reduction procedures, the | |
123 line and column number of the token they are dealing with is given | |
124 by the context of the token scanner production that is being | |
125 reduced. | |
126 */ | |
127 | |
128 void syntax_error(const char *msg) { | |
129 printf("%s: Line %d, Column %d: %s%s\n", | |
130 input.name, CONTEXT.line, CONTEXT.column, msg, error_modifier); | |
131 } | |
132 | |
133 /* | |
134 syntax_error_scanning() provides an error diagnostic procedure for | |
135 the token scanner itself. The locus of the error is given by the | |
136 current line and column number of the token scan, as given in the | |
137 parser control block. | |
138 */ | |
139 | |
140 static void syntax_error_scanning(const char *msg) { | |
141 printf("%s: Line %d, Column %d: %s\n", | |
142 input.name, PCB.line, PCB.column, msg); | |
143 } | |
144 | |
145 | |
146 // Support for Reduction Procedures | |
147 /* | |
148 name_token() looks up the name string in the string accumulator, | |
149 identifies it in the token dictionary, checks to see if it is a | |
150 reserved word, and creates a token. | |
151 */ | |
152 | |
153 static token name_token(void) { | |
154 token t; | |
155 t.id = NAME; | |
156 t.handle = td << sa.top(); | |
157 --sa; | |
158 if (t.handle <= n_reserved_words) t.id = reserved_words[t.handle].id; | |
159 return t; | |
160 } | |
161 | |
162 /* | |
163 op() creates a token for a punctuation character. | |
164 */ | |
165 | |
166 static token op(unsigned x) { | |
167 token t; | |
168 t.id = (token_id) x; | |
169 t.handle = token_handles[x]; | |
170 return t; | |
171 } | |
172 | |
173 /* | |
174 space_op() creates a token for a space character. Note that a space | |
175 could be a tab, vertical tab, or form feed character as well as a | |
176 blank. | |
177 */ | |
178 | |
179 static token space_op(unsigned x) { | |
180 token t; | |
181 t.id = (token_id) ' '; | |
182 t.handle = token_handles[x]; | |
183 return t; | |
184 } | |
185 | |
186 /* | |
187 tkn() creates a token with a specified id for the string on the top | |
188 of the string accumulator | |
189 */ | |
190 | |
191 static token tkn(token_id id) { | |
192 token t; | |
193 t.id = id; | |
194 t.handle = td << sa.top(); | |
195 --sa; | |
196 return t; | |
197 } | |
198 | |
199 | |
200 // Macro Processing Procedures | |
201 | |
202 /* | |
203 check_defined() looks up the name on the string accumulator to see if | |
204 it is the name of a macro. It then selects a reduction token according | |
205 to the outcome of the test and an input flag. | |
206 */ | |
207 | |
208 static void check_defined(int flag) { | |
209 unsigned id = macro_id[td[sa.top()]]; | |
210 --sa; | |
211 flag ^= id != 0; | |
212 if (flag) CHANGE_REDUCTION(false_condition); | |
213 else CHANGE_REDUCTION(true_condition); | |
214 } | |
215 | |
216 /* | |
217 defined() returns a decimal constant token equal to one or zero | |
218 depending on whether the token named on the string accumulator is or | |
219 is not defined as a macro | |
220 */ | |
221 | |
222 static token defined(void) { | |
223 unsigned id = macro_id[td[sa.top()]]; | |
224 token t; | |
225 t.id = DECconstant; | |
226 t.handle = id ? one_value : zero_value; | |
227 --sa; | |
228 return t; | |
229 } | |
230 | |
231 /* | |
232 expand() expands and outputs a macro. t.handle is the token dictionary | |
233 index of the macro name. n is the number of arguments found. | |
234 | |
235 Since it is possible that scanner sink is pointing to ta, it is | |
236 necessary to pop the expanded macro from ta before passing it on to | |
237 scanner_sink. Otherwise, we would have effectively ta << ta, a | |
238 situation which causes an infinite loop. | |
239 */ | |
240 | |
241 static void expand(token t, unsigned n) { | |
242 error_modifier = " in macro expansion"; // fix error diagnostic | |
243 expand_macro(t,n); // Defined in MAS.SYN | |
244 if (size(ta)) { | |
245 array<token> x(ta,size(ta) + 1); | |
246 --ta; | |
247 *scanner_sink << x; | |
248 } else --ta; | |
249 error_modifier = ""; | |
250 } | |
251 | |
252 /* | |
253 Look up the name string on the string accumulator. Determine whether | |
254 it is a reserved word, or a simple identifier. Then determine | |
255 whether it is the name of a macro. | |
256 */ | |
257 | |
258 static token id_macro(void) { | |
259 token t; | |
260 unsigned id; | |
261 | |
262 t.id = NAME; | |
263 t.handle = td << sa.top(); | |
264 --sa; | |
265 if (t.handle <= n_reserved_words) t.id = reserved_words[t.handle].id; | |
266 | |
267 if (if_clause && t.handle == defined_value) { | |
268 CHANGE_REDUCTION(defined); | |
269 return t; | |
270 } | |
271 id = macro_id[t.handle]; | |
272 if (id == 0) return t; | |
273 | |
274 if (macro[id].parens) CHANGE_REDUCTION(macro); | |
275 else CHANGE_REDUCTION(simple_macro); | |
276 return t; | |
277 } | |
278 | |
279 /* | |
280 Start a macro definition. This procedure defines all but the body of | |
281 the macro. | |
282 | |
283 nargs is the count of parameters that were found. flag is set if | |
284 the macro was defined with parentheses. | |
285 | |
286 The parameter names are on the string accumulator, with the last | |
287 name on the top of the stack, so they must be popped off, identified | |
288 and stored in reverse order. | |
289 | |
290 The name of the macro is beneath the parameter names on the string | |
291 accumulator. | |
292 | |
293 Before returning, this procedure saves the current value of | |
294 scanner_sink, increments the level on the token stack and sets | |
295 scanner_sink so that subsequent tokens produced by the token scanner | |
296 will accumulate on the token stack. These tokens comprise the body | |
297 of the macro. When the end of the macro body is encountered, the | |
298 procedure save_macro_body will remove them from the token stack and | |
299 restore the value of scanner_sink. | |
300 */ | |
301 | |
302 static int init_macro_def(int nargs, int flag) { | |
303 int k; | |
304 int id = ++n_macros; | |
305 unsigned name; | |
306 unsigned *arg_list = nargs ? new unsigned[nargs] : NULL; | |
307 | |
308 assert(id < N_MACROS); | |
309 for (k = nargs; k--;) { | |
310 arg_list[k] = td << sa.top(); | |
311 --sa; | |
312 } | |
313 | |
314 macro[id].arg_names = arg_list; | |
315 macro[id].n_args = nargs; | |
316 | |
317 macro[id].name = name = td << sa.top(); | |
318 --sa; | |
319 | |
320 macro_id[name] = id; | |
321 | |
322 macro[id].busy_flag = 0; | |
323 macro[id].parens = flag ; | |
324 | |
325 save_sink << scanner_sink; | |
326 scanner_sink = &++ta; | |
327 return id; | |
328 } | |
329 | |
330 /* | |
331 save_macro_body() finishes the definition of a macro by making a | |
332 permanent copy of the token string on the token accumulator. It then | |
333 restores the scanner_sink to the value it had when the macro | |
334 definition was encountered. | |
335 */ | |
336 | |
337 static void save_macro_body(int id) { | |
338 macro[id].body = size(ta) ? copy(ta) : NULL; | |
339 --ta; | |
340 save_sink >> scanner_sink; | |
341 } | |
342 | |
343 /* | |
344 undefine() deletes the macro definition for the macro whose name is | |
345 on the top of the string accumulator. If there is no macro with the | |
346 given name, undefine simply returns. | |
347 | |
348 Otherwise, it frees the storage associated with the macro. It then | |
349 fills the resulting hole in the table with the last macro in the | |
350 table. The macro_id table is updated appropriately. | |
351 */ | |
352 | |
353 static void undefine(void) { | |
354 unsigned name = td << sa.top(); | |
355 int id = macro_id[name]; | |
356 --sa; | |
357 if (id == 0) return; | |
358 macro_id[name] = 0; | |
359 if (macro[id].arg_names) delete [] macro[id].arg_names; | |
360 if (macro[id].body) delete [] macro[id].body; | |
361 macro[id] = macro[n_macros--]; | |
362 macro_id[macro[id].name] = id; | |
363 } | |
364 | |
365 | |
366 // Include file procedures | |
367 | |
368 /* | |
369 file_name() interprets the file name provided by an #include | |
370 statement. If the file name is enclosed in <> brackets it scans the | |
371 directory list in paths to try to find the file. If it finds it, it | |
372 prefixes the path to the file name. | |
373 | |
374 If the file name is enclosed in "" quotation marks, file_name() | |
375 simply strips the quotation marks. | |
376 | |
377 If file_name() succeeds, it returns 1 and provides path-name in the | |
378 string accumulator, otherwise it returns 0 and nothing in the string | |
379 accumulator. | |
380 | |
381 Note that file name uses a temporary string accumulator, lsa. | |
382 */ | |
383 | |
384 static int file_name(char *file) { | |
385 int c; | |
386 int tc; | |
387 string_accumulator lsa(100); // for temporary storage of name | |
388 | |
389 while (*file == ' ') file++; | |
390 tc = *file++; | |
391 if (tc == '<') tc = '>'; | |
392 else if (tc != '"') return 0; | |
393 while ((c = *file++) != 0 && c != tc) lsa << c; | |
394 if (c != tc) return 0; | |
395 if (tc == '"') { | |
396 int k, n; | |
397 active_files << input; | |
398 n = size(active_files); | |
399 | |
400 while (n--) { | |
401 FILE *f; | |
402 #ifdef _MSC_VER //Cope with peculiarity of MSVC++ | |
403 char *cp; | |
404 int junk; | |
405 | |
406 ++sa << ((file_descriptor *)active_files)[n].name; | |
407 k = size(sa); | |
408 cp = (char *)sa; | |
409 while (k-- && cp[k] != '\\' && cp[k] != '/') { sa >> junk;} | |
410 #else | |
411 ++sa << active_files[n].name; | |
412 while (size(sa) && sa[0] != '\\' && sa[0] != '/') { | |
413 sa >> k; // strip off current file name to leave only path | |
414 } | |
415 #endif | |
416 sa << lsa; // append desired file name | |
417 f = fopen(sa.top(),"rt"); | |
418 if (f != NULL) { | |
419 fclose(f); | |
420 active_files >> input; | |
421 return 1; | |
422 } | |
423 --sa; | |
424 } | |
425 active_files >> input; | |
426 } | |
427 int k, n; | |
428 n = size(paths); | |
429 for (k = 0; k < n; k++) { | |
430 FILE *f; | |
431 | |
432 #ifdef _MSC_VER //Cope with peculiarity of MSVC++ | |
433 ++sa << ((char **) paths)[k]; | |
434 char c = ((char *)sa)[size(sa)-1]; | |
435 if (size(sa) && c != '\\' && c != '/') sa << '/'; | |
436 #else | |
437 ++sa << paths[k]; | |
438 if (size(sa) && sa[0] != '\\' && sa[0] != '/') sa << '/'; | |
439 #endif | |
440 sa << lsa; | |
441 f = fopen(sa.top(),"rt"); | |
442 if (f != NULL) { | |
443 fclose(f); | |
444 return 1; | |
445 } | |
446 --sa; | |
447 } | |
448 return 0; | |
449 } | |
450 | |
451 /* | |
452 include_file() is called in response to a #include statement. | |
453 | |
454 First, it saves the file_descriptor for the current input. Then it | |
455 restores the scanner_sink which was saved prior to accumulating | |
456 macro expanded tokens on the token_accumulator. | |
457 | |
458 When include_file() is called, the argument of the #include | |
459 statement exists in the form of tokens on the token accumulator. | |
460 These tokens are passed to a token_translator which turns the tokens | |
461 into a string on the string accumulator. | |
462 | |
463 file_name() is then called to distinguish between "" and <> files. | |
464 In the latter case, file_name() prefixes a directory path to the name. | |
465 The name is then in the string accumulator. | |
466 | |
467 scan_input() is then called to scan the include file. | |
468 | |
469 Finally, before returning, the previous file_descriptor is restored. | |
470 */ | |
471 | |
472 static void include_file(void) { | |
473 int flag; | |
474 | |
475 save_sink >> scanner_sink; // restore scanner_sink | |
476 | |
477 token_translator tt(&++sa); | |
478 tt << ta; // recover string from tokens | |
479 --ta; // discard token string | |
480 | |
481 array<char> file(sa.top(), size(sa)+1); // local copy of string | |
482 --sa; | |
483 | |
484 flag = file_name(file); | |
485 | |
486 if (!flag) { | |
487 fprintf(stderr, "Bad include file name: %s\n", (char *) file); | |
488 return; | |
489 } | |
490 array<char> path(sa.top(), size(sa) + 1); | |
491 --sa; | |
492 active_files << input; // Save current file | |
493 scan_input(path); // recursive call to ts() | |
494 active_files >> input; // Restore previous file | |
495 return; | |
496 } | |
497 | |
498 | |
499 // Conditional compilation procedures | |
500 | |
501 /* | |
502 init_condition() prepares for evaluation the condition expression in | |
503 #if and #elif statements. | |
504 | |
505 It protects scanner_sink by pushing it onto the save_sink stack. | |
506 Then it resets the expression evaluatior, condition, and sets | |
507 scanner_sink to point to it. | |
508 | |
509 Finally it sets the if_clause flag so that defined() will be handled | |
510 properly. | |
511 */ | |
512 | |
513 static void init_condition(void) { | |
514 save_sink << scanner_sink; | |
515 scanner_sink = &reset(condition); | |
516 if_clause = 1; | |
517 } | |
518 | |
519 /* | |
520 eval_condition() is called to deal with #if and #elif statements. The | |
521 init_condition() procedure has redirected scanner output to the | |
522 expression evaluator, so eval_condition() restores the previous | |
523 scanner destination. | |
524 | |
525 It then sends an eof token to the expression evaluator, resets | |
526 if_clause and reads the value of the condition. Remember that | |
527 (long) condition returns the value of the expression. | |
528 */ | |
529 | |
530 static int eval_condition(void) { | |
531 save_sink >> scanner_sink; | |
532 condition << op(0); // eof to exp evaluator | |
533 if_clause = 0; | |
534 return condition != 0L; | |
535 } | |
536 | |
537 /* | |
538 In eval_if() and eval_elif() note the use of CHANGE_REDUCTION to | |
539 select the appropriate reduction token depending on the outcome of | |
540 the condition. | |
541 */ | |
542 | |
543 static void eval_elif(void) { | |
544 if (eval_condition()) CHANGE_REDUCTION(true_else_condition); | |
545 else CHANGE_REDUCTION(false_else_condition); | |
546 } | |
547 | |
548 static void eval_if(void) { | |
549 if (eval_condition()) CHANGE_REDUCTION(true_condition); | |
550 else CHANGE_REDUCTION(false_condition); | |
551 } | |
552 | |
553 | |
554 // Do token scan | |
555 | |
556 /* | |
557 scan_input() | |
558 1) opens the specified file, if possible | |
559 2) calls the parser | |
560 3) closes the input file | |
561 */ | |
562 | |
563 void scan_input(char *path) { | |
564 input.file = fopen(path, "rt"); | |
565 input.name = path; | |
566 if (input.file == NULL) { | |
567 fprintf(stderr,"Cannot open %s\n", (char *) path); | |
568 return; | |
569 } | |
570 ts(); | |
571 fclose(input.file); | |
572 } | |
573 | |
574 #line - "ts.cpp" | |
575 | |
576 #ifndef CONVERT_CASE | |
577 #define CONVERT_CASE(c) (c) | |
578 #endif | |
579 #ifndef TAB_SPACING | |
580 #define TAB_SPACING 8 | |
581 #endif | |
582 | |
583 static void ag_rp_1(void) { | |
584 #line - "ts.syn" | |
585 *scanner_sink << op('\n'); | |
586 #line - "ts.cpp" | |
587 } | |
588 | |
589 static void ag_rp_2(void) { | |
590 #line - "ts.syn" | |
591 check_defined(1); | |
592 #line - "ts.cpp" | |
593 } | |
594 | |
595 static void ag_rp_3(void) { | |
596 #line - "ts.syn" | |
597 check_defined(0); | |
598 #line - "ts.cpp" | |
599 } | |
600 | |
601 static void ag_rp_4(void) { | |
602 #line - "ts.syn" | |
603 eval_if(); | |
604 #line - "ts.cpp" | |
605 } | |
606 | |
607 static void ag_rp_5(void) { | |
608 #line - "ts.syn" | |
609 eval_elif(); | |
610 #line - "ts.cpp" | |
611 } | |
612 | |
613 static void ag_rp_6(void) { | |
614 #line - "ts.syn" | |
615 init_condition(); | |
616 #line - "ts.cpp" | |
617 } | |
618 | |
619 static void ag_rp_7(void) { | |
620 #line - "ts.syn" | |
621 init_condition(); | |
622 #line - "ts.cpp" | |
623 } | |
624 | |
625 static void ag_rp_8(void) { | |
626 #line - "ts.syn" | |
627 include_file(); | |
628 #line - "ts.cpp" | |
629 } | |
630 | |
631 static void ag_rp_9(void) { | |
632 #line - "ts.syn" | |
633 undefine(); | |
634 #line - "ts.cpp" | |
635 } | |
636 | |
637 static void ag_rp_10(int id) { | |
638 #line - "ts.syn" | |
639 save_macro_body(id); | |
640 #line - "ts.cpp" | |
641 } | |
642 | |
643 static void ag_rp_11(void) { | |
644 #line - "ts.syn" | |
645 save_sink << scanner_sink, scanner_sink = &++ta; | |
646 #line - "ts.cpp" | |
647 } | |
648 | |
649 static int ag_rp_12(void) { | |
650 #line - "ts.syn" | |
651 return init_macro_def(0,0); | |
652 #line - "ts.cpp" | |
653 } | |
654 | |
655 static int ag_rp_13(int n) { | |
656 #line - "ts.syn" | |
657 return init_macro_def(n,1); | |
658 #line - "ts.cpp" | |
659 } | |
660 | |
661 static int ag_rp_14(void) { | |
662 #line - "ts.syn" | |
663 return 0; | |
664 #line - "ts.cpp" | |
665 } | |
666 | |
667 static int ag_rp_15(void) { | |
668 #line - "ts.syn" | |
669 return 1; | |
670 #line - "ts.cpp" | |
671 } | |
672 | |
673 static int ag_rp_16(int n) { | |
674 #line - "ts.syn" | |
675 return n+1; | |
676 #line - "ts.cpp" | |
677 } | |
678 | |
679 static void ag_rp_17(int c) { | |
680 #line - "ts.syn" | |
681 *scanner_sink << space_op(c); | |
682 #line - "ts.cpp" | |
683 } | |
684 | |
685 static void ag_rp_18(void) { | |
686 #line - "ts.syn" | |
687 *scanner_sink << op('#'); | |
688 #line - "ts.cpp" | |
689 } | |
690 | |
691 static void ag_rp_19(void) { | |
692 #line - "ts.syn" | |
693 *scanner_sink << name_token(); | |
694 #line - "ts.cpp" | |
695 } | |
696 | |
697 static void ag_rp_20(token t) { | |
698 #line - "ts.syn" | |
699 *scanner_sink << t; | |
700 #line - "ts.cpp" | |
701 } | |
702 | |
703 static void ag_rp_21(token t) { | |
704 #line - "ts.syn" | |
705 expand(t,0); | |
706 #line - "ts.cpp" | |
707 } | |
708 | |
709 static void ag_rp_22(token t) { | |
710 #line - "ts.syn" | |
711 *scanner_sink << t; | |
712 #line - "ts.cpp" | |
713 } | |
714 | |
715 static void ag_rp_23(token t, int n) { | |
716 #line - "ts.syn" | |
717 expand(t,n); | |
718 #line - "ts.cpp" | |
719 } | |
720 | |
721 static void ag_rp_24(void) { | |
722 #line - "ts.syn" | |
723 *scanner_sink << defined(); | |
724 #line - "ts.cpp" | |
725 } | |
726 | |
727 static void ag_rp_25(void) { | |
728 #line - "ts.syn" | |
729 *scanner_sink << defined(); | |
730 #line - "ts.cpp" | |
731 } | |
732 | |
733 static token ag_rp_26(void) { | |
734 #line - "ts.syn" | |
735 return id_macro(); | |
736 #line - "ts.cpp" | |
737 } | |
738 | |
739 static int ag_rp_27(void) { | |
740 #line - "ts.syn" | |
741 return 0; | |
742 #line - "ts.cpp" | |
743 } | |
744 | |
745 static void ag_rp_28(void) { | |
746 #line - "ts.syn" | |
747 save_sink << scanner_sink, scanner_sink = &ta; | |
748 #line - "ts.cpp" | |
749 } | |
750 | |
751 static int ag_rp_29(int n) { | |
752 #line - "ts.syn" | |
753 return save_sink >> scanner_sink, n; | |
754 #line - "ts.cpp" | |
755 } | |
756 | |
757 static int ag_rp_30(void) { | |
758 #line - "ts.syn" | |
759 return 1; | |
760 #line - "ts.cpp" | |
761 } | |
762 | |
763 static int ag_rp_31(int n) { | |
764 #line - "ts.syn" | |
765 return n+1; | |
766 #line - "ts.cpp" | |
767 } | |
768 | |
769 static void ag_rp_32(void) { | |
770 #line - "ts.syn" | |
771 ++ta; | |
772 #line - "ts.cpp" | |
773 } | |
774 | |
775 static void ag_rp_33(int c) { | |
776 #line - "ts.syn" | |
777 *scanner_sink << space_op(c); | |
778 #line - "ts.cpp" | |
779 } | |
780 | |
781 static void ag_rp_34(void) { | |
782 #line - "ts.syn" | |
783 *scanner_sink << name_token(); | |
784 #line - "ts.cpp" | |
785 } | |
786 | |
787 static void ag_rp_35(void) { | |
788 #line - "ts.syn" | |
789 *scanner_sink << tkn(STRINGliteral); | |
790 #line - "ts.cpp" | |
791 } | |
792 | |
793 static void ag_rp_36(void) { | |
794 #line - "ts.syn" | |
795 *scanner_sink << tkn(CHARACTERconstant); | |
796 #line - "ts.cpp" | |
797 } | |
798 | |
799 static void ag_rp_37(int p) { | |
800 #line - "ts.syn" | |
801 *scanner_sink << op(p); | |
802 #line - "ts.cpp" | |
803 } | |
804 | |
805 static void ag_rp_38(int t) { | |
806 #line - "ts.syn" | |
807 *scanner_sink << op(t); | |
808 #line - "ts.cpp" | |
809 } | |
810 | |
811 static void ag_rp_39(int t) { | |
812 #line - "ts.syn" | |
813 *scanner_sink << op(t); | |
814 #line - "ts.cpp" | |
815 } | |
816 | |
817 static void ag_rp_40(int t) { | |
818 #line - "ts.syn" | |
819 *scanner_sink << op(t); | |
820 #line - "ts.cpp" | |
821 } | |
822 | |
823 static void ag_rp_41(void) { | |
824 #line - "ts.syn" | |
825 *scanner_sink << tkn(STRINGliteral); | |
826 #line - "ts.cpp" | |
827 } | |
828 | |
829 static void ag_rp_42(void) { | |
830 #line - "ts.syn" | |
831 *scanner_sink << tkn(CHARACTERconstant); | |
832 #line - "ts.cpp" | |
833 } | |
834 | |
835 static void ag_rp_43(int p) { | |
836 #line - "ts.syn" | |
837 *scanner_sink << op(p); | |
838 #line - "ts.cpp" | |
839 } | |
840 | |
841 static int ag_rp_44(void) { | |
842 #line - "ts.syn" | |
843 return ' '; | |
844 #line - "ts.cpp" | |
845 } | |
846 | |
847 static void ag_rp_45(void) { | |
848 #line - "ts.syn" | |
849 if (nest_comments) CHANGE_REDUCTION(comment_head); | |
850 #line - "ts.cpp" | |
851 } | |
852 | |
853 static void ag_rp_46(void) { | |
854 #line - "ts.syn" | |
855 *scanner_sink << op(ANDAND); | |
856 #line - "ts.cpp" | |
857 } | |
858 | |
859 static void ag_rp_47(void) { | |
860 #line - "ts.syn" | |
861 *scanner_sink << op(ANDassign); | |
862 #line - "ts.cpp" | |
863 } | |
864 | |
865 static void ag_rp_48(void) { | |
866 #line - "ts.syn" | |
867 *scanner_sink << op(ARROW); | |
868 #line - "ts.cpp" | |
869 } | |
870 | |
871 static void ag_rp_49(void) { | |
872 #line - "ts.syn" | |
873 *scanner_sink << op(CONCAT); | |
874 #line - "ts.cpp" | |
875 } | |
876 | |
877 static void ag_rp_50(void) { | |
878 #line - "ts.syn" | |
879 *scanner_sink << op(DECR); | |
880 #line - "ts.cpp" | |
881 } | |
882 | |
883 static void ag_rp_51(void) { | |
884 #line - "ts.syn" | |
885 *scanner_sink << op(DIVassign); | |
886 #line - "ts.cpp" | |
887 } | |
888 | |
889 static void ag_rp_52(void) { | |
890 #line - "ts.syn" | |
891 *scanner_sink << op(ELLIPSIS); | |
892 #line - "ts.cpp" | |
893 } | |
894 | |
895 static void ag_rp_53(void) { | |
896 #line - "ts.syn" | |
897 *scanner_sink << op(EQ); | |
898 #line - "ts.cpp" | |
899 } | |
900 | |
901 static void ag_rp_54(void) { | |
902 #line - "ts.syn" | |
903 *scanner_sink << op(ERassign); | |
904 #line - "ts.cpp" | |
905 } | |
906 | |
907 static void ag_rp_55(void) { | |
908 #line - "ts.syn" | |
909 *scanner_sink << op(GE); | |
910 #line - "ts.cpp" | |
911 } | |
912 | |
913 static void ag_rp_56(void) { | |
914 #line - "ts.syn" | |
915 *scanner_sink << op(ICR); | |
916 #line - "ts.cpp" | |
917 } | |
918 | |
919 static void ag_rp_57(void) { | |
920 #line - "ts.syn" | |
921 *scanner_sink << op(LE); | |
922 #line - "ts.cpp" | |
923 } | |
924 | |
925 static void ag_rp_58(void) { | |
926 #line - "ts.syn" | |
927 *scanner_sink << op(LS); | |
928 #line - "ts.cpp" | |
929 } | |
930 | |
931 static void ag_rp_59(void) { | |
932 #line - "ts.syn" | |
933 *scanner_sink << op(LSassign); | |
934 #line - "ts.cpp" | |
935 } | |
936 | |
937 static void ag_rp_60(void) { | |
938 #line - "ts.syn" | |
939 *scanner_sink << op(MODassign); | |
940 #line - "ts.cpp" | |
941 } | |
942 | |
943 static void ag_rp_61(void) { | |
944 #line - "ts.syn" | |
945 *scanner_sink << op(MINUSassign); | |
946 #line - "ts.cpp" | |
947 } | |
948 | |
949 static void ag_rp_62(void) { | |
950 #line - "ts.syn" | |
951 *scanner_sink << op(MULTassign); | |
952 #line - "ts.cpp" | |
953 } | |
954 | |
955 static void ag_rp_63(void) { | |
956 #line - "ts.syn" | |
957 *scanner_sink << op(NE); | |
958 #line - "ts.cpp" | |
959 } | |
960 | |
961 static void ag_rp_64(void) { | |
962 #line - "ts.syn" | |
963 *scanner_sink << op(ORassign); | |
964 #line - "ts.cpp" | |
965 } | |
966 | |
967 static void ag_rp_65(void) { | |
968 #line - "ts.syn" | |
969 *scanner_sink << op(OROR); | |
970 #line - "ts.cpp" | |
971 } | |
972 | |
973 static void ag_rp_66(void) { | |
974 #line - "ts.syn" | |
975 *scanner_sink << op(PLUSassign); | |
976 #line - "ts.cpp" | |
977 } | |
978 | |
979 static void ag_rp_67(void) { | |
980 #line - "ts.syn" | |
981 *scanner_sink << op(RS); | |
982 #line - "ts.cpp" | |
983 } | |
984 | |
985 static void ag_rp_68(void) { | |
986 #line - "ts.syn" | |
987 *scanner_sink << op(RSassign); | |
988 #line - "ts.cpp" | |
989 } | |
990 | |
991 static void ag_rp_69(void) { | |
992 #line - "ts.syn" | |
993 *scanner_sink << tkn(FLOATconstant); | |
994 #line - "ts.cpp" | |
995 } | |
996 | |
997 static void ag_rp_70(void) { | |
998 #line - "ts.syn" | |
999 sa << 'F'; | |
1000 #line - "ts.cpp" | |
1001 } | |
1002 | |
1003 static void ag_rp_71(void) { | |
1004 #line - "ts.syn" | |
1005 sa << 'L'; | |
1006 #line - "ts.cpp" | |
1007 } | |
1008 | |
1009 static void ag_rp_72(void) { | |
1010 #line - "ts.syn" | |
1011 sa << '.'; | |
1012 #line - "ts.cpp" | |
1013 } | |
1014 | |
1015 static void ag_rp_73(void) { | |
1016 #line - "ts.syn" | |
1017 sa << '.'; | |
1018 #line - "ts.cpp" | |
1019 } | |
1020 | |
1021 static void ag_rp_74(int d) { | |
1022 #line - "ts.syn" | |
1023 ++sa << '.' << d; | |
1024 #line - "ts.cpp" | |
1025 } | |
1026 | |
1027 static void ag_rp_75(int d) { | |
1028 #line - "ts.syn" | |
1029 sa << d; | |
1030 #line - "ts.cpp" | |
1031 } | |
1032 | |
1033 static void ag_rp_76(int d) { | |
1034 #line - "ts.syn" | |
1035 sa << d; | |
1036 #line - "ts.cpp" | |
1037 } | |
1038 | |
1039 static void ag_rp_77(int d) { | |
1040 #line - "ts.syn" | |
1041 sa << d; | |
1042 #line - "ts.cpp" | |
1043 } | |
1044 | |
1045 static void ag_rp_78(int d) { | |
1046 #line - "ts.syn" | |
1047 sa << '-' << d; | |
1048 #line - "ts.cpp" | |
1049 } | |
1050 | |
1051 static void ag_rp_79(int d) { | |
1052 #line - "ts.syn" | |
1053 sa << '+' << d; | |
1054 #line - "ts.cpp" | |
1055 } | |
1056 | |
1057 static void ag_rp_80(int d) { | |
1058 #line - "ts.syn" | |
1059 sa << d; | |
1060 #line - "ts.cpp" | |
1061 } | |
1062 | |
1063 static void ag_rp_81(void) { | |
1064 #line - "ts.syn" | |
1065 sa << 'U'; | |
1066 #line - "ts.cpp" | |
1067 } | |
1068 | |
1069 static void ag_rp_82(void) { | |
1070 #line - "ts.syn" | |
1071 sa << 'L'; | |
1072 #line - "ts.cpp" | |
1073 } | |
1074 | |
1075 static void ag_rp_83(void) { | |
1076 #line - "ts.syn" | |
1077 *scanner_sink << tkn(OCTconstant); | |
1078 #line - "ts.cpp" | |
1079 } | |
1080 | |
1081 static void ag_rp_84(void) { | |
1082 #line - "ts.syn" | |
1083 *scanner_sink << tkn(DECconstant); | |
1084 #line - "ts.cpp" | |
1085 } | |
1086 | |
1087 static void ag_rp_85(void) { | |
1088 #line - "ts.syn" | |
1089 *scanner_sink << tkn(HEXconstant); | |
1090 #line - "ts.cpp" | |
1091 } | |
1092 | |
1093 static void ag_rp_86(void) { | |
1094 #line - "ts.syn" | |
1095 ++sa << '0'; | |
1096 #line - "ts.cpp" | |
1097 } | |
1098 | |
1099 static void ag_rp_87(int d) { | |
1100 #line - "ts.syn" | |
1101 sa << d; | |
1102 #line - "ts.cpp" | |
1103 } | |
1104 | |
1105 static void ag_rp_88(int d) { | |
1106 #line - "ts.syn" | |
1107 ++sa << "0X" << d; | |
1108 #line - "ts.cpp" | |
1109 } | |
1110 | |
1111 static void ag_rp_89(int d) { | |
1112 #line - "ts.syn" | |
1113 sa << d; | |
1114 #line - "ts.cpp" | |
1115 } | |
1116 | |
1117 static void ag_rp_90(int d) { | |
1118 #line - "ts.syn" | |
1119 ++sa << d; | |
1120 #line - "ts.cpp" | |
1121 } | |
1122 | |
1123 static void ag_rp_91(int d) { | |
1124 #line - "ts.syn" | |
1125 sa << d; | |
1126 #line - "ts.cpp" | |
1127 } | |
1128 | |
1129 static void ag_rp_92(void) { | |
1130 #line - "ts.syn" | |
1131 sa << '"'; | |
1132 #line - "ts.cpp" | |
1133 } | |
1134 | |
1135 static void ag_rp_93(void) { | |
1136 #line - "ts.syn" | |
1137 ++sa << '"'; | |
1138 #line - "ts.cpp" | |
1139 } | |
1140 | |
1141 static void ag_rp_94(int c) { | |
1142 #line - "ts.syn" | |
1143 sa << c; | |
1144 #line - "ts.cpp" | |
1145 } | |
1146 | |
1147 static void ag_rp_95(int c) { | |
1148 #line - "ts.syn" | |
1149 sa << '\\' << c; | |
1150 #line - "ts.cpp" | |
1151 } | |
1152 | |
1153 static void ag_rp_96(void) { | |
1154 #line - "ts.syn" | |
1155 sa << '\''; | |
1156 #line - "ts.cpp" | |
1157 } | |
1158 | |
1159 static void ag_rp_97(void) { | |
1160 #line - "ts.syn" | |
1161 ++sa << '\''; | |
1162 #line - "ts.cpp" | |
1163 } | |
1164 | |
1165 static void ag_rp_98(int c) { | |
1166 #line - "ts.syn" | |
1167 sa << c; | |
1168 #line - "ts.cpp" | |
1169 } | |
1170 | |
1171 static void ag_rp_99(int c) { | |
1172 #line - "ts.syn" | |
1173 sa << '\\' << c; | |
1174 #line - "ts.cpp" | |
1175 } | |
1176 | |
1177 static void ag_rp_100(int c) { | |
1178 #line - "ts.syn" | |
1179 ++sa << c; | |
1180 #line - "ts.cpp" | |
1181 } | |
1182 | |
1183 static void ag_rp_101(int c) { | |
1184 #line - "ts.syn" | |
1185 sa << c; | |
1186 #line - "ts.cpp" | |
1187 } | |
1188 | |
1189 | |
1190 #ifndef AG_TRACE_FILE_NAME | |
1191 #define AG_TRACE_FILE_NAME "ts.etr" | |
1192 #endif | |
1193 | |
1194 static void ag_trace_error(void) { | |
1195 FILE *ag_file = fopen(AG_TRACE_FILE_NAME, "w"); | |
1196 int i; | |
1197 if (ag_file == NULL) return; | |
1198 fprintf(ag_file, "%d\n", (PCB).ssx); | |
1199 for (i = 0; i < (PCB).ssx; i++) fprintf(ag_file, "%d\n", (PCB).ss[i]); | |
1200 fprintf(ag_file, "%d\n", (PCB).sn); | |
1201 fprintf(ag_file, "%d\n", (PCB).token_number); | |
1202 fclose(ag_file); | |
1203 } | |
1204 | |
1205 | |
1206 #define READ_COUNTS | |
1207 #define WRITE_COUNTS | |
1208 #undef V | |
1209 #define V(i,t) (*t (&(PCB).vs[(PCB).ssx + i])) | |
1210 #undef VS | |
1211 #define VS(i) (PCB).vs[(PCB).ssx + i] | |
1212 | |
1213 #ifndef GET_CONTEXT | |
1214 #define GET_CONTEXT CONTEXT = (PCB).input_context | |
1215 #endif | |
1216 | |
1217 typedef enum { | |
1218 ag_action_1, | |
1219 ag_action_2, | |
1220 ag_action_3, | |
1221 ag_action_4, | |
1222 ag_action_5, | |
1223 ag_action_6, | |
1224 ag_action_7, | |
1225 ag_action_8, | |
1226 ag_action_9, | |
1227 ag_action_10, | |
1228 ag_action_11, | |
1229 ag_action_12 | |
1230 } ag_parser_action; | |
1231 | |
1232 | |
1233 #ifndef NULL_VALUE_INITIALIZER | |
1234 #define NULL_VALUE_INITIALIZER = { 0 } | |
1235 #endif | |
1236 | |
1237 static ts_vs_type const ag_null_value NULL_VALUE_INITIALIZER; | |
1238 | |
1239 static const unsigned char ag_rpx[] = { | |
1240 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
1241 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
1242 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
1243 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 4, 5, 6, | |
1244 7, 8, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 11, 12, 13, 14, | |
1245 0, 15, 16, 17, 0, 0, 18, 0, 0, 19, 0, 0, 0, 0, 0, 20, 21, 22, | |
1246 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 0, 0, 33, 0, 34, 0, 0, 35, | |
1247 36, 0, 37, 38, 39, 0, 40, 41, 42, 0, 43, 0, 0, 44, 0, 0, 0, 0, | |
1248 0, 0, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, | |
1249 61, 62, 63, 64, 65, 66, 67, 68, 69, 0, 0, 70, 71, 0, 0, 0, 0, 72, | |
1250 0, 73, 74, 75, 76, 77, 78, 0, 0, 79, 80, 81, 82, 83, 84, 85, 0, 0, | |
1251 86, 87, 0, 0, 88, 89, 0, 0, 90, 91, 92, 93, 94, 95, 0, 96, 97, 98, | |
1252 99, 0,100,101 | |
1253 }; | |
1254 | |
1255 static const unsigned char ag_key_itt[] = { | |
1256 0 | |
1257 }; | |
1258 | |
1259 static const unsigned short ag_key_pt[] = { | |
1260 0 | |
1261 }; | |
1262 | |
1263 static const unsigned char ag_key_ch[] = { | |
1264 0, 47,255, 42, 47,255,100,110,255,102,110,255, 47,100,101,105,108,112, | |
1265 117,255,100,110,255,102,110,255,100,101,105,108,112,117,255,105,115,255, | |
1266 108,110,114,255,100,110,255,102,110,255, 47,100,101,105,108,112,117,255, | |
1267 105,115,255,108,110,114,255,100,110,255,102,110,255, 47,100,101,105,108, | |
1268 112,117,255,105,115,255,108,110,114,255,100,110,255,102,110,255,100,101, | |
1269 105,108,112,117,255,105,115,255,108,110,114,255,100,110,255,102,110,255, | |
1270 100,101,105,108,112,117,255,110,114,255,100,110,255,102,110,255, 47,100, | |
1271 101,105,108,112,117,255,110,114,255,100,110,255,102,110,255,100,101,105, | |
1272 108,112,117,255 | |
1273 }; | |
1274 | |
1275 static const unsigned char ag_key_act[] = { | |
1276 0,3,4,3,3,4,3,3,4,1,3,4,3,3,3,2,3,3,3,4,3,3,4,1,3,4,3,3,2,3,3,3,4,3,3, | |
1277 4,2,3,3,4,3,3,4,1,3,4,3,3,2,2,3,3,3,4,3,3,4,2,3,3,4,3,3,4,1,3,4,3,3,2, | |
1278 2,3,3,3,4,3,3,4,2,3,3,4,3,3,4,1,3,4,3,2,2,3,3,3,4,3,3,4,2,3,3,4,3,3,4, | |
1279 1,3,4,3,2,2,3,3,3,4,3,3,4,3,3,4,1,3,4,3,3,2,2,3,3,3,4,3,3,4,3,3,4,1,3, | |
1280 4,3,2,2,3,3,3,4 | |
1281 }; | |
1282 | |
1283 static const unsigned char ag_key_parm[] = { | |
1284 0,100, 0, 99,100, 0, 38, 39, 0, 37, 48, 0,100, 46, 50, 0, 49, 51, | |
1285 63, 0, 38, 39, 0, 37, 48, 0, 46, 50, 0, 49, 51, 63, 0, 45, 33, 0, | |
1286 0, 34, 50, 0, 38, 39, 0, 37, 48, 0,100, 46, 0, 0, 49, 51, 47, 0, | |
1287 45, 33, 0, 0, 34, 50, 0, 38, 39, 0, 37, 48, 0,100, 46, 0, 0, 49, | |
1288 51, 63, 0, 45, 33, 0, 0, 34, 50, 0, 38, 39, 0, 37, 48, 0, 46, 0, | |
1289 0, 49, 51, 47, 0, 45, 33, 0, 0, 34, 50, 0, 38, 39, 0, 37, 48, 0, | |
1290 46, 0, 0, 49, 51, 63, 0, 34, 50, 0, 38, 39, 0, 37, 48, 0,100, 46, | |
1291 0, 0, 49, 51, 63, 0, 34, 50, 0, 38, 39, 0, 37, 48, 0, 46, 0, 0, | |
1292 49, 51, 63, 0 | |
1293 }; | |
1294 | |
1295 static const unsigned short ag_key_jmp[] = { | |
1296 0, 0, 0, 2, 4, 0, 19, 22, 0, 6, 26, 0, 6, 8, 14, 9, 32, 36, | |
1297 42, 0, 58, 61, 0, 20, 65, 0, 47, 53, 23, 71, 75, 81, 0, 94, 96, 0, | |
1298 33, 98,102, 0,106,109, 0, 40,113, 0, 86, 88, 36, 43,119,123,129, 0, | |
1299 145,147, 0, 54,149,153, 0,157,160, 0, 61,164, 0,137,139, 57, 64,170, | |
1300 174,180, 0,191,193, 0, 75,195,199, 0,203,206, 0, 82,210, 0,185, 78, | |
1301 85,216,220,226, 0,240,242, 0, 95,244,248, 0,252,255, 0,102,259, 0, | |
1302 234, 98,105,265,269,275, 0,288,292, 0,296,299, 0,118,303, 0,280,282, | |
1303 115,121,309,313,319, 0,330,334, 0,338,341, 0,135,345, 0,324,132,138, | |
1304 351,355,361, 0 | |
1305 }; | |
1306 | |
1307 static const unsigned char ag_key_index[] = { | |
1308 1, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
1309 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 12, 1, | |
1310 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, | |
1311 0, 0, 1, 0, 0, 1, 26, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, | |
1312 0, 46, 0, 67, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 88, | |
1313 0,108, 0, 0, 1, 0, 0, 1, 0, 0, 46,124, 1, 1, 0, 0, 1, 1, | |
1314 1, 0, 0, 1, 1, 1, 0, 0, 0, 88,141, 1, 1, 0, 0, 0, 0, 0, | |
1315 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0, | |
1316 0, 1, 1, 0, 1 | |
1317 }; | |
1318 | |
1319 static const unsigned char ag_key_ends[] = { | |
1320 42,0, 47,0, 42,0, 42,0, 101,102,105,110,101,0, 114,114,111,114,0, | |
1321 101,102,0, 100,101,102,0, 99,108,117,100,101,0, 105,110,101,0, | |
1322 114,97,103,109,97,0, 110,100,101,102,0, 101,102,105,110,101,0, | |
1323 114,114,111,114,0, 101,102,0, 100,101,102,0, 99,108,117,100,101,0, | |
1324 105,110,101,0, 114,97,103,109,97,0, 110,100,101,102,0, 42,0, | |
1325 101,102,105,110,101,0, 102,0, 101,0, 100,105,102,0, 114,111,114,0, | |
1326 101,102,0, 100,101,102,0, 99,108,117,100,101,0, 105,110,101,0, | |
1327 114,97,103,109,97,0, 110,100,101,102,105,110,101,0, 42,0, | |
1328 101,102,105,110,101,0, 102,0, 101,0, 100,105,102,0, 114,111,114,0, | |
1329 101,102,0, 100,101,102,0, 99,108,117,100,101,0, 105,110,101,0, | |
1330 114,97,103,109,97,0, 110,100,101,102,0, 101,102,105,110,101,0, | |
1331 102,0, 101,0, 100,105,102,0, 114,111,114,0, 101,102,0, | |
1332 100,101,102,0, 99,108,117,100,101,0, 105,110,101,0, | |
1333 114,97,103,109,97,0, 110,100,101,102,105,110,101,0, | |
1334 101,102,105,110,101,0, 102,0, 101,0, 100,105,102,0, 114,111,114,0, | |
1335 101,102,0, 100,101,102,0, 99,108,117,100,101,0, 105,110,101,0, | |
1336 114,97,103,109,97,0, 110,100,101,102,0, 42,0, 101,102,105,110,101,0, | |
1337 100,105,102,0, 114,111,114,0, 101,102,0, 100,101,102,0, | |
1338 99,108,117,100,101,0, 105,110,101,0, 114,97,103,109,97,0, | |
1339 110,100,101,102,0, 101,102,105,110,101,0, 100,105,102,0, | |
1340 114,111,114,0, 101,102,0, 100,101,102,0, 99,108,117,100,101,0, | |
1341 105,110,101,0, 114,97,103,109,97,0, 110,100,101,102,0, | |
1342 }; | |
1343 | |
1344 #define AG_TCV(x) ag_tcv[(x) + 1] | |
1345 | |
1346 static const unsigned char ag_tcv[] = { | |
1347 12, 12,148,148,148,148,148,148,148,148, 95, 94, 95, 95, 95,148,148,148, | |
1348 148,148,148,148,148,148,148,148,148,148,148,148,148,148,148, 95,112,140, | |
1349 31,148,110,101,144, 68, 70,111,108, 72,103,106,105,133,149,149,149,149, | |
1350 149,149,149,125,125,148,148,109,102,104,148,148,150,150,150,150,126,117, | |
1351 151,151,151,151,151,118,151,151,151,151,151,151,151,151,129,151,151,136, | |
1352 151,151,148, 56,148,107,151,148,150,150,150,150,126,117,151,151,151,151, | |
1353 151,118,151,151,151,151,151,151,151,151,129,151,151,136,151,151,148,113, | |
1354 148,148,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152, | |
1355 152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152, | |
1356 152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152, | |
1357 152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152, | |
1358 152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152, | |
1359 152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152, | |
1360 152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152, | |
1361 152,152,152,152,152 | |
1362 }; | |
1363 | |
1364 #ifndef SYNTAX_ERROR | |
1365 #define SYNTAX_ERROR fprintf(stderr,"%s, line %d, column %d\n", \ | |
1366 (PCB).error_message, (PCB).line, (PCB).column) | |
1367 #endif | |
1368 | |
1369 #ifndef FIRST_LINE | |
1370 #define FIRST_LINE 1 | |
1371 #endif | |
1372 | |
1373 #ifndef FIRST_COLUMN | |
1374 #define FIRST_COLUMN 1 | |
1375 #endif | |
1376 | |
1377 #ifndef PARSER_STACK_OVERFLOW | |
1378 #define PARSER_STACK_OVERFLOW {fprintf(stderr, \ | |
1379 "\nParser stack overflow, line %d, column %d\n",\ | |
1380 (PCB).line, (PCB).column);} | |
1381 #endif | |
1382 | |
1383 #ifndef REDUCTION_TOKEN_ERROR | |
1384 #define REDUCTION_TOKEN_ERROR {fprintf(stderr, \ | |
1385 "\nReduction token error, line %d, column %d\n", \ | |
1386 (PCB).line, (PCB).column);} | |
1387 #endif | |
1388 | |
1389 | |
1390 typedef enum | |
1391 {ag_accept_key, ag_set_key, ag_jmp_key, ag_end_key, ag_no_match_key, | |
1392 ag_cf_accept_key, ag_cf_set_key, ag_cf_end_key} key_words; | |
1393 | |
1394 #ifndef GET_INPUT | |
1395 #define GET_INPUT ((PCB).input_code = getchar()) | |
1396 #endif | |
1397 | |
1398 | |
1399 static int ag_look_ahead(void) { | |
1400 if ((PCB).rx < (PCB).fx) { | |
1401 return CONVERT_CASE((PCB).lab[(PCB).rx++]); | |
1402 } | |
1403 GET_INPUT; | |
1404 (PCB).fx++; | |
1405 return CONVERT_CASE((PCB).lab[(PCB).rx++] = (PCB).input_code); | |
1406 } | |
1407 | |
1408 static void ag_get_key_word(int ag_k) { | |
1409 int save_index = (PCB).rx; | |
1410 const unsigned char *sp; | |
1411 int ag_ch; | |
1412 while (1) { | |
1413 switch (ag_key_act[ag_k]) { | |
1414 case ag_cf_end_key: | |
1415 sp = ag_key_ends + ag_key_jmp[ag_k]; | |
1416 do { | |
1417 if ((ag_ch = *sp++) == 0) { | |
1418 int ag_k1 = ag_key_parm[ag_k]; | |
1419 int ag_k2 = ag_key_pt[ag_k1]; | |
1420 if (ag_key_itt[ag_k2 + ag_look_ahead()]) goto ag_fail; | |
1421 (PCB).rx--; | |
1422 (PCB).token_number = (ts_token_type) ag_key_pt[ag_k1 + 1]; | |
1423 return; | |
1424 } | |
1425 } while (ag_look_ahead() == ag_ch); | |
1426 goto ag_fail; | |
1427 case ag_end_key: | |
1428 sp = ag_key_ends + ag_key_jmp[ag_k]; | |
1429 do { | |
1430 if ((ag_ch = *sp++) == 0) { | |
1431 (PCB).token_number = (ts_token_type) ag_key_parm[ag_k]; | |
1432 return; | |
1433 } | |
1434 } while (ag_look_ahead() == ag_ch); | |
1435 case ag_no_match_key: | |
1436 ag_fail: | |
1437 (PCB).rx = save_index; | |
1438 return; | |
1439 case ag_cf_set_key: { | |
1440 int ag_k1 = ag_key_parm[ag_k]; | |
1441 int ag_k2 = ag_key_pt[ag_k1]; | |
1442 ag_k = ag_key_jmp[ag_k]; | |
1443 if (ag_key_itt[ag_k2 + (ag_ch = ag_look_ahead())]) break; | |
1444 save_index = --(PCB).rx; | |
1445 (PCB).token_number = (ts_token_type) ag_key_pt[ag_k1+1]; | |
1446 break; | |
1447 } | |
1448 case ag_set_key: | |
1449 save_index = (PCB).rx; | |
1450 (PCB).token_number = (ts_token_type) ag_key_parm[ag_k]; | |
1451 case ag_jmp_key: | |
1452 ag_k = ag_key_jmp[ag_k]; | |
1453 ag_ch = ag_look_ahead(); | |
1454 break; | |
1455 case ag_accept_key: | |
1456 (PCB).token_number = (ts_token_type) ag_key_parm[ag_k]; | |
1457 return; | |
1458 case ag_cf_accept_key: { | |
1459 int ag_k1 = ag_key_parm[ag_k]; | |
1460 int ag_k2 = ag_key_pt[ag_k1]; | |
1461 if (ag_key_itt[ag_k2 + ag_look_ahead()]) (PCB).rx = save_index; | |
1462 else { | |
1463 (PCB).rx--; | |
1464 (PCB).token_number = (ts_token_type) ag_key_pt[ag_k1+1]; | |
1465 } | |
1466 return; | |
1467 } | |
1468 default: | |
1469 /* not reachable; here to suppress compiler warnings */ | |
1470 goto ag_fail; | |
1471 } | |
1472 if (ag_ch <= 255) while (ag_key_ch[ag_k] < ag_ch) ag_k++; | |
1473 if (ag_ch > 255 || ag_key_ch[ag_k] != ag_ch) { | |
1474 (PCB).rx = save_index; | |
1475 return; | |
1476 } | |
1477 } | |
1478 } | |
1479 | |
1480 | |
1481 #ifndef AG_NEWLINE | |
1482 #define AG_NEWLINE 10 | |
1483 #endif | |
1484 | |
1485 #ifndef AG_RETURN | |
1486 #define AG_RETURN 13 | |
1487 #endif | |
1488 | |
1489 #ifndef AG_FORMFEED | |
1490 #define AG_FORMFEED 12 | |
1491 #endif | |
1492 | |
1493 #ifndef AG_TABCHAR | |
1494 #define AG_TABCHAR 9 | |
1495 #endif | |
1496 | |
1497 static void ag_track(void) { | |
1498 int ag_k = 0; | |
1499 while (ag_k < (PCB).rx) { | |
1500 int ag_ch = (PCB).lab[ag_k++]; | |
1501 switch (ag_ch) { | |
1502 case AG_NEWLINE: | |
1503 (PCB).column = 1, (PCB).line++; | |
1504 case AG_RETURN: | |
1505 case AG_FORMFEED: | |
1506 break; | |
1507 case AG_TABCHAR: | |
1508 (PCB).column += (TAB_SPACING) - ((PCB).column - 1) % (TAB_SPACING); | |
1509 break; | |
1510 default: | |
1511 (PCB).column++; | |
1512 } | |
1513 } | |
1514 ag_k = 0; | |
1515 while ((PCB).rx < (PCB).fx) (PCB).lab[ag_k++] = (PCB).lab[(PCB).rx++]; | |
1516 (PCB).fx = ag_k; | |
1517 (PCB).rx = 0; | |
1518 } | |
1519 | |
1520 | |
1521 static void ag_prot(void) { | |
1522 int ag_k; | |
1523 ag_k = 128 - ++(PCB).btsx; | |
1524 if (ag_k <= (PCB).ssx) { | |
1525 ag_trace_error(); | |
1526 (PCB).exit_flag = AG_STACK_ERROR_CODE; | |
1527 PARSER_STACK_OVERFLOW; | |
1528 return; | |
1529 } | |
1530 (PCB).bts[(PCB).btsx] = (PCB).sn; | |
1531 (PCB).bts[ag_k] = (PCB).ssx; | |
1532 (PCB).vs[ag_k] = (PCB).vs[(PCB).ssx]; | |
1533 (PCB).ss[ag_k] = (PCB).ss[(PCB).ssx]; | |
1534 (PCB).cs[ag_k] = (PCB).cs[(PCB).ssx]; | |
1535 } | |
1536 | |
1537 static void ag_undo(void) { | |
1538 if ((PCB).drt == -1) return; | |
1539 while ((PCB).btsx) { | |
1540 int ag_k = 128 - (PCB).btsx; | |
1541 (PCB).sn = (PCB).bts[(PCB).btsx--]; | |
1542 (PCB).ssx = (PCB).bts[ag_k]; | |
1543 (PCB).vs[(PCB).ssx] = (PCB).vs[ag_k]; | |
1544 (PCB).ss[(PCB).ssx] = (PCB).ss[ag_k]; | |
1545 (PCB).cs[(PCB).ssx] = (PCB).cs[ag_k]; | |
1546 } | |
1547 (PCB).token_number = (ts_token_type) (PCB).drt; | |
1548 (PCB).ssx = (PCB).dssx; | |
1549 (PCB).sn = (PCB).dsn; | |
1550 (PCB).drt = -1; | |
1551 } | |
1552 | |
1553 | |
1554 | |
1555 static const int ag_rtt[] = { | |
1556 26, 28, 0, 26, 28, 0, 26, 28, 0, 27, 30, 0, 78, 79, 80, 82, 0, 96, | |
1557 98, 0 | |
1558 }; | |
1559 | |
1560 static const unsigned char ag_tstt[] = { | |
1561 151,150,149,148,144,140,136,133,129,126,125,118,117,113,112,111,110,109,108, | |
1562 107,106,105,104,103,102,101,100,95,94,72,70,68,56,31,12,0,2,5,6,7,8,9, | |
1563 10,11,13,14,18,19,20,21,24,26,28,59,62,74,75,76,77,78,79,80,82,88,89,90, | |
1564 96,98,114,116,119,121,122,123,130,131,132,135,139,143, | |
1565 136,0, | |
1566 149,133,126,125,106,0,120, | |
1567 149,133,126,125,0,120, | |
1568 150,149,133,126,125,117,0, | |
1569 149,133,126,125,106,0,120, | |
1570 149,133,125,106,0, | |
1571 152,151,150,149,148,144,140,136,133,129,126,125,118,117,113,112,111,110,109, | |
1572 108,107,106,105,104,103,102,101,100,99,95,94,72,70,68,56,31,0,96,98, | |
1573 113,102,0, | |
1574 102,0, | |
1575 102,0, | |
1576 102,0, | |
1577 109,102,0, | |
1578 108,102,0, | |
1579 104,102,0, | |
1580 102,0, | |
1581 102,0, | |
1582 149,133,125,106,0, | |
1583 102,0, | |
1584 104,103,102,0, | |
1585 102,101,0, | |
1586 152,151,150,149,148,144,140,136,133,129,126,125,118,117,113,112,111,110,109, | |
1587 108,107,106,105,104,103,102,101,95,72,70,68,56,31,0, | |
1588 152,151,150,149,148,144,140,136,133,129,126,125,118,117,113,112,111,110,109, | |
1589 108,107,106,105,104,103,102,101,95,72,70,68,56,31,0, | |
1590 151,150,149,136,133,129,126,125,118,117,0, | |
1591 129,118,0,128, | |
1592 129,118,0,128, | |
1593 129,118,0,128, | |
1594 118,117,0,115, | |
1595 94,0, | |
1596 100,95,68,0,4,14,32,96,97,98, | |
1597 100,95,68,0,4,14,32,96,97,98, | |
1598 94,0,5,13, | |
1599 94,0,5,13, | |
1600 151,150,149,148,144,140,136,133,129,126,125,118,117,113,112,111,110,109,108, | |
1601 107,106,105,104,103,102,101,100,95,94,72,70,68,56,31,12,0,1,14,59,66,67, | |
1602 73,74,75,76,88,89,90,96,98,114,116,119,121,122,123,130,131,132,135,139, | |
1603 143, | |
1604 100,95,94,63,51,50,49,48,46,39,38,37,31,12,0,4,14,32,96,97,98, | |
1605 151,150,149,148,144,140,136,133,129,126,125,118,117,113,112,111,110,109,108, | |
1606 107,106,105,104,103,102,101,100,95,72,70,68,56,31,0,2,14,18,59,74,75,76, | |
1607 77,78,79,80,82,88,89,90,96,98,114,116,119,121,122,123,130,131,132,135, | |
1608 139,143, | |
1609 100,95,94,0,13,14,15,16,17,96,98, | |
1610 151,150,149,148,144,140,136,133,129,126,125,118,117,113,112,111,110,109,108, | |
1611 107,106,105,104,103,102,101,100,95,72,70,68,56,31,0,2,14,59,74,75,76,77, | |
1612 78,79,80,82,88,89,90,96,98,114,116,119,121,122,123,130,131,132,135,139, | |
1613 143, | |
1614 151,150,149,148,144,140,136,133,129,126,125,118,117,113,112,111,110,109,108, | |
1615 107,106,105,104,103,102,101,100,95,72,70,68,56,31,0,2,6,8,14,18,19,20, | |
1616 21,24,26,28,59,62,74,75,76,77,78,79,80,82,88,89,90,96,98,114,116,119, | |
1617 121,122,123,130,131,132,135,139,143, | |
1618 94,0,5,13, | |
1619 12,0, | |
1620 150,149,133,126,125,117,0, | |
1621 149,133,125,108,103,0,127, | |
1622 149,133,125,0, | |
1623 149,133,125,0, | |
1624 149,133,125,0, | |
1625 102,0, | |
1626 102,0, | |
1627 106,0, | |
1628 152,151,150,149,148,144,140,136,133,129,126,125,118,117,113,112,111,110,109, | |
1629 108,107,106,105,104,103,102,101,95,94,72,70,68,56,31,0, | |
1630 152,151,150,149,148,144,140,136,133,129,126,125,118,117,113,112,111,110,109, | |
1631 108,107,106,105,104,103,102,101,95,94,72,70,68,56,31,0, | |
1632 100,95,0,14,96,98, | |
1633 151,150,136,129,126,118,117,0,59, | |
1634 68,0, | |
1635 68,0, | |
1636 152,151,150,149,148,144,140,136,133,129,126,125,118,117,113,112,111,110,109, | |
1637 108,107,106,105,104,103,102,101,95,72,70,68,56,31,0,22,25,27,29,30,35, | |
1638 36,54, | |
1639 151,150,149,148,144,140,136,133,129,126,125,118,117,113,112,111,110,109,108, | |
1640 107,106,105,104,103,102,101,100,95,72,70,68,56,31,0,2,6,8,14,18,19,20, | |
1641 21,22,23,24,26,28,44,59,62,74,75,76,77,78,79,80,82,88,89,90,96,98,114, | |
1642 116,119,121,122,123,130,131,132,135,139,143, | |
1643 151,150,149,136,133,129,126,125,118,117,0, | |
1644 31,0, | |
1645 151,150,149,148,144,140,136,133,129,126,125,118,117,113,112,111,110,109,108, | |
1646 107,106,105,104,103,102,101,100,95,72,70,68,56,31,0,1,14,59,73,74,75,76, | |
1647 88,89,90,96,98,114,116,119,121,122,123,130,131,132,135,139,143, | |
1648 94,63,51,50,49,48,46,39,38,37,12,0,60,64,65, | |
1649 31,0, | |
1650 151,150,149,148,144,140,136,133,129,126,125,118,117,113,112,111,110,109,108, | |
1651 107,106,105,104,103,102,101,100,95,72,70,68,56,31,0,2,14,59,74,75,76,77, | |
1652 78,79,80,82,88,89,90,96,98,114,116,119,121,122,123,130,131,132,135,139, | |
1653 143, | |
1654 100,95,94,0,13,14,15,96,98, | |
1655 149,133,125,0, | |
1656 149,133,125,0, | |
1657 151,150,149,136,133,129,126,125,118,117,0, | |
1658 151,150,136,129,126,118,117,100,95,0,4,14,32,96,97,98, | |
1659 151,150,149,148,144,140,136,133,129,126,125,118,117,113,112,111,110,109,108, | |
1660 107,106,105,104,103,102,101,100,95,70,68,31,0,4,14,32,96,97,98, | |
1661 152,151,150,149,148,144,140,136,133,129,126,125,118,117,113,112,111,110,109, | |
1662 108,107,106,105,104,103,102,101,95,94,72,70,68,56,31,0, | |
1663 152,151,150,149,148,144,140,136,133,129,126,125,118,117,113,112,111,110,109, | |
1664 108,107,106,105,104,103,102,101,95,94,72,70,68,56,31,0,41,42,43, | |
1665 94,0,5,13, | |
1666 94,0,5,13, | |
1667 100,95,94,51,50,49,48,47,46,45,39,38,37,34,33,0,4,14,32,96,97,98, | |
1668 94,0,5,13, | |
1669 100,95,94,63,51,50,49,48,46,45,39,38,37,34,33,31,0,4,14,32,96,97,98, | |
1670 100,95,0,4,14,96,97,98, | |
1671 152,151,150,149,148,144,140,136,133,129,126,125,118,117,113,112,111,110,109, | |
1672 108,107,106,105,104,103,102,101,95,94,72,70,68,56,31,12,0,41,42,43, | |
1673 100,95,0,4,14,96,97,98, | |
1674 100,95,0,4,14,96,97,98, | |
1675 151,150,149,148,144,140,136,133,129,126,125,118,117,113,112,111,110,109,108, | |
1676 107,106,105,104,103,102,101,100,95,72,70,68,56,31,0,2,14,18,59,74,75,76, | |
1677 77,78,79,80,82,88,89,90,96,98,114,116,119,121,122,123,130,131,132,135, | |
1678 139,143, | |
1679 100,95,0,4,14,96,97,98, | |
1680 100,95,0,4,14,96,97,98, | |
1681 151,150,136,129,126,118,117,0,59, | |
1682 151,150,149,148,144,140,136,133,129,126,125,118,117,113,112,111,110,109,108, | |
1683 107,106,105,104,103,102,101,70,68,31,0,81,83, | |
1684 152,151,150,149,148,144,140,136,133,129,126,125,118,117,113,112,111,110,109, | |
1685 108,107,106,105,104,103,102,101,95,94,72,70,68,56,31,0, | |
1686 152,151,150,149,148,144,140,136,133,129,126,125,118,117,113,112,111,110,109, | |
1687 108,107,106,105,104,103,102,101,95,72,70,68,56,31,0,41, | |
1688 152,151,150,149,148,144,140,136,133,129,126,125,118,117,113,112,111,110,109, | |
1689 108,107,106,105,104,103,102,101,95,72,70,68,56,31,0,22,29,35,36,44,54, | |
1690 151,150,149,148,144,140,136,133,129,126,125,118,117,113,112,111,110,109,108, | |
1691 107,106,105,104,103,102,101,100,95,72,70,68,56,31,0,2,6,8,14,18,19,20, | |
1692 21,22,24,26,28,59,62,74,75,76,77,78,79,80,82,88,89,90,96,98,114,116,119, | |
1693 121,122,123,130,131,132,135,139,143, | |
1694 94,51,50,49,48,47,46,45,39,38,37,34,33,0,40,52,53,61, | |
1695 152,151,150,149,148,144,140,136,133,129,126,125,118,117,113,112,111,110,109, | |
1696 108,107,106,105,104,103,102,101,95,72,70,68,56,31,0,22,29,35,36,44,54, | |
1697 94,63,51,50,49,48,46,45,39,38,37,34,33,0,60,64,65, | |
1698 151,150,136,129,126,118,117,0,59, | |
1699 151,150,136,129,126,118,117,0,59, | |
1700 151,150,149,148,144,140,136,133,129,126,125,118,117,113,112,111,110,109,108, | |
1701 107,106,105,104,103,102,101,100,95,72,70,68,56,31,0,2,14,59,74,75,76,77, | |
1702 78,79,80,82,88,89,90,96,98,114,116,119,121,122,123,130,131,132,135,139, | |
1703 143, | |
1704 151,150,136,129,126,118,117,0,59, | |
1705 151,150,136,129,126,118,117,0,59, | |
1706 151,150,149,136,133,129,126,125,118,117,100,95,70,0,4,14,32,96,97,98, | |
1707 151,150,149,148,144,140,136,133,129,126,125,118,117,113,112,111,110,109,108, | |
1708 107,106,105,104,103,102,101,68,31,0,84,85, | |
1709 70,0, | |
1710 100,95,94,51,50,49,48,47,46,45,39,38,37,34,33,0,4,14,32,96,97,98, | |
1711 100,95,94,63,51,50,49,48,46,39,38,37,34,31,0,4,14,32,96,97,98, | |
1712 100,95,0,4,14,96,97,98, | |
1713 151,150,149,148,144,140,136,133,129,126,125,118,117,113,112,111,110,109,108, | |
1714 107,106,105,104,103,102,101,100,95,72,70,68,56,31,0,2,14,18,59,74,75,76, | |
1715 77,78,79,80,82,88,89,90,96,98,114,116,119,121,122,123,130,131,132,135, | |
1716 139,143, | |
1717 152,151,150,149,148,144,140,136,133,129,126,125,118,117,113,112,111,110,109, | |
1718 108,107,106,105,104,103,102,101,95,94,72,70,68,56,31,0,41,42,43, | |
1719 152,151,150,149,148,144,140,136,133,129,126,125,118,117,113,112,111,110,109, | |
1720 108,107,106,105,104,103,102,101,95,94,72,70,68,56,31,0,41,42,43, | |
1721 100,95,94,12,0,4,14,32,96,97,98, | |
1722 100,95,94,0,4,14,32,96,97,98, | |
1723 100,95,94,0,4,14,32,96,97,98, | |
1724 152,151,150,149,148,144,140,136,133,129,126,125,118,117,113,112,111,110,109, | |
1725 108,107,106,105,104,103,102,101,95,94,72,70,68,56,31,0,41,42,43, | |
1726 151,150,149,136,133,129,126,125,118,117,68,0, | |
1727 151,150,149,136,133,129,126,125,118,117,100,95,94,12,0,4,14,32,96,97,98, | |
1728 151,150,149,136,133,129,126,125,118,117,100,95,94,0,4,14,32,96,97,98, | |
1729 151,150,149,136,133,129,126,125,118,117,100,95,94,0,4,14,32,96,97,98, | |
1730 70,0, | |
1731 151,150,149,148,144,140,136,133,129,126,125,118,117,113,112,111,110,109,108, | |
1732 107,106,105,104,103,102,101,68,31,0,3,59,75,76,86,88,89,90,92,114,116, | |
1733 119,121,122,123,130,131,132,135,139,143, | |
1734 72,0, | |
1735 94,51,50,49,48,47,46,45,39,38,37,34,33,0,40,52,53, | |
1736 94,63,51,50,49,48,46,39,38,37,34,0,60,64,65, | |
1737 151,150,149,148,144,140,136,133,129,126,125,118,117,113,112,111,110,109,108, | |
1738 107,106,105,104,103,102,101,100,95,72,70,68,56,31,0,2,14,59,74,75,76,77, | |
1739 78,79,80,82,88,89,90,96,98,114,116,119,121,122,123,130,131,132,135,139, | |
1740 143, | |
1741 151,150,136,129,126,118,117,100,95,70,0,4,14,32,96,97,98, | |
1742 113,102,0, | |
1743 102,0, | |
1744 102,0, | |
1745 102,0, | |
1746 109,102,0, | |
1747 108,102,0, | |
1748 104,102,0, | |
1749 102,0, | |
1750 102,0, | |
1751 149,133,125,106,0, | |
1752 102,0, | |
1753 104,103,102,0, | |
1754 102,101,0, | |
1755 151,150,149,148,144,140,136,133,129,126,125,118,117,113,112,111,110,109,108, | |
1756 107,106,105,104,103,102,101,100,95,72,70,68,31,0,3,14,59,75,76,87,88,89, | |
1757 90,92,96,98,114,116,119,121,122,123,130,131,132,135,139,143, | |
1758 151,150,149,136,133,129,126,125,118,117,0, | |
1759 151,150,149,148,144,140,136,133,129,126,125,118,117,113,112,111,110,109,108, | |
1760 107,106,105,104,103,102,101,100,95,68,31,0,3,14,59,75,76,87,88,89,90,92, | |
1761 96,98,114,116,119,121,122,123,130,131,132,135,139,143, | |
1762 151,150,149,148,144,140,136,133,129,126,125,118,117,113,112,111,110,109,108, | |
1763 107,106,105,104,103,102,101,100,95,68,31,0,4,14,32,96,97,98, | |
1764 151,150,136,129,126,118,117,70,0,59,69,71, | |
1765 151,150,149,148,144,140,136,133,129,126,125,118,117,113,112,111,110,109,108, | |
1766 107,106,105,104,103,102,101,68,31,0,85, | |
1767 151,150,149,136,133,129,126,125,118,117,0, | |
1768 100,95,72,70,0,4,14,32,96,97,98, | |
1769 70,0, | |
1770 151,150,149,148,144,140,136,133,129,126,125,118,117,113,112,111,110,109,108, | |
1771 107,106,105,104,103,102,101,68,31,0,3,59,75,76,86,88,89,90,92,114,116, | |
1772 119,121,122,123,130,131,132,135,139,143, | |
1773 72,0, | |
1774 151,150,149,148,144,140,136,133,129,126,125,118,117,113,112,111,110,109,108, | |
1775 107,106,105,104,103,102,101,100,95,68,31,0,3,14,59,75,76,87,88,89,90,92, | |
1776 96,98,114,116,119,121,122,123,130,131,132,135,139,143, | |
1777 151,150,136,129,126,118,117,100,95,0,4,14,32,96,97,98, | |
1778 151,150,136,129,126,118,117,0,59, | |
1779 151,150,149,136,133,129,126,125,118,117,0, | |
1780 | |
1781 }; | |
1782 | |
1783 | |
1784 static unsigned const char ag_astt[2705] = { | |
1785 2,2,2,2,2,2,2,1,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3,1,2,2,2,1,1,8,7,1, | |
1786 1,1,0,1,1,1,1,1,3,1,1,1,1,1,1,1,1,1,3,3,3,3,2,2,1,1,2,2,3,2,1,1,1,1,1,1,1, | |
1787 1,1,1,1,1,1,1,4,10,10,1,10,2,7,1,10,10,1,10,5,1,10,10,10,10,10,10,5,10,10, | |
1788 1,10,2,5,1,10,10,2,3,5,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, | |
1789 3,1,3,3,3,3,3,3,3,3,7,2,1,2,2,4,2,4,2,4,2,4,1,2,4,2,2,4,1,2,4,2,4,2,4,2,2, | |
1790 2,1,4,2,4,2,2,2,4,2,2,4,10,10,10,10,10,2,10,10,10,10,10,10,10,10,10,10,10, | |
1791 10,10,10,10,10,10,10,10,10,10,10,10,10,10,1,10,7,10,10,10,10,10,10,2,10,10, | |
1792 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,1,10,7, | |
1793 10,10,10,10,10,10,10,10,10,10,4,2,2,4,3,2,2,4,3,2,2,4,3,2,2,5,2,3,7,1,1,8, | |
1794 7,1,1,1,2,1,1,1,1,8,7,1,1,1,2,1,1,1,7,1,1,1,7,1,1,2,2,2,2,2,2,2,1,2,2,2,2, | |
1795 2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,5,2,2,2,1,1,5,7,1,2,1,1,2,3,3,3,3,2,2,3,2, | |
1796 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,5,8,8,8,8,8,8,8,8,8,2,5,7,1,1,1,2,1,1,2,2,2, | |
1797 2,2,2,2,1,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3,2,2,2,1,1,7,1,3,1,1,3,3, | |
1798 3,3,2,2,1,1,2,2,3,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,5,1,1,1,1,3,2,1,2,2,2, | |
1799 2,2,2,2,1,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3,2,2,2,1,1,4,3,3,1,3,3,3, | |
1800 3,2,2,1,1,2,2,3,2,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,1,2,2,2,2,2,1,1, | |
1801 1,1,1,1,1,1,1,1,1,1,1,1,3,2,2,2,1,1,5,1,1,3,3,1,3,3,1,1,1,1,1,1,3,3,3,3,2, | |
1802 2,1,1,2,2,3,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,5,3,1,3,7,2,2,2,2,2,2,7,8,8,8,1, | |
1803 1,7,1,10,10,10,5,10,10,10,5,10,10,10,5,2,4,2,4,2,7,2,2,2,2,2,2,2,2,2,2,2,2, | |
1804 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,2,2,2,2,2,7,2,2,2,2,2,2,2,2,2,2,2,2,2,2, | |
1805 2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,2,2,2,2,2,7,1,9,5,3,2,1,2,2,2,2,2,2,2,5,1,1, | |
1806 7,1,4,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,7, | |
1807 3,1,3,3,3,3,1,1,2,2,2,2,2,2,2,1,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3,2, | |
1808 2,2,1,1,7,1,1,3,3,1,3,3,1,3,1,1,1,1,1,1,1,3,3,3,3,2,2,1,1,2,2,3,2,1,1,1,1, | |
1809 1,1,1,1,1,1,1,1,1,10,10,10,10,10,10,10,10,10,10,4,2,4,2,2,2,2,2,2,2,1,2,2, | |
1810 2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,1,1,5,3,2,1,3,3,3,3,2,2,3,2,1,1, | |
1811 1,1,1,1,1,1,1,1,1,1,1,5,1,1,1,1,2,1,1,1,1,5,7,1,1,3,2,7,2,2,2,2,2,2,2,1,2, | |
1812 2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3,2,2,2,1,1,4,3,3,1,3,3,3,3,2,2,1,1,2, | |
1813 2,3,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,9,9,5,3,3,3,2,1,2,2,2,7,2,2,2,7,10,10,10, | |
1814 10,10,10,10,10,10,10,4,8,8,8,8,8,8,8,1,1,7,1,1,1,2,1,1,8,8,8,8,8,8,8,8,8,8, | |
1815 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,1,1,5,8,8,7,1,1,1,2,1,1,3,3,3,3,3,3,3,3,3, | |
1816 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,7,1,1,1,1,1,1,1,1,1,1,1, | |
1817 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,5,1,1,1,1,1,7,1,1,3,1,7,1,1,1,7,1,1,1,1, | |
1818 5,8,8,8,8,8,8,8,8,8,8,8,8,7,1,1,1,2,1,1,1,7,1,1,1,1,5,8,8,8,8,8,8,8,8,8,8, | |
1819 8,8,2,7,1,1,1,2,1,1,1,1,7,1,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, | |
1820 1,1,1,1,1,1,1,1,1,5,1,1,1,1,1,5,7,1,1,3,1,1,7,1,1,2,1,1,1,1,7,2,1,2,1,1,2, | |
1821 2,2,2,2,2,2,1,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3,2,2,2,1,1,7,1,3,1,1, | |
1822 3,3,3,3,2,2,1,1,2,2,3,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,7,1,1,2,1,1,1,1,7,1, | |
1823 1,2,1,1,2,2,2,2,2,2,2,7,1,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, | |
1824 4,4,4,4,4,7,1,1,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, | |
1825 3,3,3,3,3,7,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9, | |
1826 1,9,5,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,1,1,1,1,1, | |
1827 7,3,3,3,1,3,1,2,2,2,2,2,2,2,1,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3,2,2, | |
1828 2,1,1,7,1,1,3,3,1,3,3,1,3,1,1,1,1,1,3,3,3,3,2,2,1,1,2,2,3,2,1,1,1,1,1,1,1, | |
1829 1,1,1,1,1,1,5,1,1,1,1,1,1,1,1,1,1,1,1,7,1,1,3,1,1,1,1,1,1,1,1,1,1,1,1,1,1, | |
1830 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,7,3,3,3,1,3,1,5,1,1,1,1,2,1,1,1,1, | |
1831 1,1,1,7,1,1,3,2,2,2,2,2,2,2,7,1,2,2,2,2,2,2,2,7,1,2,2,2,2,2,2,2,1,2,2,2,2, | |
1832 2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3,2,2,2,1,1,4,3,3,1,3,3,3,3,2,2,1,1,2,2,3,2, | |
1833 1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,7,1,2,2,2,2,2,2,2,7,1,10,10,10,10, | |
1834 10,10,10,10,10,10,1,1,8,7,1,1,1,2,1,1,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, | |
1835 4,4,4,4,4,4,4,4,4,4,7,1,1,2,7,1,1,5,8,8,8,8,8,8,8,8,8,8,8,8,7,1,1,1,2,1,1, | |
1836 1,1,5,8,8,8,8,8,8,8,8,8,8,2,7,1,1,1,2,1,1,1,1,7,2,1,2,1,1,2,2,2,2,2,2,2,1, | |
1837 2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3,2,2,2,1,1,7,1,3,1,1,3,3,3,3,2,2,1, | |
1838 1,2,2,3,2,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, | |
1839 1,1,1,1,1,1,1,1,1,5,1,1,1,1,1,7,1,1,3,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, | |
1840 1,1,1,1,1,1,1,1,1,1,5,1,1,1,1,1,7,1,1,3,1,1,5,5,7,3,1,3,2,1,1,1,1,5,7,3,1, | |
1841 3,2,1,1,1,1,5,7,3,1,3,2,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, | |
1842 1,1,1,1,1,5,1,1,1,1,1,7,1,1,3,10,10,10,10,10,10,10,10,10,10,1,4,10,10,10, | |
1843 10,10,10,10,10,10,10,1,1,5,5,7,2,1,2,2,1,1,10,10,10,10,10,10,10,10,10,10,1, | |
1844 1,5,7,2,1,2,2,1,1,10,10,10,10,10,10,10,10,10,10,1,1,5,7,2,1,2,2,1,1,2,7,2, | |
1845 2,2,2,2,2,2,1,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,7,1,1,3,3,1,2,2,3,1, | |
1846 1,1,1,1,1,1,1,1,1,1,1,1,1,4,5,1,1,1,1,1,1,1,1,1,1,1,1,7,1,1,3,5,1,1,1,1,2, | |
1847 1,1,1,1,1,7,1,1,3,2,2,2,2,2,2,2,1,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3, | |
1848 2,2,2,1,1,4,3,3,1,3,3,3,3,2,2,1,1,2,2,3,2,1,1,1,1,1,1,1,1,1,1,1,1,1,8,8,8, | |
1849 8,8,8,8,1,1,5,7,1,1,1,2,1,1,2,2,4,2,4,2,4,2,4,1,2,4,2,2,4,1,2,4,2,4,2,4,2, | |
1850 2,2,1,4,2,4,2,2,2,4,2,2,4,2,2,2,2,2,2,2,1,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1, | |
1851 1,1,1,2,10,2,2,1,7,3,2,1,3,3,3,2,2,3,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,10,10, | |
1852 10,10,10,10,10,10,10,10,4,2,2,2,2,2,2,2,1,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1, | |
1853 1,1,1,2,2,1,4,3,2,1,3,3,3,2,2,3,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,5,5,5,5,5,5, | |
1854 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,1,1,5,5,7,1,1,1,2,1,1,2,2,2,2,2,2, | |
1855 2,4,7,1,1,1,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,7,1,10, | |
1856 10,10,10,10,10,10,10,10,10,4,1,1,8,5,7,1,1,1,2,1,1,2,7,2,2,2,2,2,2,2,1,2,2, | |
1857 2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,7,1,1,3,3,1,2,2,3,1,1,1,1,1,1,1,1,1,1, | |
1858 1,1,1,1,5,2,2,2,2,2,2,2,1,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,1,4,3, | |
1859 2,1,3,3,3,2,2,3,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,8,8,8,8,8,8,8,1,1,7,1,1,1,2, | |
1860 1,1,2,2,2,2,2,2,2,7,1,10,10,10,10,10,10,10,10,10,10,4 | |
1861 }; | |
1862 | |
1863 | |
1864 static const unsigned char ag_pstt[] = { | |
1865 218,218,206,136,214,209,218,1,218,218,206,218,218,8,9,10,11,12,13,15,17,18, | |
1866 14,19,16,20,7,102,36,136,136,136,28,34,40,0,37,38,33,0,39,39,38,40,36, | |
1867 102,37,39,39,32,31,32,31,23,35,101,103,104,100,105,106,30,29,133,134, | |
1868 101,139,7,27,27,3,2,5,6,26,25,24,4,22,21, | |
1869 41,198, | |
1870 185,185,42,185,179,2,43, | |
1871 183,183,42,183,175,44, | |
1872 203,203,203,203,203,203,200, | |
1873 207,207,42,207,181,204,45, | |
1874 199,199,184,180,196, | |
1875 145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145, | |
1876 145,145,145,145,145,145,145,145,7,143,145,145,145,145,145,145,145,7,146, | |
1877 7, | |
1878 166,165,136, | |
1879 164,136, | |
1880 163,136, | |
1881 161,136, | |
1882 46,158,136, | |
1883 157,167,136, | |
1884 47,156,136, | |
1885 155,136, | |
1886 154,136, | |
1887 182,182,182,48,136, | |
1888 152,136, | |
1889 149,151,162,136, | |
1890 148,147,136, | |
1891 215,215,215,215,215,213,215,215,215,215,215,215,215,215,215,215,215,215,215, | |
1892 215,215,215,215,215,215,215,215,215,215,215,215,49,215,21, | |
1893 210,210,210,210,210,210,208,210,210,210,210,210,210,210,210,210,210,210,210, | |
1894 210,210,210,210,210,210,210,210,210,210,210,210,50,210,22, | |
1895 219,219,219,219,219,219,219,219,219,219,111, | |
1896 191,192,195,201, | |
1897 191,192,194,205, | |
1898 191,192,193,197, | |
1899 174,173,172,170, | |
1900 137,28, | |
1901 7,51,53,29,52,51,53,139,51,7, | |
1902 7,51,54,30,54,51,54,139,51,7, | |
1903 36,31,55,36, | |
1904 36,32,56,36, | |
1905 218,218,206,136,214,209,218,1,218,218,206,218,218,8,9,10,11,12,13,15,17,18, | |
1906 14,19,16,20,7,93,83,136,136,136,28,58,83,33,59,93,57,59,85,94,95,97,98, | |
1907 133,134,95,139,7,27,27,3,2,5,6,26,25,24,4,22,21, | |
1908 7,51,31,60,60,60,60,60,60,60,60,60,150,31,34,60,51,60,139,51,7, | |
1909 218,218,206,136,214,209,218,1,218,218,206,218,218,8,9,10,11,12,13,15,17,18, | |
1910 14,19,16,20,7,102,136,136,136,28,61,35,62,102,62,23,101,103,104,100,105, | |
1911 106,30,29,133,134,101,139,7,27,27,3,2,5,6,26,25,24,4,22,21, | |
1912 7,63,63,13,63,63,63,63,15,139,7, | |
1913 218,218,206,136,214,209,218,1,218,218,206,218,218,8,9,10,11,12,13,15,17,18, | |
1914 14,19,16,20,7,102,136,136,136,28,61,18,17,102,23,101,103,104,100,105, | |
1915 106,30,29,133,134,101,139,7,27,27,3,2,5,6,26,25,24,4,22,21, | |
1916 218,218,206,136,214,209,218,1,218,218,206,218,218,8,9,10,11,12,13,15,17,18, | |
1917 14,19,16,20,7,102,136,136,136,28,34,7,37,33,2,102,37,2,2,32,31,32,31,23, | |
1918 35,101,103,104,100,105,106,30,29,133,134,101,139,7,27,27,3,2,5,6,26,25, | |
1919 24,4,22,21, | |
1920 36,6,3,36, | |
1921 8,40, | |
1922 202,202,202,202,202,202,41, | |
1923 64,64,64,64,65,42,64, | |
1924 190,190,190,177, | |
1925 190,190,190,176, | |
1926 190,190,190,178, | |
1927 160,159, | |
1928 169,168, | |
1929 153,48, | |
1930 216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,216, | |
1931 216,216,216,216,216,216,216,216,216,217,216,216,216,216,216,49, | |
1932 211,211,211,211,211,211,211,211,211,211,211,211,211,211,211,211,211,211,211, | |
1933 211,211,211,211,211,211,211,211,211,212,211,211,211,211,211,50, | |
1934 7,141,142,141,139,7, | |
1935 218,218,218,218,218,218,218,32,66, | |
1936 67,53, | |
1937 68,107, | |
1938 70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70, | |
1939 70,70,70,70,70,70,69,73,55,23,72,27,29,30,29,71,70, | |
1940 218,218,206,136,214,209,218,1,218,218,206,218,218,8,9,10,11,12,13,15,17,18, | |
1941 14,19,16,20,7,102,136,136,136,28,75,56,37,33,26,102,37,26,26,32,21,74, | |
1942 31,32,31,74,23,35,101,103,104,100,105,106,30,29,133,134,101,139,7,27,27, | |
1943 3,2,5,6,26,25,24,4,22,21, | |
1944 219,219,219,219,219,219,219,219,219,219,99, | |
1945 150,96, | |
1946 218,218,206,136,214,209,218,1,218,218,206,218,218,8,9,10,11,12,13,15,17,18, | |
1947 14,19,16,20,7,93,136,136,136,28,58,84,82,93,57,94,95,97,98,133,134,95, | |
1948 139,7,27,27,3,2,5,6,26,25,24,4,22,21, | |
1949 78,78,77,77,77,86,76,81,82,79,78,60,80,77,80, | |
1950 150,61, | |
1951 218,218,206,136,214,209,218,1,218,218,206,218,218,8,9,10,11,12,13,15,17,18, | |
1952 14,19,16,20,7,102,136,136,136,28,61,73,17,102,23,101,103,104,100,105, | |
1953 106,30,29,133,134,101,139,7,27,27,3,2,5,6,26,25,24,4,22,21, | |
1954 7,12,12,14,12,12,12,139,7, | |
1955 189,189,189,64, | |
1956 186,186,186,65, | |
1957 219,219,219,219,219,219,219,219,219,219,110, | |
1958 83,83,83,83,83,83,83,7,51,67,83,51,83,139,51,7, | |
1959 84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84, | |
1960 84,7,51,31,84,84,68,84,51,84,139,51,7, | |
1961 66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66, | |
1962 66,66,66,66,66,66,66,66,66,69, | |
1963 86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86, | |
1964 86,86,86,43,86,86,86,85,86,70,86,86,62, | |
1965 36,71,87,36, | |
1966 36,72,88,36, | |
1967 7,51,31,89,89,89,89,89,89,89,89,89,89,89,89,73,89,51,89,139,51,7, | |
1968 36,74,90,36, | |
1969 7,51,31,91,91,91,91,91,91,91,91,91,91,91,91,150,75,91,51,91,139,51,7, | |
1970 7,51,76,92,51,139,51,7, | |
1971 86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86, | |
1972 86,86,86,43,86,86,86,85,86,43,77,86,86,79, | |
1973 7,51,78,93,51,139,51,7, | |
1974 7,51,79,71,51,139,51,7, | |
1975 218,218,206,136,214,209,218,1,218,218,206,218,218,8,9,10,11,12,13,15,17,18, | |
1976 14,19,16,20,7,102,136,136,136,28,61,80,94,102,94,23,101,103,104,100,105, | |
1977 106,30,29,133,134,101,139,7,27,27,3,2,5,6,26,25,24,4,22,21, | |
1978 7,51,81,95,51,139,51,7, | |
1979 7,51,82,96,51,139,51,7, | |
1980 218,218,218,218,218,218,218,83,97, | |
1981 113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113, | |
1982 113,113,113,113,113,113,113,112,113,113,84,99,98, | |
1983 64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64, | |
1984 64,64,64,64,64,64,64,64,64,85, | |
1985 42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42, | |
1986 42,42,42,42,42,42,85,42,44,42, | |
1987 70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70, | |
1988 70,70,70,70,70,70,69,100,87,37,46,46,71,47,70, | |
1989 218,218,206,136,214,209,218,1,218,218,206,218,218,8,9,10,11,12,13,15,17,18, | |
1990 14,19,16,20,7,102,136,136,136,28,101,88,37,33,34,102,37,34,34,32,24,31, | |
1991 32,31,23,35,101,103,104,100,105,106,30,29,133,134,101,139,7,27,27,3,2,5, | |
1992 6,26,25,24,4,22,21, | |
1993 59,104,104,104,104,104,104,102,105,105,105,106,107,89,105,104,61,103, | |
1994 70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70, | |
1995 70,70,70,70,70,70,69,100,90,22,50,50,71,49,70, | |
1996 78,78,77,77,77,86,76,109,81,82,79,106,108,91,80,77,80, | |
1997 218,218,218,218,218,218,218,92,110, | |
1998 218,218,218,218,218,218,218,93,111, | |
1999 218,218,206,136,214,209,218,1,218,218,206,218,218,8,9,10,11,12,13,15,17,18, | |
2000 14,19,16,20,7,102,136,136,136,28,61,69,17,102,23,101,103,104,100,105, | |
2001 106,30,29,133,134,101,139,7,27,27,3,2,5,6,26,25,24,4,22,21, | |
2002 218,218,218,218,218,218,218,95,112, | |
2003 218,218,218,218,218,218,218,96,113, | |
2004 219,219,219,219,219,219,219,219,219,219,7,51,114,97,114,51,114,139,51,7, | |
2005 117,117,117,117,117,117,117,117,117,117,117,117,117,117,117,117,117,117,117, | |
2006 117,117,117,117,117,117,117,117,117,98,116,115, | |
2007 108,99, | |
2008 7,51,31,117,117,117,117,117,117,117,117,117,117,117,117,100,117,51,117,139, | |
2009 51,7, | |
2010 7,51,31,118,118,118,118,118,118,118,118,118,118,150,101,118,51,118,139,51,7, | |
2011 7,51,102,72,51,139,51,7, | |
2012 218,218,206,136,214,209,218,1,218,218,206,218,218,8,9,10,11,12,13,15,17,18, | |
2013 14,19,16,20,7,102,136,136,136,28,61,103,119,102,119,23,101,103,104,100, | |
2014 105,106,30,29,133,134,101,139,7,27,27,3,2,5,6,26,25,24,4,22,21, | |
2015 86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86, | |
2016 86,86,86,43,86,86,86,85,86,104,86,86,60, | |
2017 86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86, | |
2018 86,86,86,43,86,86,86,85,86,105,86,86,45, | |
2019 7,51,31,31,106,35,51,35,139,51,7, | |
2020 7,51,31,107,33,51,33,139,51,7, | |
2021 7,51,31,108,52,51,52,139,51,7, | |
2022 86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86, | |
2023 86,86,86,43,86,86,86,85,86,109,86,86,51, | |
2024 219,219,219,219,219,219,219,219,219,219,120,87, | |
2025 219,219,219,219,219,219,219,219,219,219,7,51,31,31,111,74,51,74,139,51,7, | |
2026 219,219,219,219,219,219,219,219,219,219,7,51,31,112,68,51,68,139,51,7, | |
2027 219,219,219,219,219,219,219,219,219,219,7,51,31,113,67,51,67,139,51,7, | |
2028 109,114, | |
2029 218,218,206,128,214,209,218,1,218,218,206,218,218,121,122,123,124,125,126, | |
2030 128,130,131,127,132,129,133,130,61,115,136,135,123,124,136,125,126,127, | |
2031 134,27,27,3,2,5,6,26,25,24,4,22,21, | |
2032 137,114, | |
2033 59,104,104,104,104,104,104,109,105,105,105,106,108,117,105,104,61, | |
2034 78,78,77,77,77,86,76,81,82,79,106,118,80,77,80, | |
2035 218,218,206,136,214,209,218,1,218,218,206,218,218,8,9,10,11,12,13,15,17,18, | |
2036 14,19,16,20,7,102,136,136,136,28,61,70,17,102,23,101,103,104,100,105, | |
2037 106,30,29,133,134,101,139,7,27,27,3,2,5,6,26,25,24,4,22,21, | |
2038 138,138,138,138,138,138,138,7,51,31,120,138,51,138,139,51,7, | |
2039 166,165,128, | |
2040 164,128, | |
2041 163,128, | |
2042 161,128, | |
2043 46,158,128, | |
2044 157,167,128, | |
2045 47,156,128, | |
2046 155,128, | |
2047 154,128, | |
2048 182,182,182,48,128, | |
2049 152,128, | |
2050 149,151,162,128, | |
2051 148,147,128, | |
2052 218,218,206,128,214,209,218,1,218,218,206,218,218,121,122,123,124,125,126, | |
2053 128,130,131,127,132,129,133,7,120,132,129,130,61,134,131,120,135,123, | |
2054 124,131,125,126,127,134,139,7,27,27,3,2,5,6,26,25,24,4,22,21, | |
2055 219,219,219,219,219,219,219,219,219,219,122, | |
2056 218,218,206,128,214,209,218,1,218,218,206,218,218,121,122,123,124,125,126, | |
2057 128,130,131,127,132,129,133,7,120,130,61,115,119,120,135,123,124,119, | |
2058 125,126,127,134,139,7,27,27,3,2,5,6,26,25,24,4,22,21, | |
2059 31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31, | |
2060 31,7,51,31,31,137,139,51,139,139,51,7, | |
2061 218,218,218,218,218,218,218,89,138,140,142,141, | |
2062 117,117,117,117,117,117,117,117,117,117,117,117,117,117,117,117,117,117,117, | |
2063 117,117,117,117,117,117,117,117,117,139,143, | |
2064 219,219,219,219,219,219,219,219,219,219,91, | |
2065 7,51,144,31,141,144,51,144,139,51,7, | |
2066 88,142, | |
2067 218,218,206,128,214,209,218,1,218,218,206,218,218,121,122,123,124,125,126, | |
2068 128,130,131,127,132,129,133,130,61,143,145,135,123,124,145,125,126,127, | |
2069 134,27,27,3,2,5,6,26,25,24,4,22,21, | |
2070 146,90, | |
2071 218,218,206,128,214,209,218,1,218,218,206,218,218,121,122,123,124,125,126, | |
2072 128,130,131,127,132,129,133,7,120,130,61,116,119,120,135,123,124,119, | |
2073 125,126,127,134,139,7,27,27,3,2,5,6,26,25,24,4,22,21, | |
2074 147,147,147,147,147,147,147,7,51,146,147,51,147,139,51,7, | |
2075 218,218,218,218,218,218,218,147,148, | |
2076 219,219,219,219,219,219,219,219,219,219,92, | |
2077 | |
2078 }; | |
2079 | |
2080 | |
2081 static const unsigned short ag_sbt[] = { | |
2082 0, 80, 82, 89, 95, 102, 109, 114, 153, 156, 158, 160, 162, 165, | |
2083 168, 171, 173, 175, 180, 182, 186, 189, 223, 257, 268, 272, 276, 280, | |
2084 284, 286, 296, 306, 310, 314, 376, 397, 460, 471, 533, 605, 609, 611, | |
2085 618, 625, 629, 633, 637, 639, 641, 643, 678, 713, 719, 728, 730, 732, | |
2086 774, 849, 860, 862, 920, 935, 937, 999,1008,1012,1016,1027,1043,1081, | |
2087 1116,1154,1158,1162,1184,1188,1211,1219,1258,1266,1274,1337,1345,1353, | |
2088 1362,1394,1429,1464,1504,1577,1595,1635,1652,1661,1670,1732,1741,1750, | |
2089 1770,1801,1803,1825,1846,1854,1917,1955,1993,2004,2014,2024,2062,2074, | |
2090 2095,2115,2135,2137,2187,2189,2206,2221,2283,2300,2303,2305,2307,2309, | |
2091 2312,2315,2318,2320,2322,2327,2329,2333,2336,2393,2404,2459,2496,2508, | |
2092 2538,2549,2560,2562,2612,2614,2669,2685,2694,2705 | |
2093 }; | |
2094 | |
2095 | |
2096 static const unsigned short ag_sbe[] = { | |
2097 35, 81, 87, 93, 101, 107, 113, 150, 155, 157, 159, 161, 164, 167, | |
2098 170, 172, 174, 179, 181, 185, 188, 222, 256, 267, 270, 274, 278, 282, | |
2099 285, 289, 299, 307, 311, 349, 390, 430, 463, 504, 566, 606, 610, 617, | |
2100 623, 628, 632, 636, 638, 640, 642, 677, 712, 715, 726, 729, 731, 765, | |
2101 807, 859, 861, 895, 931, 936, 970,1002,1011,1015,1026,1036,1074,1115, | |
2102 1150,1155,1159,1177,1185,1204,1213,1254,1260,1268,1307,1339,1347,1360, | |
2103 1391,1428,1462,1497,1537,1590,1628,1648,1659,1668,1703,1739,1748,1763, | |
2104 1798,1802,1818,1839,1848,1887,1951,1989,1997,2007,2017,2058,2073,2088, | |
2105 2108,2128,2136,2165,2188,2202,2217,2254,2293,2302,2304,2306,2308,2311, | |
2106 2314,2317,2319,2321,2326,2328,2332,2335,2368,2403,2434,2489,2504,2536, | |
2107 2548,2553,2561,2590,2613,2644,2678,2692,2704,2705 | |
2108 }; | |
2109 | |
2110 | |
2111 static const unsigned char ag_fl[] = { | |
2112 1,1,2,2,1,0,1,1,2,1,1,1,2,0,1,2,1,2,1,1,1,3,5,3,5,1,3,3,1,3,3,0,1,4,3, | |
2113 4,1,3,1,1,1,1,2,0,1,4,3,3,1,3,3,4,4,1,1,1,1,1,1,0,2,3,2,1,2,1,2,6,6,4, | |
2114 4,2,2,2,6,1,1,1,0,2,3,1,2,0,1,2,3,5,9,0,2,1,5,1,1,1,1,1,1,1,1,1,1,1,1, | |
2115 1,1,2,6,7,3,1,0,0,2,2,5,0,1,2,1,1,1,1,1,1,1,1,1,2,1,2,2,1,1,1,1,2,1,1, | |
2116 1,2,1,2,1,2,2,2,2,2,2,2,2,3,2,2,2,2,2,2,3,2,2,2,2,2,2,2,2,3,2,1,0,1,1, | |
2117 1,2,2,2,2,2,2,2,2,2,2,3,0,1,3,2,1,1,1,1,1,1,2,1,2,1,2,3,2,1,2,1,2,2,1, | |
2118 2,3,3,2,1,2,3,3,1,2,1 | |
2119 }; | |
2120 | |
2121 static const unsigned char ag_ptt[] = { | |
2122 0, 9, 9, 10, 10, 11, 11, 11, 7, 15, 15, 16, 16, 17, 17, 5, 18, 18, | |
2123 8, 8, 8, 20, 20, 20, 20, 21, 21, 21, 24, 24, 24, 32, 32, 25, 25, 22, | |
2124 29, 29, 40, 40, 40, 42, 42, 43, 43, 36, 36, 36, 23, 23, 23, 44, 44, 52, | |
2125 52, 52, 52, 52, 52, 53, 53, 35, 35, 41, 41, 54, 54, 26, 26, 26, 27, 60, | |
2126 61, 19, 19, 64, 64, 64, 65, 65, 19, 66, 66, 67, 67, 19, 62, 6, 6, 69, | |
2127 69, 71, 71, 1, 1, 1, 1, 1, 1, 73, 2, 2, 2, 2, 2, 77, 77, 77, | |
2128 77, 77, 77, 78, 81, 83, 81, 84, 84, 85, 86, 86, 87, 87, 3, 3, 3, 3, | |
2129 3, 3, 3, 3, 92, 92, 92, 74, 74, 74, 74, 74, 14, 14, 97, 97, 4, 96, | |
2130 98, 98, 96, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, | |
2131 90, 90, 90, 90, 90, 90, 90, 90, 75,114,115,115,115,116,116,116,116,119, | |
2132 119,119,119,119,121,121,120,127,127,120,120,128,128, 76, 76, 76,130,130, | |
2133 123,123,132,132,135,135,131,131,122,122, 88,139,139,139,139, 89,143,143, | |
2134 143,143, 59, 59, 13 | |
2135 }; | |
2136 | |
2137 static const unsigned char *ag_valid(int ag_k) { | |
2138 const unsigned char *ag_tp = &ag_tstt[ag_sbt[(PCB).sn+1]]; | |
2139 while (*--ag_tp != (unsigned char) ag_k) if (*ag_tp == 0) return NULL; | |
2140 return ag_tp; | |
2141 } | |
2142 | |
2143 int ts_change_reduction(ts_token_type ag_k) { | |
2144 if (!ag_valid(ag_k)) return 0; | |
2145 (PCB).reduction_token = ag_k; | |
2146 return 1; | |
2147 } | |
2148 | |
2149 static void ag_default(const int *ag_tp) { | |
2150 (PCB).ag_dsn = (PCB).sn; | |
2151 (PCB).ag_dtl = ag_tp; | |
2152 while (!ag_valid((ts_token_type) *ag_tp)) ag_tp++; | |
2153 (PCB).reduction_token = (ts_token_type) *ag_tp; | |
2154 } | |
2155 | |
2156 | |
2157 | |
2158 static void ag_ra(void) | |
2159 { | |
2160 switch(ag_rpx[(PCB).ag_ap]) { | |
2161 case 1: ag_rp_1(); break; | |
2162 case 2: ag_default(&ag_rtt[0]); ag_rp_2(); break; | |
2163 case 3: ag_default(&ag_rtt[3]); ag_rp_3(); break; | |
2164 case 4: ag_default(&ag_rtt[6]); ag_rp_4(); break; | |
2165 case 5: ag_default(&ag_rtt[9]); ag_rp_5(); break; | |
2166 case 6: ag_rp_6(); break; | |
2167 case 7: ag_rp_7(); break; | |
2168 case 8: ag_rp_8(); break; | |
2169 case 9: ag_rp_9(); break; | |
2170 case 10: ag_rp_10(V(0,(int *))); break; | |
2171 case 11: ag_rp_11(); break; | |
2172 case 12: V(0,(int *)) = ag_rp_12(); break; | |
2173 case 13: V(0,(int *)) = ag_rp_13(V(7,(int *))); break; | |
2174 case 14: V(0,(int *)) = ag_rp_14(); break; | |
2175 case 15: V(0,(int *)) = ag_rp_15(); break; | |
2176 case 16: V(0,(int *)) = ag_rp_16(V(0,(int *))); break; | |
2177 case 17: ag_rp_17(V(0,(int *))); break; | |
2178 case 18: ag_rp_18(); break; | |
2179 case 19: ag_rp_19(); break; | |
2180 case 20: ag_rp_20(V(0,(token *))); break; | |
2181 case 21: ag_rp_21(V(0,(token *))); break; | |
2182 case 22: ag_rp_22(V(0,(token *))); break; | |
2183 case 23: ag_rp_23(V(0,(token *)), V(4,(int *))); break; | |
2184 case 24: ag_rp_24(); break; | |
2185 case 25: ag_rp_25(); break; | |
2186 case 26: ag_default(&ag_rtt[12]); V(0,(token *)) = ag_rp_26(); break; | |
2187 case 27: V(0,(int *)) = ag_rp_27(); break; | |
2188 case 28: ag_rp_28(); break; | |
2189 case 29: V(0,(int *)) = ag_rp_29(V(1,(int *))); break; | |
2190 case 30: V(0,(int *)) = ag_rp_30(); break; | |
2191 case 31: V(0,(int *)) = ag_rp_31(V(0,(int *))); break; | |
2192 case 32: ag_rp_32(); break; | |
2193 case 33: ag_rp_33(V(0,(int *))); break; | |
2194 case 34: ag_rp_34(); break; | |
2195 case 35: ag_rp_35(); break; | |
2196 case 36: ag_rp_36(); break; | |
2197 case 37: ag_rp_37(V(0,(int *))); break; | |
2198 case 38: ag_rp_38(V(1,(int *))); break; | |
2199 case 39: ag_rp_39(V(0,(int *))); break; | |
2200 case 40: ag_rp_40(V(1,(int *))); break; | |
2201 case 41: ag_rp_41(); break; | |
2202 case 42: ag_rp_42(); break; | |
2203 case 43: ag_rp_43(V(0,(int *))); break; | |
2204 case 44: V(0,(int *)) = ag_rp_44(); break; | |
2205 case 45: ag_default(&ag_rtt[17]); ag_rp_45(); break; | |
2206 case 46: ag_rp_46(); break; | |
2207 case 47: ag_rp_47(); break; | |
2208 case 48: ag_rp_48(); break; | |
2209 case 49: ag_rp_49(); break; | |
2210 case 50: ag_rp_50(); break; | |
2211 case 51: ag_rp_51(); break; | |
2212 case 52: ag_rp_52(); break; | |
2213 case 53: ag_rp_53(); break; | |
2214 case 54: ag_rp_54(); break; | |
2215 case 55: ag_rp_55(); break; | |
2216 case 56: ag_rp_56(); break; | |
2217 case 57: ag_rp_57(); break; | |
2218 case 58: ag_rp_58(); break; | |
2219 case 59: ag_rp_59(); break; | |
2220 case 60: ag_rp_60(); break; | |
2221 case 61: ag_rp_61(); break; | |
2222 case 62: ag_rp_62(); break; | |
2223 case 63: ag_rp_63(); break; | |
2224 case 64: ag_rp_64(); break; | |
2225 case 65: ag_rp_65(); break; | |
2226 case 66: ag_rp_66(); break; | |
2227 case 67: ag_rp_67(); break; | |
2228 case 68: ag_rp_68(); break; | |
2229 case 69: ag_rp_69(); break; | |
2230 case 70: ag_rp_70(); break; | |
2231 case 71: ag_rp_71(); break; | |
2232 case 72: ag_rp_72(); break; | |
2233 case 73: ag_rp_73(); break; | |
2234 case 74: ag_rp_74(V(1,(int *))); break; | |
2235 case 75: ag_rp_75(V(1,(int *))); break; | |
2236 case 76: ag_rp_76(V(1,(int *))); break; | |
2237 case 77: ag_rp_77(V(1,(int *))); break; | |
2238 case 78: ag_rp_78(V(2,(int *))); break; | |
2239 case 79: ag_rp_79(V(2,(int *))); break; | |
2240 case 80: ag_rp_80(V(1,(int *))); break; | |
2241 case 81: ag_rp_81(); break; | |
2242 case 82: ag_rp_82(); break; | |
2243 case 83: ag_rp_83(); break; | |
2244 case 84: ag_rp_84(); break; | |
2245 case 85: ag_rp_85(); break; | |
2246 case 86: ag_rp_86(); break; | |
2247 case 87: ag_rp_87(V(1,(int *))); break; | |
2248 case 88: ag_rp_88(V(2,(int *))); break; | |
2249 case 89: ag_rp_89(V(1,(int *))); break; | |
2250 case 90: ag_rp_90(V(0,(int *))); break; | |
2251 case 91: ag_rp_91(V(1,(int *))); break; | |
2252 case 92: ag_rp_92(); break; | |
2253 case 93: ag_rp_93(); break; | |
2254 case 94: ag_rp_94(V(1,(int *))); break; | |
2255 case 95: ag_rp_95(V(2,(int *))); break; | |
2256 case 96: ag_rp_96(); break; | |
2257 case 97: ag_rp_97(); break; | |
2258 case 98: ag_rp_98(V(1,(int *))); break; | |
2259 case 99: ag_rp_99(V(2,(int *))); break; | |
2260 case 100: ag_rp_100(V(0,(int *))); break; | |
2261 case 101: ag_rp_101(V(1,(int *))); break; | |
2262 } | |
2263 } | |
2264 | |
2265 #define TOKEN_NAMES ts_token_names | |
2266 const char *const ts_token_names[153] = { | |
2267 "input file", | |
2268 "simple token", | |
2269 "expanded token", | |
2270 "initial arg element", | |
2271 "ws", | |
2272 "eol", | |
2273 "macro definition header", | |
2274 "input file", | |
2275 "section", | |
2276 "", | |
2277 "", | |
2278 "", | |
2279 "eof", | |
2280 "newline", | |
2281 "space", | |
2282 "", | |
2283 "", | |
2284 "", | |
2285 "", | |
2286 "control line", | |
2287 "conditional block", | |
2288 "true if section", | |
2289 "endif line", | |
2290 "skip else section", | |
2291 "false if section", | |
2292 "else section", | |
2293 "true condition", | |
2294 "true else condition", | |
2295 "false condition", | |
2296 "skip section", | |
2297 "false else condition", | |
2298 "'#'", | |
2299 "", | |
2300 "\"else\"", | |
2301 "\"endif\"", | |
2302 "skip line", | |
2303 "skip if section", | |
2304 "\"if\"", | |
2305 "\"ifdef\"", | |
2306 "\"ifndef\"", | |
2307 "", | |
2308 "any text", | |
2309 "", | |
2310 "", | |
2311 "skip else line", | |
2312 "\"elif\"", | |
2313 "\"define\"", | |
2314 "\"undefine\"", | |
2315 "\"include\"", | |
2316 "\"line\"", | |
2317 "\"error\"", | |
2318 "\"pragma\"", | |
2319 "", | |
2320 "", | |
2321 "not control mark", | |
2322 "any text char", | |
2323 "'\\\\'", | |
2324 "", | |
2325 "", | |
2326 "name string", | |
2327 "if header", | |
2328 "else if header", | |
2329 "include header", | |
2330 "\"undef\"", | |
2331 "", | |
2332 "", | |
2333 "", | |
2334 "", | |
2335 "'('", | |
2336 "parameter list", | |
2337 "')'", | |
2338 "names", | |
2339 "','", | |
2340 "word", | |
2341 "separator", | |
2342 "qualified real", | |
2343 "integer constant", | |
2344 "expanded word", | |
2345 "variable", | |
2346 "simple macro", | |
2347 "macro", | |
2348 "macro arg list", | |
2349 "defined", | |
2350 "", | |
2351 "macro args", | |
2352 "increment ta", | |
2353 "arg elements", | |
2354 "arg element", | |
2355 "string literal", | |
2356 "character constant", | |
2357 "operator", | |
2358 "", | |
2359 "nested elements", | |
2360 "punctuation", | |
2361 "'\\n'", | |
2362 "blank", | |
2363 "comment", | |
2364 "", | |
2365 "comment head", | |
2366 "\"*/\"", | |
2367 "\"/*\"", | |
2368 "'&'", | |
2369 "'='", | |
2370 "'-'", | |
2371 "'>'", | |
2372 "'/'", | |
2373 "'.'", | |
2374 "'^'", | |
2375 "'+'", | |
2376 "'<'", | |
2377 "'%'", | |
2378 "'*'", | |
2379 "'!'", | |
2380 "'|'", | |
2381 "real constant", | |
2382 "floating qualifier", | |
2383 "real", | |
2384 "", | |
2385 "", | |
2386 "simple real", | |
2387 "exponent", | |
2388 "confusion", | |
2389 "decimal integer", | |
2390 "octal integer", | |
2391 "", | |
2392 "", | |
2393 "", | |
2394 "", | |
2395 "integer qualifier", | |
2396 "", | |
2397 "octal constant", | |
2398 "decimal constant", | |
2399 "hex constant", | |
2400 "'0'", | |
2401 "", | |
2402 "hex integer", | |
2403 "", | |
2404 "hex digit", | |
2405 "", | |
2406 "string chars", | |
2407 "'\\\"'", | |
2408 "string char", | |
2409 "", | |
2410 "simple chars", | |
2411 "'\\''", | |
2412 "simple char", | |
2413 "letter", | |
2414 "", | |
2415 "", | |
2416 "", | |
2417 "", | |
2418 "", | |
2419 "", | |
2420 | |
2421 }; | |
2422 | |
2423 | |
2424 static const unsigned char ag_ctn[] = { | |
2425 0,0,135,1,116,1,116,1,135,1,116,1,119,1, 96,1, 90,1, 90,1, 90,1, 90,1, | |
2426 90,1, 90,1, 90,1, 90,1, 90,1, 0,0, 90,1, 90,1, 90,1, 89,1, 88,1, 59,1, | |
2427 132,1,131,1,130,1, 75,1, 74,1, 77,1, 77,1, 20,1, 20,1, 19,1, 8,1, 19,1, | |
2428 5,1, 8,1, 10,1, 10,1, 0,0,135,2,120,1,120,1,120,1,120,1, 90,2, 90,2, | |
2429 90,2,143,2,139,2, 4,1, 77,2, 77,2, 77,2, 20,2, 20,2, 59,1, 90,1, 0,0, | |
2430 8,2, 90,1, 0,0, 0,0,120,2,120,2, 59,1, 77,3, 77,3, 54,1, 35,1, 29,1, | |
2431 25,1, 22,1, 23,1, 8,1, 6,3, 0,0, 19,3, 60,1, 28,3, 28,3, 28,3, 77,4, | |
2432 77,4, 41,1, 0,0, 29,2, 25,2, 22,2, 23,2, 8,2, 6,4, 19,4, 0,0, 28,4, | |
2433 28,4, 59,1, 81,1, 77,5, 22,1, 8,1, 61,1, 27,3, 0,0, 36,3, 22,3, 25,3, | |
2434 44,3, 44,3, 59,1, 59,1, 59,1, 59,1, 77,6, 84,1, 84,1, 22,2, 8,2, 0,0, | |
2435 6,6, 90,1, 90,1, 90,1, 90,1, 90,1, 90,1, 90,1, 90,1, 90,1, 3,1, 90,1, | |
2436 90,1, 90,1, 3,1, 59,1, 86,1, 84,2, 6,7, 84,3, 59,1, 69,1, 6,8, 84,4, | |
2437 71,2, 86,1, 71,3, 71,4, 59,1 | |
2438 }; | |
2439 | |
2440 #ifndef MISSING_FORMAT | |
2441 #define MISSING_FORMAT "Missing %s" | |
2442 #endif | |
2443 #ifndef UNEXPECTED_FORMAT | |
2444 #define UNEXPECTED_FORMAT "Unexpected %s" | |
2445 #endif | |
2446 #ifndef UNNAMED_TOKEN | |
2447 #define UNNAMED_TOKEN "input" | |
2448 #endif | |
2449 | |
2450 | |
2451 static void ag_diagnose(void) { | |
2452 int ag_snd = (PCB).sn; | |
2453 int ag_k = ag_sbt[ag_snd]; | |
2454 | |
2455 if (*TOKEN_NAMES[ag_tstt[ag_k]] && ag_astt[ag_k + 1] == ag_action_8) { | |
2456 sprintf((PCB).ag_msg, MISSING_FORMAT, TOKEN_NAMES[ag_tstt[ag_k]]); | |
2457 } | |
2458 else if (ag_astt[ag_sbe[(PCB).sn]] == ag_action_8 | |
2459 && (ag_k = (int) ag_sbe[(PCB).sn] + 1) == (int) ag_sbt[(PCB).sn+1] - 1 | |
2460 && *TOKEN_NAMES[ag_tstt[ag_k]]) { | |
2461 sprintf((PCB).ag_msg, MISSING_FORMAT, TOKEN_NAMES[ag_tstt[ag_k]]); | |
2462 } | |
2463 else if ((PCB).token_number && *TOKEN_NAMES[(PCB).token_number]) { | |
2464 sprintf((PCB).ag_msg, UNEXPECTED_FORMAT, TOKEN_NAMES[(PCB).token_number]); | |
2465 } | |
2466 else if (isprint((*(PCB).lab)) && (*(PCB).lab) != '\\') { | |
2467 char buf[20]; | |
2468 sprintf(buf, "\'%c\'", (char) (*(PCB).lab)); | |
2469 sprintf((PCB).ag_msg, UNEXPECTED_FORMAT, buf); | |
2470 } | |
2471 else sprintf((PCB).ag_msg, UNEXPECTED_FORMAT, UNNAMED_TOKEN); | |
2472 (PCB).error_message = (PCB).ag_msg; | |
2473 | |
2474 | |
2475 } | |
2476 static int ag_action_1_r_proc(void); | |
2477 static int ag_action_2_r_proc(void); | |
2478 static int ag_action_3_r_proc(void); | |
2479 static int ag_action_4_r_proc(void); | |
2480 static int ag_action_1_s_proc(void); | |
2481 static int ag_action_3_s_proc(void); | |
2482 static int ag_action_1_proc(void); | |
2483 static int ag_action_2_proc(void); | |
2484 static int ag_action_3_proc(void); | |
2485 static int ag_action_4_proc(void); | |
2486 static int ag_action_5_proc(void); | |
2487 static int ag_action_6_proc(void); | |
2488 static int ag_action_7_proc(void); | |
2489 static int ag_action_8_proc(void); | |
2490 static int ag_action_9_proc(void); | |
2491 static int ag_action_10_proc(void); | |
2492 static int ag_action_11_proc(void); | |
2493 static int ag_action_8_proc(void); | |
2494 | |
2495 | |
2496 static int (*const ag_r_procs_scan[])(void) = { | |
2497 ag_action_1_r_proc, | |
2498 ag_action_2_r_proc, | |
2499 ag_action_3_r_proc, | |
2500 ag_action_4_r_proc | |
2501 }; | |
2502 | |
2503 static int (*const ag_s_procs_scan[])(void) = { | |
2504 ag_action_1_s_proc, | |
2505 ag_action_2_r_proc, | |
2506 ag_action_3_s_proc, | |
2507 ag_action_4_r_proc | |
2508 }; | |
2509 | |
2510 static int (*const ag_gt_procs_scan[])(void) = { | |
2511 ag_action_1_proc, | |
2512 ag_action_2_proc, | |
2513 ag_action_3_proc, | |
2514 ag_action_4_proc, | |
2515 ag_action_5_proc, | |
2516 ag_action_6_proc, | |
2517 ag_action_7_proc, | |
2518 ag_action_8_proc, | |
2519 ag_action_9_proc, | |
2520 ag_action_10_proc, | |
2521 ag_action_11_proc, | |
2522 ag_action_8_proc | |
2523 }; | |
2524 | |
2525 | |
2526 static int ag_rns(int ag_t, int *ag_sx, int ag_snd) { | |
2527 while (1) { | |
2528 int ag_act, ag_k = ag_sbt[ag_snd], ag_lim = ag_sbt[ag_snd+1]; | |
2529 int ag_p; | |
2530 | |
2531 while (ag_k < ag_lim && ag_tstt[ag_k] != ag_t) ag_k++; | |
2532 if (ag_k == ag_lim) break; | |
2533 ag_act = ag_astt[ag_k]; | |
2534 ag_p = ag_pstt[ag_k]; | |
2535 if (ag_act == ag_action_2) return ag_p; | |
2536 if (ag_act == ag_action_10 || ag_act == ag_action_11) { | |
2537 (*ag_sx)--; | |
2538 return ag_snd; | |
2539 } | |
2540 if (ag_act != ag_action_3 && | |
2541 ag_act != ag_action_4) break; | |
2542 *ag_sx -= (ag_fl[ag_p] - 1); | |
2543 ag_snd = (PCB).ss[*ag_sx]; | |
2544 ag_t = ag_ptt[ag_p]; | |
2545 } | |
2546 return 0; | |
2547 } | |
2548 | |
2549 static int ag_jns(int ag_t) { | |
2550 int ag_k; | |
2551 | |
2552 ag_k = ag_sbt[(PCB).sn]; | |
2553 while (ag_tstt[ag_k] != ag_t && ag_tstt[ag_k]) ag_k++; | |
2554 while (1) { | |
2555 int ag_p = ag_pstt[ag_k]; | |
2556 int ag_sd; | |
2557 | |
2558 switch (ag_astt[ag_k]) { | |
2559 case ag_action_2: | |
2560 GET_CONTEXT; | |
2561 (PCB).ss[(PCB).ssx] = (PCB).sn; | |
2562 return ag_p; | |
2563 case ag_action_10: | |
2564 case ag_action_11: | |
2565 return (PCB).ss[(PCB).ssx--]; | |
2566 case ag_action_9: | |
2567 GET_CONTEXT; | |
2568 (PCB).ss[(PCB).ssx] = (PCB).sn; | |
2569 (PCB).ssx++; | |
2570 (PCB).sn = ag_p; | |
2571 ag_k = ag_sbt[(PCB).sn]; | |
2572 while (ag_tstt[ag_k] != ag_t && ag_tstt[ag_k]) ag_k++; | |
2573 continue; | |
2574 case ag_action_3: | |
2575 case ag_action_4: | |
2576 ag_sd = ag_fl[ag_p] - 1; | |
2577 if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd]; | |
2578 else GET_CONTEXT; | |
2579 (PCB).ss[(PCB).ssx] = (PCB).sn; | |
2580 ag_t = ag_ptt[ag_p]; | |
2581 ag_k = ag_sbt[(PCB).sn+1]; | |
2582 while (ag_tstt[--ag_k] != ag_t); | |
2583 continue; | |
2584 case ag_action_5: | |
2585 case ag_action_6: | |
2586 if (ag_fl[ag_p]) break; | |
2587 (PCB).sn = ag_rns(ag_ptt[ag_p],&(PCB).ssx, (PCB).sn); | |
2588 (PCB).ss[++(PCB).ssx] = (PCB).sn; | |
2589 ag_k = ag_sbt[(PCB).sn]; | |
2590 while (ag_tstt[ag_k] != ag_t && ag_tstt[ag_k]) ag_k++; | |
2591 continue; | |
2592 } | |
2593 break; | |
2594 } | |
2595 return 0; | |
2596 } | |
2597 | |
2598 | |
2599 static int ag_atx(int ag_t, int *ag_sx, int ag_snd) { | |
2600 int ag_k, ag_f; | |
2601 int ag_save_btsx = (PCB).btsx; | |
2602 int ag_flag = 1; | |
2603 | |
2604 while (1) { | |
2605 int ag_a; | |
2606 | |
2607 (PCB).bts[128 - ++(PCB).btsx] = *ag_sx; | |
2608 (PCB).ss[128 - (PCB).btsx] = (PCB).ss[*ag_sx]; | |
2609 (PCB).ss[*ag_sx] = ag_snd; | |
2610 ag_k = ag_sbt[ag_snd]; | |
2611 while (ag_tstt[ag_k] != ag_t && ag_tstt[ag_k]) ag_k++; | |
2612 ag_a = ag_astt[ag_k]; | |
2613 if (ag_a == ag_action_2 || | |
2614 ag_a == ag_action_3 || | |
2615 ag_a == ag_action_10 || | |
2616 ag_a == ag_action_11 || | |
2617 ag_a == ag_action_1 || | |
2618 ag_a == ag_action_4) break; | |
2619 if ((ag_a == ag_action_5 || | |
2620 ag_a == ag_action_6) && | |
2621 (ag_k = ag_fl[ag_f = ag_pstt[ag_k]]) == 0) { | |
2622 ag_snd = ag_rns(ag_ptt[ag_f],ag_sx, (PCB).ss[*ag_sx]); | |
2623 (*ag_sx)++; | |
2624 continue; | |
2625 } | |
2626 if (ag_a == ag_action_9) { | |
2627 ag_snd = ag_pstt[ag_k]; | |
2628 (*ag_sx)++; | |
2629 continue; | |
2630 } | |
2631 ag_flag = 0; | |
2632 break; | |
2633 } | |
2634 while ((PCB).btsx > ag_save_btsx) { | |
2635 *ag_sx = (PCB).bts[128 - (PCB).btsx]; | |
2636 (PCB).ss[*ag_sx] = (PCB).ss[128 - (PCB).btsx--]; | |
2637 } | |
2638 return ag_flag; | |
2639 } | |
2640 | |
2641 | |
2642 static int ag_tst_tkn(void) { | |
2643 int ag_rk, ag_sx, ag_snd = (PCB).sn; | |
2644 | |
2645 if ((PCB).rx < (PCB).fx) { | |
2646 (PCB).input_code = (PCB).lab[(PCB).rx++]; | |
2647 (PCB).token_number = (ts_token_type) AG_TCV((PCB).input_code);} | |
2648 else { | |
2649 GET_INPUT; | |
2650 (PCB).lab[(PCB).fx++] = (PCB).input_code; | |
2651 (PCB).token_number = (ts_token_type) AG_TCV((PCB).input_code); | |
2652 (PCB).rx++; | |
2653 } | |
2654 if (ag_key_index[(PCB).sn]) { | |
2655 unsigned ag_k = ag_key_index[(PCB).sn]; | |
2656 int ag_ch = CONVERT_CASE((PCB).input_code); | |
2657 if (ag_ch < 255) { | |
2658 while (ag_key_ch[ag_k] < ag_ch) ag_k++; | |
2659 if (ag_key_ch[ag_k] == ag_ch) ag_get_key_word(ag_k); | |
2660 } | |
2661 } | |
2662 for (ag_rk = 0; ag_rk < (PCB).ag_lrss; ag_rk += 2) { | |
2663 ag_sx = (PCB).ag_rss[ag_rk]; | |
2664 if (ag_sx > (PCB).ssx || ag_sx > (PCB).ag_min_depth) continue; | |
2665 (PCB).sn = (PCB).ag_rss[ag_rk + 1]; | |
2666 if (ag_atx((PCB).token_number, &ag_sx, (PCB).sn)) break; | |
2667 } | |
2668 (PCB).sn = ag_snd; | |
2669 return ag_rk; | |
2670 } | |
2671 | |
2672 static void ag_set_error_procs(void); | |
2673 | |
2674 static void ag_auto_resynch(void) { | |
2675 int ag_sx, ag_rk; | |
2676 int ag_rk1, ag_rk2, ag_tk1; | |
2677 (PCB).ss[(PCB).ssx] = (PCB).sn; | |
2678 if ((PCB).ag_error_depth && (PCB).ag_min_depth >= (PCB).ag_error_depth) { | |
2679 (PCB).ssx = (PCB).ag_error_depth; | |
2680 (PCB).sn = (PCB).ss[(PCB).ssx]; | |
2681 } | |
2682 else { | |
2683 ag_diagnose(); | |
2684 SYNTAX_ERROR; | |
2685 if ((PCB).exit_flag != AG_RUNNING_CODE) return; | |
2686 (PCB).ag_error_depth = (PCB).ag_min_depth = 0; | |
2687 (PCB).ag_lrss = 0; | |
2688 (PCB).ss[ag_sx = (PCB).ssx] = (PCB).sn; | |
2689 (PCB).ag_min_depth = (PCB).ag_rss[(PCB).ag_lrss++] = ag_sx; | |
2690 (PCB).ag_rss[(PCB).ag_lrss++] = (PCB).sn; | |
2691 while (ag_sx && (PCB).ag_lrss < 2*128) { | |
2692 int ag_t = 0, ag_x, ag_s, ag_sxs = ag_sx; | |
2693 | |
2694 while (ag_sx && (ag_t = ag_ctn[2*(PCB).sn]) == 0) (PCB).sn = (PCB).ss[--ag_sx]; | |
2695 if (ag_t) (PCB).sn = (PCB).ss[ag_sx -= ag_ctn[2*(PCB).sn +1]]; | |
2696 else { | |
2697 if (ag_sx == 0) (PCB).sn = 0; | |
2698 ag_t = ag_ptt[0]; | |
2699 } | |
2700 if ((ag_s = ag_rns(ag_t, &ag_sx, (PCB).sn)) == 0) break; | |
2701 for (ag_x = 0; ag_x < (PCB).ag_lrss; ag_x += 2) | |
2702 if ((PCB).ag_rss[ag_x] == ag_sx + 1 && (PCB).ag_rss[ag_x+1] == ag_s) break; | |
2703 if (ag_x == (PCB).ag_lrss) { | |
2704 (PCB).ag_rss[(PCB).ag_lrss++] = ++ag_sx; | |
2705 (PCB).ag_rss[(PCB).ag_lrss++] = (PCB).sn = ag_s; | |
2706 } | |
2707 else if (ag_sx >= ag_sxs) ag_sx--; | |
2708 } | |
2709 ag_set_error_procs(); | |
2710 } | |
2711 (PCB).rx = 0; | |
2712 if ((PCB).ssx > (PCB).ag_min_depth) (PCB).ag_min_depth = (PCB).ssx; | |
2713 while (1) { | |
2714 ag_rk1 = ag_tst_tkn(); | |
2715 if ((PCB).token_number == 12) | |
2716 {(PCB).exit_flag = AG_SYNTAX_ERROR_CODE; return;} | |
2717 if (ag_rk1 < (PCB).ag_lrss) break; | |
2718 {(PCB).rx = 1; ag_track();} | |
2719 } | |
2720 ag_tk1 = (PCB).token_number; | |
2721 ag_track(); | |
2722 ag_rk2 = ag_tst_tkn(); | |
2723 if (ag_rk2 < ag_rk1) {ag_rk = ag_rk2; ag_track();} | |
2724 else {ag_rk = ag_rk1; (PCB).token_number = (ts_token_type) ag_tk1; (PCB).rx = 0;} | |
2725 (PCB).ag_min_depth = (PCB).ssx = (PCB).ag_rss[ag_rk++]; | |
2726 (PCB).sn = (PCB).ss[(PCB).ssx] = (PCB).ag_rss[ag_rk]; | |
2727 (PCB).sn = ag_jns((PCB).token_number); | |
2728 if ((PCB).ag_error_depth == 0 || (PCB).ag_error_depth > (PCB).ssx) | |
2729 (PCB).ag_error_depth = (PCB).ssx; | |
2730 if (++(PCB).ssx >= 128) { | |
2731 ag_trace_error(); | |
2732 (PCB).exit_flag = AG_STACK_ERROR_CODE; | |
2733 PARSER_STACK_OVERFLOW; | |
2734 return; | |
2735 } | |
2736 GET_CONTEXT; | |
2737 (PCB).ss[(PCB).ssx] = (PCB).sn; | |
2738 (PCB).ag_tmp_depth = (PCB).ag_min_depth; | |
2739 (PCB).rx = 0; | |
2740 return; | |
2741 } | |
2742 | |
2743 | |
2744 static int ag_action_10_proc(void) { | |
2745 int ag_t = (PCB).token_number; | |
2746 (PCB).btsx = 0, (PCB).drt = -1; | |
2747 do { | |
2748 ag_track(); | |
2749 if ((PCB).rx < (PCB).fx) { | |
2750 (PCB).input_code = (PCB).lab[(PCB).rx++]; | |
2751 (PCB).token_number = (ts_token_type) AG_TCV((PCB).input_code);} | |
2752 else { | |
2753 GET_INPUT; | |
2754 (PCB).lab[(PCB).fx++] = (PCB).input_code; | |
2755 (PCB).token_number = (ts_token_type) AG_TCV((PCB).input_code); | |
2756 (PCB).rx++; | |
2757 } | |
2758 if (ag_key_index[(PCB).sn]) { | |
2759 unsigned ag_k = ag_key_index[(PCB).sn]; | |
2760 int ag_ch = CONVERT_CASE((PCB).input_code); | |
2761 if (ag_ch < 255) { | |
2762 while (ag_key_ch[ag_k] < ag_ch) ag_k++; | |
2763 if (ag_key_ch[ag_k] == ag_ch) ag_get_key_word(ag_k); | |
2764 } | |
2765 } | |
2766 } while ((PCB).token_number == (ts_token_type) ag_t); | |
2767 (PCB).rx = 0; | |
2768 return 1; | |
2769 } | |
2770 | |
2771 static int ag_action_11_proc(void) { | |
2772 int ag_t = (PCB).token_number; | |
2773 | |
2774 (PCB).btsx = 0, (PCB).drt = -1; | |
2775 do { | |
2776 (*(int *) &(PCB).vs[(PCB).ssx]) = *(PCB).lab; | |
2777 (PCB).ssx--; | |
2778 ag_track(); | |
2779 ag_ra(); | |
2780 if ((PCB).exit_flag != AG_RUNNING_CODE) return 0; | |
2781 (PCB).ssx++; | |
2782 if ((PCB).rx < (PCB).fx) { | |
2783 (PCB).input_code = (PCB).lab[(PCB).rx++]; | |
2784 (PCB).token_number = (ts_token_type) AG_TCV((PCB).input_code);} | |
2785 else { | |
2786 GET_INPUT; | |
2787 (PCB).lab[(PCB).fx++] = (PCB).input_code; | |
2788 (PCB).token_number = (ts_token_type) AG_TCV((PCB).input_code); | |
2789 (PCB).rx++; | |
2790 } | |
2791 if (ag_key_index[(PCB).sn]) { | |
2792 unsigned ag_k = ag_key_index[(PCB).sn]; | |
2793 int ag_ch = CONVERT_CASE((PCB).input_code); | |
2794 if (ag_ch < 255) { | |
2795 while (ag_key_ch[ag_k] < ag_ch) ag_k++; | |
2796 if (ag_key_ch[ag_k] == ag_ch) ag_get_key_word(ag_k); | |
2797 } | |
2798 } | |
2799 } | |
2800 while ((PCB).token_number == (ts_token_type) ag_t); | |
2801 (PCB).rx = 0; | |
2802 return 1; | |
2803 } | |
2804 | |
2805 static int ag_action_3_r_proc(void) { | |
2806 int ag_sd = ag_fl[(PCB).ag_ap] - 1; | |
2807 if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd]; | |
2808 (PCB).btsx = 0, (PCB).drt = -1; | |
2809 (PCB).reduction_token = (ts_token_type) ag_ptt[(PCB).ag_ap]; | |
2810 ag_ra(); | |
2811 return (PCB).exit_flag == AG_RUNNING_CODE; | |
2812 } | |
2813 | |
2814 static int ag_action_3_s_proc(void) { | |
2815 int ag_sd = ag_fl[(PCB).ag_ap] - 1; | |
2816 if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd]; | |
2817 (PCB).btsx = 0, (PCB).drt = -1; | |
2818 (PCB).reduction_token = (ts_token_type) ag_ptt[(PCB).ag_ap]; | |
2819 ag_ra(); | |
2820 return (PCB).exit_flag == AG_RUNNING_CODE; | |
2821 } | |
2822 | |
2823 static int ag_action_4_r_proc(void) { | |
2824 int ag_sd = ag_fl[(PCB).ag_ap] - 1; | |
2825 if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd]; | |
2826 (PCB).reduction_token = (ts_token_type) ag_ptt[(PCB).ag_ap]; | |
2827 return 1; | |
2828 } | |
2829 | |
2830 static int ag_action_2_proc(void) { | |
2831 (PCB).btsx = 0, (PCB).drt = -1; | |
2832 if ((PCB).ssx >= 128) { | |
2833 ag_trace_error(); | |
2834 (PCB).exit_flag = AG_STACK_ERROR_CODE; | |
2835 PARSER_STACK_OVERFLOW; | |
2836 } | |
2837 (*(int *) &(PCB).vs[(PCB).ssx]) = *(PCB).lab; | |
2838 GET_CONTEXT; | |
2839 (PCB).ss[(PCB).ssx] = (PCB).sn; | |
2840 (PCB).ssx++; | |
2841 (PCB).sn = (PCB).ag_ap; | |
2842 ag_track(); | |
2843 return 0; | |
2844 } | |
2845 | |
2846 static int ag_action_9_proc(void) { | |
2847 if ((PCB).drt == -1) { | |
2848 (PCB).drt=(PCB).token_number; | |
2849 (PCB).dssx=(PCB).ssx; | |
2850 (PCB).dsn=(PCB).sn; | |
2851 } | |
2852 ag_prot(); | |
2853 (PCB).vs[(PCB).ssx] = ag_null_value; | |
2854 GET_CONTEXT; | |
2855 (PCB).ss[(PCB).ssx] = (PCB).sn; | |
2856 (PCB).ssx++; | |
2857 (PCB).sn = (PCB).ag_ap; | |
2858 (PCB).rx = 0; | |
2859 return (PCB).exit_flag == AG_RUNNING_CODE; | |
2860 } | |
2861 | |
2862 static int ag_action_2_r_proc(void) { | |
2863 (PCB).ssx++; | |
2864 (PCB).sn = (PCB).ag_ap; | |
2865 return 0; | |
2866 } | |
2867 | |
2868 static int ag_action_7_proc(void) { | |
2869 --(PCB).ssx; | |
2870 (PCB).rx = 0; | |
2871 (PCB).exit_flag = AG_SUCCESS_CODE; | |
2872 return 0; | |
2873 } | |
2874 | |
2875 static int ag_action_1_proc(void) { | |
2876 ag_track(); | |
2877 (PCB).exit_flag = AG_SUCCESS_CODE; | |
2878 return 0; | |
2879 } | |
2880 | |
2881 static int ag_action_1_r_proc(void) { | |
2882 (PCB).exit_flag = AG_SUCCESS_CODE; | |
2883 return 0; | |
2884 } | |
2885 | |
2886 static int ag_action_1_s_proc(void) { | |
2887 (PCB).exit_flag = AG_SUCCESS_CODE; | |
2888 return 0; | |
2889 } | |
2890 | |
2891 static int ag_action_4_proc(void) { | |
2892 int ag_sd = ag_fl[(PCB).ag_ap] - 1; | |
2893 (PCB).reduction_token = (ts_token_type) ag_ptt[(PCB).ag_ap]; | |
2894 (PCB).btsx = 0, (PCB).drt = -1; | |
2895 (*(int *) &(PCB).vs[(PCB).ssx]) = *(PCB).lab; | |
2896 if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd]; | |
2897 else GET_CONTEXT; | |
2898 (PCB).ss[(PCB).ssx] = (PCB).sn; | |
2899 ag_track(); | |
2900 while ((PCB).exit_flag == AG_RUNNING_CODE) { | |
2901 unsigned ag_t1 = ag_sbe[(PCB).sn] + 1; | |
2902 unsigned ag_t2 = ag_sbt[(PCB).sn+1] - 1; | |
2903 do { | |
2904 unsigned ag_tx = (ag_t1 + ag_t2)/2; | |
2905 if (ag_tstt[ag_tx] < (unsigned char)(PCB).reduction_token) ag_t1 = ag_tx + 1; | |
2906 else ag_t2 = ag_tx; | |
2907 } while (ag_t1 < ag_t2); | |
2908 if (ag_tstt[ag_t1] != (PCB).reduction_token) { | |
2909 (PCB).exit_flag = AG_REDUCTION_ERROR_CODE; ag_trace_error(); | |
2910 REDUCTION_TOKEN_ERROR; break;} | |
2911 (PCB).ag_ap = ag_pstt[ag_t1]; | |
2912 if ((*(PCB).s_procs[ag_astt[ag_t1]])() == 0) break; | |
2913 } | |
2914 return 0; | |
2915 } | |
2916 | |
2917 static int ag_action_3_proc(void) { | |
2918 int ag_sd = ag_fl[(PCB).ag_ap] - 1; | |
2919 (PCB).btsx = 0, (PCB).drt = -1; | |
2920 (*(int *) &(PCB).vs[(PCB).ssx]) = *(PCB).lab; | |
2921 if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd]; | |
2922 else GET_CONTEXT; | |
2923 (PCB).ss[(PCB).ssx] = (PCB).sn; | |
2924 ag_track(); | |
2925 (PCB).reduction_token = (ts_token_type) ag_ptt[(PCB).ag_ap]; | |
2926 ag_ra(); | |
2927 while ((PCB).exit_flag == AG_RUNNING_CODE) { | |
2928 unsigned ag_t1 = ag_sbe[(PCB).sn] + 1; | |
2929 unsigned ag_t2 = ag_sbt[(PCB).sn+1] - 1; | |
2930 do { | |
2931 unsigned ag_tx = (ag_t1 + ag_t2)/2; | |
2932 if (ag_tstt[ag_tx] < (unsigned char)(PCB).reduction_token) ag_t1 = ag_tx + 1; | |
2933 else ag_t2 = ag_tx; | |
2934 } while (ag_t1 < ag_t2); | |
2935 if (ag_tstt[ag_t1] != (PCB).reduction_token) { | |
2936 (PCB).exit_flag = AG_REDUCTION_ERROR_CODE; ag_trace_error(); | |
2937 REDUCTION_TOKEN_ERROR; break;} | |
2938 (PCB).ag_ap = ag_pstt[ag_t1]; | |
2939 if ((*(PCB).s_procs[ag_astt[ag_t1]])() == 0) break; | |
2940 } | |
2941 return 0; | |
2942 } | |
2943 | |
2944 static int ag_action_8_proc(void) { | |
2945 ag_undo(); | |
2946 ag_trace_error(); | |
2947 (PCB).rx = 0; | |
2948 ag_auto_resynch(); | |
2949 return (PCB).exit_flag == AG_RUNNING_CODE; | |
2950 } | |
2951 | |
2952 static int ag_action_5_proc(void) { | |
2953 int ag_sd = ag_fl[(PCB).ag_ap]; | |
2954 (PCB).btsx = 0, (PCB).drt = -1; | |
2955 if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd]; | |
2956 else { | |
2957 GET_CONTEXT; | |
2958 (PCB).ss[(PCB).ssx] = (PCB).sn; | |
2959 } | |
2960 (PCB).rx = 0; | |
2961 (PCB).reduction_token = (ts_token_type) ag_ptt[(PCB).ag_ap]; | |
2962 ag_ra(); | |
2963 while ((PCB).exit_flag == AG_RUNNING_CODE) { | |
2964 unsigned ag_t1 = ag_sbe[(PCB).sn] + 1; | |
2965 unsigned ag_t2 = ag_sbt[(PCB).sn+1] - 1; | |
2966 do { | |
2967 unsigned ag_tx = (ag_t1 + ag_t2)/2; | |
2968 if (ag_tstt[ag_tx] < (unsigned char)(PCB).reduction_token) ag_t1 = ag_tx + 1; | |
2969 else ag_t2 = ag_tx; | |
2970 } while (ag_t1 < ag_t2); | |
2971 if (ag_tstt[ag_t1] != (PCB).reduction_token) { | |
2972 (PCB).exit_flag = AG_REDUCTION_ERROR_CODE; ag_trace_error(); | |
2973 REDUCTION_TOKEN_ERROR; break;} | |
2974 (PCB).ag_ap = ag_pstt[ag_t1]; | |
2975 if ((*(PCB).r_procs[ag_astt[ag_t1]])() == 0) break; | |
2976 } | |
2977 return (PCB).exit_flag == AG_RUNNING_CODE; | |
2978 } | |
2979 | |
2980 static int ag_action_6_proc(void) { | |
2981 int ag_sd = ag_fl[(PCB).ag_ap]; | |
2982 (PCB).reduction_token = (ts_token_type) ag_ptt[(PCB).ag_ap]; | |
2983 if ((PCB).drt == -1) { | |
2984 (PCB).drt=(PCB).token_number; | |
2985 (PCB).dssx=(PCB).ssx; | |
2986 (PCB).dsn=(PCB).sn; | |
2987 } | |
2988 if (ag_sd) { | |
2989 (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd]; | |
2990 } | |
2991 else { | |
2992 ag_prot(); | |
2993 (PCB).vs[(PCB).ssx] = ag_null_value; | |
2994 GET_CONTEXT; | |
2995 (PCB).ss[(PCB).ssx] = (PCB).sn; | |
2996 } | |
2997 (PCB).rx = 0; | |
2998 while ((PCB).exit_flag == AG_RUNNING_CODE) { | |
2999 unsigned ag_t1 = ag_sbe[(PCB).sn] + 1; | |
3000 unsigned ag_t2 = ag_sbt[(PCB).sn+1] - 1; | |
3001 do { | |
3002 unsigned ag_tx = (ag_t1 + ag_t2)/2; | |
3003 if (ag_tstt[ag_tx] < (unsigned char)(PCB).reduction_token) ag_t1 = ag_tx + 1; | |
3004 else ag_t2 = ag_tx; | |
3005 } while (ag_t1 < ag_t2); | |
3006 if (ag_tstt[ag_t1] != (PCB).reduction_token) { | |
3007 (PCB).exit_flag = AG_REDUCTION_ERROR_CODE; ag_trace_error(); | |
3008 REDUCTION_TOKEN_ERROR; break;} | |
3009 (PCB).ag_ap = ag_pstt[ag_t1]; | |
3010 if ((*(PCB).r_procs[ag_astt[ag_t1]])() == 0) break; | |
3011 } | |
3012 return (PCB).exit_flag == AG_RUNNING_CODE; | |
3013 } | |
3014 | |
3015 | |
3016 static void ag_check_depth(int ag_fl) { | |
3017 int ag_sx = (PCB).ssx - ag_fl; | |
3018 if ((PCB).ag_error_depth && ag_sx < (PCB).ag_tmp_depth) (PCB).ag_tmp_depth = ag_sx; | |
3019 } | |
3020 | |
3021 static int ag_action_3_er_proc(void) { | |
3022 ag_check_depth(ag_fl[(PCB).ag_ap] - 1); | |
3023 return ag_action_4_r_proc(); | |
3024 } | |
3025 | |
3026 static int ag_action_2_e_proc(void) { | |
3027 ag_action_2_proc(); | |
3028 (PCB).ag_min_depth = (PCB).ag_tmp_depth; | |
3029 return 0; | |
3030 } | |
3031 | |
3032 static int ag_action_4_e_proc(void) { | |
3033 ag_check_depth(ag_fl[(PCB).ag_ap] - 1); | |
3034 (PCB).ag_min_depth = (PCB).ag_tmp_depth; | |
3035 return ag_action_4_proc(); | |
3036 } | |
3037 | |
3038 static int ag_action_6_e_proc(void) { | |
3039 ag_check_depth(ag_fl[(PCB).ag_ap]); | |
3040 return ag_action_6_proc(); | |
3041 } | |
3042 | |
3043 static int ag_action_11_e_proc(void) { | |
3044 return ag_action_10_proc(); | |
3045 } | |
3046 | |
3047 static int (*ag_r_procs_error[])(void) = { | |
3048 ag_action_1_r_proc, | |
3049 ag_action_2_r_proc, | |
3050 ag_action_3_er_proc, | |
3051 ag_action_3_er_proc | |
3052 }; | |
3053 | |
3054 static int (*ag_s_procs_error[])(void) = { | |
3055 ag_action_1_s_proc, | |
3056 ag_action_2_r_proc, | |
3057 ag_action_3_er_proc, | |
3058 ag_action_3_er_proc | |
3059 }; | |
3060 | |
3061 static int (*ag_gt_procs_error[])(void) = { | |
3062 ag_action_1_proc, | |
3063 ag_action_2_e_proc, | |
3064 ag_action_4_e_proc, | |
3065 ag_action_4_e_proc, | |
3066 ag_action_6_e_proc, | |
3067 ag_action_6_e_proc, | |
3068 ag_action_7_proc, | |
3069 ag_action_8_proc, | |
3070 ag_action_9_proc, | |
3071 ag_action_10_proc, | |
3072 ag_action_11_e_proc, | |
3073 ag_action_8_proc | |
3074 }; | |
3075 | |
3076 static void ag_set_error_procs(void) { | |
3077 (PCB).gt_procs = ag_gt_procs_error; | |
3078 (PCB).r_procs = ag_r_procs_error; | |
3079 (PCB).s_procs = ag_s_procs_error; | |
3080 } | |
3081 | |
3082 | |
3083 void init_ts(void) { | |
3084 (PCB).rx = (PCB).fx = 0; | |
3085 (PCB).gt_procs = ag_gt_procs_scan; | |
3086 (PCB).r_procs = ag_r_procs_scan; | |
3087 (PCB).s_procs = ag_s_procs_scan; | |
3088 (PCB).ag_error_depth = (PCB).ag_min_depth = (PCB).ag_tmp_depth = 0; | |
3089 (PCB).ag_resynch_active = 0; | |
3090 (PCB).ss[0] = (PCB).sn = (PCB).ssx = 0; | |
3091 (PCB).exit_flag = AG_RUNNING_CODE; | |
3092 (PCB).line = FIRST_LINE; | |
3093 (PCB).column = FIRST_COLUMN; | |
3094 (PCB).btsx = 0, (PCB).drt = -1; | |
3095 } | |
3096 | |
3097 void ts(void) { | |
3098 init_ts(); | |
3099 (PCB).exit_flag = AG_RUNNING_CODE; | |
3100 while ((PCB).exit_flag == AG_RUNNING_CODE) { | |
3101 unsigned ag_t1 = ag_sbt[(PCB).sn]; | |
3102 if (ag_tstt[ag_t1]) { | |
3103 unsigned ag_t2 = ag_sbe[(PCB).sn] - 1; | |
3104 if ((PCB).rx < (PCB).fx) { | |
3105 (PCB).input_code = (PCB).lab[(PCB).rx++]; | |
3106 (PCB).token_number = (ts_token_type) AG_TCV((PCB).input_code);} | |
3107 else { | |
3108 GET_INPUT; | |
3109 (PCB).lab[(PCB).fx++] = (PCB).input_code; | |
3110 (PCB).token_number = (ts_token_type) AG_TCV((PCB).input_code); | |
3111 (PCB).rx++; | |
3112 } | |
3113 if (ag_key_index[(PCB).sn]) { | |
3114 unsigned ag_k = ag_key_index[(PCB).sn]; | |
3115 int ag_ch = CONVERT_CASE((PCB).input_code); | |
3116 if (ag_ch < 255) { | |
3117 while (ag_key_ch[ag_k] < ag_ch) ag_k++; | |
3118 if (ag_key_ch[ag_k] == ag_ch) ag_get_key_word(ag_k); | |
3119 } | |
3120 } | |
3121 do { | |
3122 unsigned ag_tx = (ag_t1 + ag_t2)/2; | |
3123 if (ag_tstt[ag_tx] > (unsigned char)(PCB).token_number) | |
3124 ag_t1 = ag_tx + 1; | |
3125 else ag_t2 = ag_tx; | |
3126 } while (ag_t1 < ag_t2); | |
3127 if (ag_tstt[ag_t1] != (unsigned char)(PCB).token_number) | |
3128 ag_t1 = ag_sbe[(PCB).sn]; | |
3129 } | |
3130 (PCB).ag_ap = ag_pstt[ag_t1]; | |
3131 (*(PCB).gt_procs[ag_astt[ag_t1]])(); | |
3132 } | |
3133 } | |
3134 | |
3135 |