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