1 /* This generated file is licenced and copyrighted under the same
2 * conditions as the sourcefile. Happy debugging:) */
3
4 /*
5 defines:
6 */
7
8 #define HOLD unsigned hold___BNF_level = __BNF_level; char *hold___BNF_input = __BNF_input, *hold___BNF_output = __BNF_output
9 #define RESTORE {__BNF_level = hold___BNF_level; __BNF_input = hold___BNF_input; __BNF_output = hold___BNF_output;}
10
11 #ifdef __TURBOC__
12 # pragma warn -pro
13 # pragma warn -nod
14 #endif
15
16 #ifdef _MSC_VER
17 # pragma warning (disable:4013)
18 # pragma warning (disable:4005)
19 #endif
20
21 /*
22 externals:
23 */
24
25 extern char *__BNF_input, *__BNF_output;
26 extern unsigned __BNF_level;
27 extern unsigned int __BNF_tabsize;
28
29 extern int __BNF_trans_string(char *),
30 __BNF_input_string(char *), __BNF_output_string(char *),
31 __BNF_trans_char(void), __BNF_swap(char *, char *, char *);
32
33
34 extern void user_error(char *); /* user provided error handler must TERMINATE */
35
36
37 /**/
38 /* ---------------------------------------------------------------------*/
39 /**/
40 /* GRAMMAR SECTION*/
41 /**/
42 /* ---------------------------------------------------------------------*/
43 /**/
44 /* ---------------------------------------------------------------------*/
45 /* <grammar> ::= [{ <assignment> | <comment> | <white> }] EOF*/
46 /**/
47 /**/
48
grammar(void)49 int grammar(void)
50 {
51 int state;
52
53 do {
54 HOLD;
55
56 state = out_header( ); /* --- Call function --- */
57 if (state) break;
58 {
59 int firstloop = 1;
60 do {
61 do {
62 HOLD;
63
64 do {
65 state = assignment( ); /* --- Call function --- */
66 if (!state) break;
67 state = wc( ); /* --- Call function --- */
68 } while( 0 );
69
70 if (state) break;
71 state = flush( ); /* --- Call function --- */
72 if (state) { RESTORE; break; };
73 } while( 0 );
74
75 if (firstloop)
76 {
77 if (state) break;
78 firstloop = 0;
79 }
80 } while ( !state );
81 state = firstloop;
82 }
83 state = 0;
84 if (state) { RESTORE; break; };
85 state = out_footer( ); /* --- Call function --- */
86 if (state) { RESTORE; break; };
87 do {
88 HOLD;
89
90 state = __BNF_input_string( "%%" ); /* --- Call function --- */
91 if (state) break;
92 {
93 int firstloop = 1;
94 do {
95 state = __BNF_trans_char( ); /* --- Call function --- */
96 if (firstloop)
97 {
98 if (state) break;
99 firstloop = 0;
100 }
101 } while ( !state );
102 state = firstloop;
103 }
104 state = 0;
105 if (state) { RESTORE; break; };
106 } while( 0 );
107
108 state = 0;
109 if (state) { RESTORE; break; };
110 do {
111 state = eoi( ); /* --- Call function --- */
112 if (!state) break;
113 user_error( "Syntax error" ); /* --- Call function --- */
114 state = 0;
115 } while( 0 );
116
117 if (state) { RESTORE; break; };
118 } while( 0 );
119
120 return state;}
121
122 /* ---------------------------------------------------------------------*/
123 /* <comment> ::= '#' ~[{ not '\n' }]~ '\n'*/
124 /**/
125 /* where the internal routine 'commentchars' does a transparent parse on*/
126 /* the expression '~[{ not '\n' }]~'.*/
127 /**/
128
comment(void)129 int comment(void)
130 {
131 int state;
132
133 do {
134 do {
135 HOLD;
136
137 state = __BNF_input_string( "##" ); /* --- Call function --- */
138 if (state) break;
139 state = ignorechars( ); /* --- Call function --- */
140 if (state) { RESTORE; break; };
141 state = __BNF_input_string( "\n" ); /* --- Call function --- */
142 if (state) { RESTORE; break; };
143 } while( 0 );
144
145 if (!state) break;
146 do {
147 HOLD;
148
149 state = __BNF_input_string( "#" ); /* --- Call function --- */
150 if (state) break;
151 state = out_comment_begin( ); /* --- Call function --- */
152 if (state) { RESTORE; break; };
153 state = commentchars( ); /* --- Call function --- */
154 if (state) { RESTORE; break; };
155 state = __BNF_input_string( "\n" ); /* --- Call function --- */
156 if (state) { RESTORE; break; };
157 state = out_comment_end( ); /* --- Call function --- */
158 if (state) { RESTORE; break; };
159 } while( 0 );
160
161 } while( 0 );
162
163 return state;}
164
165 /* ---------------------------------------------------------------------*/
166 /* <assignment> ::= <name> [<wc>] ('=' | '::=') <expression> ';'*/
167 /**/
168
assignment(void)169 int assignment(void)
170 {
171 int state;
172
173 do {
174 HOLD;
175
176 state = out_func_type( ); /* --- Call function --- */
177 if (state) break;
178 state = name( ); /* --- Call function --- */
179 if (state) { RESTORE; break; };
180 state = wc( ); /* --- Call function --- */
181 state = 0;
182 if (state) { RESTORE; break; };
183 do {
184 state = __BNF_input_string( "=" ); /* --- Call function --- */
185 if (!state) break;
186 state = __BNF_input_string( "::=" ); /* --- Call function --- */
187 if (!state) break;
188 user_error( " \'=\' or \'::=\' expected" ); /* --- Call function --- */
189 state = 0;
190 } while( 0 );
191
192 if (state) { RESTORE; break; };
193 state = out_func_begin( ); /* --- Call function --- */
194 if (state) { RESTORE; break; };
195 state = expression( ); /* --- Call function --- */
196 if (state) { RESTORE; break; };
197 do {
198 do {
199 HOLD;
200
201 state = __BNF_input_string( ";" ); /* --- Call function --- */
202 if (state) break;
203 state = inc_rule( ); /* --- Call function --- */
204 if (state) { RESTORE; break; };
205 } while( 0 );
206
207 if (!state) break;
208 user_error( "\';\' expected" ); /* --- Call function --- */
209 state = 0;
210 } while( 0 );
211
212 if (state) { RESTORE; break; };
213 state = out_func_end( ); /* --- Call function --- */
214 if (state) { RESTORE; break; };
215 } while( 0 );
216
217 return state;}
218
219 /* ---------------------------------------------------------------------*/
220 /* <expression> ::= term [{ '|' term }]*/
221 /**/
222
expression(void)223 int expression(void)
224 {
225 int state;
226
227 do {
228 do {
229 HOLD;
230
231 state = wc( ); /* --- Call function --- */
232 state = 0;
233 if (state) break;
234 do {
235 do {
236 HOLD;
237
238 state = out_or_begin( ); /* --- Call function --- */
239 if (state) break;
240 state = term( ); /* --- Call function --- */
241 if (state) { RESTORE; break; };
242 {
243 int firstloop = 1;
244 do {
245 do {
246 HOLD;
247
248 state = wc( ); /* --- Call function --- */
249 state = 0;
250 if (state) break;
251 state = __BNF_input_string( "|" ); /* --- Call function --- */
252 if (state) { RESTORE; break; };
253 state = wc( ); /* --- Call function --- */
254 state = 0;
255 if (state) { RESTORE; break; };
256 state = out_or_operator( ); /* --- Call function --- */
257 if (state) { RESTORE; break; };
258 state = term( ); /* --- Call function --- */
259 if (state) { RESTORE; break; };
260 } while( 0 );
261
262 if (firstloop)
263 {
264 if (state) break;
265 firstloop = 0;
266 }
267 } while ( !state );
268 state = firstloop;
269 }
270 if (state) { RESTORE; break; };
271 state = out_or_end( ); /* --- Call function --- */
272 if (state) { RESTORE; break; };
273 } while( 0 );
274
275 if (!state) break;
276 state = term( ); /* --- Call function --- */
277 } while( 0 );
278
279 if (state) { RESTORE; break; };
280 state = wc( ); /* --- Call function --- */
281 state = 0;
282 if (state) { RESTORE; break; };
283 } while( 0 );
284
285 if (!state) break;
286 user_error( "Expression expected" ); /* --- Call function --- */
287 state = 0;
288 } while( 0 );
289
290 return state;}
291
292 /* ---------------------------------------------------------------------*/
293 /* <term> ::= <ordinary_and> | <swapped_and> | <factor>*/
294 /**/
295
term(void)296 int term(void)
297 {
298 int state;
299
300 do {
301 state = ordinary_and( ); /* --- Call function --- */
302 if (!state) break;
303 state = swapped_and( ); /* --- Call function --- */
304 if (!state) break;
305 state = factor( ); /* --- Call function --- */
306 } while( 0 );
307
308 return state;}
309
310 /* ---------------------------------------------------------------------*/
311 /* <ordinary_and> ::= factor { wc <factor> }*/
312 /**/
313
ordinary_and(void)314 int ordinary_and(void)
315 {
316 int state;
317
318 do {
319 HOLD;
320
321 state = out_and_begin( ); /* --- Call function --- */
322 if (state) break;
323 state = factor( ); /* --- Call function --- */
324 if (state) { RESTORE; break; };
325 state = out_and_1( ); /* --- Call function --- */
326 if (state) { RESTORE; break; };
327 {
328 int firstloop = 1;
329 do {
330 do {
331 HOLD;
332
333 state = wc( ); /* --- Call function --- */
334 if (state) break;
335 state = factor( ); /* --- Call function --- */
336 if (state) { RESTORE; break; };
337 state = out_and_2( ); /* --- Call function --- */
338 if (state) { RESTORE; break; };
339 } while( 0 );
340
341 if (firstloop)
342 {
343 if (state) break;
344 firstloop = 0;
345 }
346 } while ( !state );
347 state = firstloop;
348 }
349 if (state) { RESTORE; break; };
350 state = out_and_end( ); /* --- Call function --- */
351 if (state) { RESTORE; break; };
352 } while( 0 );
353
354 return state;}
355
356 /* ---------------------------------------------------------------------*/
357 /* <swapped_and> ::= factor { '#' <factor> }*/
358 /**/
359
swapped_and(void)360 int swapped_and(void)
361 {
362 int state;
363
364 do {
365 HOLD;
366
367 state = out_swp_begin( ); /* --- Call function --- */
368 if (state) break;
369 state = factor( ); /* --- Call function --- */
370 if (state) { RESTORE; break; };
371 state = out_swp_1( ); /* --- Call function --- */
372 if (state) { RESTORE; break; };
373 {
374 int firstloop = 1;
375 do {
376 do {
377 do {
378 HOLD;
379
380 state = wc( ); /* --- Call function --- */
381 state = 0;
382 if (state) break;
383 state = __BNF_input_string( "#" ); /* --- Call function --- */
384 if (state) { RESTORE; break; };
385 state = wc( ); /* --- Call function --- */
386 state = 0;
387 if (state) { RESTORE; break; };
388 state = out_swp_2( ); /* --- Call function --- */
389 if (state) { RESTORE; break; };
390 state = factor( ); /* --- Call function --- */
391 if (state) { RESTORE; break; };
392 state = out_swp_3( ); /* --- Call function --- */
393 if (state) { RESTORE; break; };
394 } while( 0 );
395
396 if (!state) break;
397 do {
398 HOLD;
399
400 state = wc( ); /* --- Call function --- */
401 if (state) break;
402 state = factor( ); /* --- Call function --- */
403 if (state) { RESTORE; break; };
404 state = out_swp_4( ); /* --- Call function --- */
405 if (state) { RESTORE; break; };
406 } while( 0 );
407
408 } while( 0 );
409
410 if (firstloop)
411 {
412 if (state) break;
413 firstloop = 0;
414 }
415 } while ( !state );
416 state = firstloop;
417 }
418 if (state) { RESTORE; break; };
419 state = out_swp_end( ); /* --- Call function --- */
420 if (state) { RESTORE; break; };
421 } while( 0 );
422
423 return state;}
424
425 /* ---------------------------------------------------------------------*/
426 /* <factor> ::= <IO> | ident | '(' expression rparen | option | repetition*/
427 /**/
428 /* postfix operators are quite time consuming :(*/
429
factor(void)430 int factor(void)
431 {
432 int state;
433
434 do {
435 do {
436 HOLD;
437
438 state = __BNF_input_string( "!" ); /* --- Call function --- */
439 if (state) break;
440 state = wc( ); /* --- Call function --- */
441 state = 0;
442 if (state) { RESTORE; break; };
443 state = simple_factor( ); /* --- Call function --- */
444 if (state) { RESTORE; break; };
445 } while( 0 );
446
447 /* The 'not' operator.*/
448 if (!state) break;
449 do {
450 HOLD;
451
452 state = simple_factor( ); /* --- Call function --- */
453 if (state) break;
454 do {
455 HOLD;
456
457 state = wc( ); /* --- Call function --- */
458 state = 0;
459 if (state) break;
460 do {
461 state = __BNF_input_string( "*" ); /* --- Call function --- */
462 if (!state) break;
463 state = __BNF_input_string( "+" ); /* --- Call function --- */
464 } while( 0 );
465
466 if (state) { RESTORE; break; };
467 } while( 0 );
468
469 state = 0;
470 if (state) { RESTORE; break; };
471 } while( 0 );
472
473 } while( 0 );
474
475 return state;}
476
477 /* Kleene's '*' and '+'.*/
478
simple_factor(void)479 int simple_factor(void)
480 {
481 int state;
482
483 do {
484 state = IO( ); /* --- Call function --- */
485 if (!state) break;
486 state = function( ); /* --- Call function --- */
487 if (!state) break;
488 state = identifier( ); /* --- Call function --- */
489 if (!state) break;
490 state = option( ); /* --- Call function --- */
491 if (!state) break;
492 state = repetition( ); /* --- Call function --- */
493 if (!state) break;
494 do {
495 HOLD;
496
497 state = __BNF_input_string( "(" ); /* --- Call function --- */
498 if (state) break;
499 state = expression( ); /* --- Call function --- */
500 if (state) { RESTORE; break; };
501 state = rparen( ); /* --- Call function --- */
502 if (state) { RESTORE; break; };
503 } while( 0 );
504
505 } while( 0 );
506
507 return state;}
508
509 /* --------------------------------------------------------------------*/
510 /* <IO> ::= <input> | <output> | <trans> | '.' | <error>*/
511 /**/
512
IO(void)513 int IO(void)
514 {
515 int state;
516
517 do {
518 state = input( ); /* --- Call function --- */
519 if (!state) break;
520 state = output( ); /* --- Call function --- */
521 if (!state) break;
522 state = trans( ); /* --- Call function --- */
523 if (!state) break;
524 do {
525 HOLD;
526
527 state = __BNF_input_string( "." ); /* --- Call function --- */
528 if (state) break;
529 state = out_trans_char( ); /* --- Call function --- */
530 if (state) { RESTORE; break; };
531 } while( 0 );
532
533 if (!state) break;
534 state = syntax_error( ); /* --- Call function --- */
535 } while( 0 );
536
537 return state;}
538
539 /* ---------------------------------------------------------------------*/
540 /* input ::= ['in' [wc] '(' [wc]] <string> [ [wc] rparen]*/
541 /**/
542
input(void)543 int input(void)
544 {
545 int state;
546
547 do {
548 do {
549 HOLD;
550
551 state = __BNF_input_string( "in" ); /* --- Call function --- */
552 if (state) break;
553 state = wc( ); /* --- Call function --- */
554 state = 0;
555 if (state) { RESTORE; break; };
556 state = __BNF_input_string( "(" ); /* --- Call function --- */
557 if (state) { RESTORE; break; };
558 state = wc( ); /* --- Call function --- */
559 state = 0;
560 if (state) { RESTORE; break; };
561 state = out_str_begin( ); /* --- Call function --- */
562 if (state) { RESTORE; break; };
563 state = string( ); /* --- Call function --- */
564 if (state) { RESTORE; break; };
565 state = out_str_end( ); /* --- Call function --- */
566 if (state) { RESTORE; break; };
567 state = wc( ); /* --- Call function --- */
568 state = 0;
569 if (state) { RESTORE; break; };
570 state = rparen( ); /* --- Call function --- */
571 if (state) { RESTORE; break; };
572 } while( 0 );
573
574 if (!state) break;
575 do {
576 HOLD;
577
578 state = out_str_begin( ); /* --- Call function --- */
579 if (state) break;
580 state = string( ); /* --- Call function --- */
581 if (state) { RESTORE; break; };
582 state = out_str_end( ); /* --- Call function --- */
583 if (state) { RESTORE; break; };
584 } while( 0 );
585
586 } while( 0 );
587
588 return state;}
589
590 /* ---------------------------------------------------------------------*/
591 /* output ::= 'out' [<wc>] '(' [<wc>] <string> [<wc>] rparen*/
592 /* | '`' [{o_stringchar}] '`'*/
593 /**/
594
output(void)595 int output(void)
596 {
597 int state;
598
599 do {
600 do {
601 HOLD;
602
603 state = __BNF_input_string( "out" ); /* --- Call function --- */
604 if (state) break;
605 state = out_out_1_begin( ); /* --- Call function --- */
606 if (state) { RESTORE; break; };
607 state = wc( ); /* --- Call function --- */
608 state = 0;
609 if (state) { RESTORE; break; };
610 state = __BNF_input_string( "(" ); /* --- Call function --- */
611 if (state) { RESTORE; break; };
612 state = wc( ); /* --- Call function --- */
613 state = 0;
614 if (state) { RESTORE; break; };
615 state = string( ); /* --- Call function --- */
616 if (state) { RESTORE; break; };
617 state = wc( ); /* --- Call function --- */
618 state = 0;
619 if (state) { RESTORE; break; };
620 state = rparen( ); /* --- Call function --- */
621 if (state) { RESTORE; break; };
622 state = out_out_1_end( ); /* --- Call function --- */
623 if (state) { RESTORE; break; };
624 } while( 0 );
625
626 if (!state) break;
627 do {
628 HOLD;
629
630 state = __BNF_input_string( "`" ); /* --- Call function --- */
631 if (state) break;
632 state = out_out_2_begin( ); /* --- Call function --- */
633 if (state) { RESTORE; break; };
634 {
635 int firstloop = 1;
636 do {
637 state = o_stringchar( ); /* --- Call function --- */
638 if (firstloop)
639 {
640 if (state) break;
641 firstloop = 0;
642 }
643 } while ( !state );
644 state = firstloop;
645 }
646 state = 0;
647 if (state) { RESTORE; break; };
648 do {
649 do {
650 HOLD;
651
652 state = __BNF_input_string( "`" ); /* --- Call function --- */
653 if (state) break;
654 state = out_out_2_end( ); /* --- Call function --- */
655 if (state) { RESTORE; break; };
656 } while( 0 );
657
658 if (!state) break;
659 user_error( "Unterminated output string" ); /* --- Call function --- */
660 state = 0;
661 } while( 0 );
662
663 if (state) { RESTORE; break; };
664 } while( 0 );
665
666 } while( 0 );
667
668 return state;}
669
670 /* ---------------------------------------------------------------------*/
671 /* trans ::= 'trans' [<wc>] '(' [<wc>] <string> [<wc>] rparen*/
672 /* | '\"' [{t_stringchar}] '\"'*/
673 /**/
674
trans(void)675 int trans(void)
676 {
677 int state;
678
679 do {
680 do {
681 HOLD;
682
683 state = out_tran_1_begin( ); /* --- Call function --- */
684 if (state) break;
685 state = __BNF_input_string( "trans" ); /* --- Call function --- */
686 if (state) { RESTORE; break; };
687 state = wc( ); /* --- Call function --- */
688 state = 0;
689 if (state) { RESTORE; break; };
690 state = __BNF_input_string( "(" ); /* --- Call function --- */
691 if (state) { RESTORE; break; };
692 state = wc( ); /* --- Call function --- */
693 state = 0;
694 if (state) { RESTORE; break; };
695 state = string( ); /* --- Call function --- */
696 if (state) { RESTORE; break; };
697 state = wc( ); /* --- Call function --- */
698 state = 0;
699 if (state) { RESTORE; break; };
700 state = rparen( ); /* --- Call function --- */
701 if (state) { RESTORE; break; };
702 state = out_tran_1_end( ); /* --- Call function --- */
703 if (state) { RESTORE; break; };
704 } while( 0 );
705
706 if (!state) break;
707 do {
708 HOLD;
709
710 state = __BNF_input_string( "\"" ); /* --- Call function --- */
711 if (state) break;
712 state = out_tran_2_begin( ); /* --- Call function --- */
713 if (state) { RESTORE; break; };
714 {
715 int firstloop = 1;
716 do {
717 state = t_stringchar( ); /* --- Call function --- */
718 if (firstloop)
719 {
720 if (state) break;
721 firstloop = 0;
722 }
723 } while ( !state );
724 state = firstloop;
725 }
726 state = 0;
727 if (state) { RESTORE; break; };
728 do {
729 do {
730 HOLD;
731
732 state = __BNF_input_string( "\"" ); /* --- Call function --- */
733 if (state) break;
734 state = out_tran_2_end( ); /* --- Call function --- */
735 if (state) { RESTORE; break; };
736 } while( 0 );
737
738 if (!state) break;
739 user_error( "Unterminated trans string" ); /* --- Call function --- */
740 state = 0;
741 } while( 0 );
742
743 if (state) { RESTORE; break; };
744 } while( 0 );
745
746 } while( 0 );
747
748 return state;}
749
750 /* ---------------------------------------------------------------------*/
751 /* syntax_error ::= 'error' [wc] '(' [wc] string [wc] rparen*/
752 /**/
753
syntax_error(void)754 int syntax_error(void)
755 {
756 int state;
757
758 do {
759 HOLD;
760
761 state = __BNF_input_string( "error" ); /* --- Call function --- */
762 if (state) break;
763 state = wc( ); /* --- Call function --- */
764 state = 0;
765 if (state) { RESTORE; break; };
766 state = __BNF_input_string( "(" ); /* --- Call function --- */
767 if (state) { RESTORE; break; };
768 state = wc( ); /* --- Call function --- */
769 state = 0;
770 if (state) { RESTORE; break; };
771 state = out_err_begin( ); /* --- Call function --- */
772 if (state) { RESTORE; break; };
773 state = string( ); /* --- Call function --- */
774 if (state) { RESTORE; break; };
775 state = wc( ); /* --- Call function --- */
776 state = 0;
777 if (state) { RESTORE; break; };
778 state = rparen( ); /* --- Call function --- */
779 if (state) { RESTORE; break; };
780 state = out_err_end( ); /* --- Call function --- */
781 if (state) { RESTORE; break; };
782 } while( 0 );
783
784 return state;}
785
786 /* ---------------------------------------------------------------------*/
787 /* There is NO white allowed between name and '(', or we would*/
788 /* have a serious problem. still I think that this solution is*/
789 /* NOT clear, and this should be changed in the future...*/
790 /**/
791
function(void)792 int function(void)
793 {
794 int state;
795
796 do {
797 state = valid_name( ); /* --- Call function --- */
798 if (!state) break;
799 do {
800 HOLD;
801
802 state = name( ); /* --- Call function --- */
803 if (state) break;
804 state = __BNF_input_string( "(" ); /* --- Call function --- */
805 if (state) { RESTORE; break; };
806 state = expression( ); /* --- Call function --- */
807 if (state) { RESTORE; break; };
808 state = rparen( ); /* --- Call function --- */
809 if (state) { RESTORE; break; };
810 } while( 0 );
811
812 } while( 0 );
813
814 return state;}
815
816 /* ---------------------------------------------------------------------*/
817 /* <identifier> ::= <name>*/
818 /**/
819
identifier(void)820 int identifier(void)
821 {
822 int state;
823
824 do {
825 state = valid_name( ); /* --- Call function --- */
826 if (!state) break;
827 do {
828 HOLD;
829
830 state = out_call_begin( ); /* --- Call function --- */
831 if (state) break;
832 state = name( ); /* --- Call function --- */
833 if (state) { RESTORE; break; };
834 state = out_call_end( ); /* --- Call function --- */
835 if (state) { RESTORE; break; };
836 } while( 0 );
837
838 } while( 0 );
839
840 return state;}
841
842 /* --------------------------------------------------------------------*/
843 /**/
844 /**/
845
valid_name(void)846 int valid_name(void)
847 {
848 int state;
849
850 do {
851 HOLD;
852
853 state = __BNF_input_string( "__BNF_" ); /* --- Call function --- */
854 if (state) break;
855 user_error( "names beginning with \'__BNF_\' are reserved" ); /* --- Call function --- */
856 state = 0;
857 if (state) { RESTORE; break; };
858 } while( 0 );
859
860 return state;}
861
862 /* ---------------------------------------------------------------------*/
863 /* <option> ::= '[' <expression> ']'*/
864 /**/
865
option(void)866 int option(void)
867 {
868 int state;
869
870 do {
871 HOLD;
872
873 state = __BNF_input_string( "[" ); /* --- Call function --- */
874 if (state) break;
875 state = expression( ); /* --- Call function --- */
876 if (state) { RESTORE; break; };
877 do {
878 state = __BNF_input_string( "]" ); /* --- Call function --- */
879 if (!state) break;
880 user_error( "\']\' expected" ); /* --- Call function --- */
881 state = 0;
882 } while( 0 );
883
884 if (state) { RESTORE; break; };
885 state = out_option( ); /* --- Call function --- */
886 if (state) { RESTORE; break; };
887 } while( 0 );
888
889 return state;}
890
891 /* ---------------------------------------------------------------------*/
892 /* <repetition> ::= '{' <expression> '}'*/
893 /**/
894
repetition(void)895 int repetition(void)
896 {
897 int state;
898
899 do {
900 HOLD;
901
902 state = __BNF_input_string( "{" ); /* --- Call function --- */
903 if (state) break;
904 state = out_rep_begin( ); /* --- Call function --- */
905 if (state) { RESTORE; break; };
906 state = expression( ); /* --- Call function --- */
907 if (state) { RESTORE; break; };
908 do {
909 state = __BNF_input_string( "}" ); /* --- Call function --- */
910 if (!state) break;
911 user_error( "\'}\' expected" ); /* --- Call function --- */
912 state = 0;
913 } while( 0 );
914
915 if (state) { RESTORE; break; };
916 state = out_rep_end( ); /* --- Call function --- */
917 if (state) { RESTORE; break; };
918 } while( 0 );
919
920 return state;}
921
922 /* ---------------------------------------------------------------------*/
923 /* <name> ::= <letter> (letter | digit)**/
924 /**/
925
name(void)926 int name(void)
927 {
928 int state;
929
930 do {
931 HOLD;
932
933 state = letter( ); /* --- Call function --- */
934 if (state) break;
935 {
936 int firstloop = 1;
937 do {
938 do {
939 state = letter( ); /* --- Call function --- */
940 if (!state) break;
941 state = digit( ); /* --- Call function --- */
942 } while( 0 );
943
944 if (firstloop)
945 {
946 if (state) break;
947 firstloop = 0;
948 }
949 } while ( !state );
950 state = firstloop;
951 }
952 state = 0;
953 if (state) { RESTORE; break; };
954 } while( 0 );
955
956 return state;}
957
958 /* ---------------------------------------------------------------------*/
959 /* <string> ::= string_el ( wc string_el )**/
960 /**/
961
string(void)962 int string(void)
963 {
964 int state;
965
966 do {
967 HOLD;
968
969 state = string_el( ); /* --- Call function --- */
970 if (state) break;
971 {
972 int firstloop = 1;
973 do {
974 do {
975 HOLD;
976
977 state = wc( ); /* --- Call function --- */
978 if (state) break;
979 state = out_str_seperator( ); /* --- Call function --- */
980 if (state) { RESTORE; break; };
981 state = string_el( ); /* --- Call function --- */
982 if (state) { RESTORE; break; };
983 } while( 0 );
984
985 if (firstloop)
986 {
987 if (state) break;
988 firstloop = 0;
989 }
990 } while ( !state );
991 state = firstloop;
992 }
993 state = 0;
994 if (state) { RESTORE; break; };
995 } while( 0 );
996
997 return state;}
998
999 /* ---------------------------------------------------------------------*/
1000 /* <string_el ::= '\'' [{stringchar}] '\''*/
1001 /**/
1002
string_el(void)1003 int string_el(void)
1004 {
1005 int state;
1006
1007 do {
1008 HOLD;
1009
1010 state = __BNF_input_string( "\'" ); /* --- Call function --- */
1011 if (state) break;
1012 state = out_str_ch( ); /* --- Call function --- */
1013 if (state) { RESTORE; break; };
1014 {
1015 int firstloop = 1;
1016 do {
1017 state = stringchar( ); /* --- Call function --- */
1018 if (firstloop)
1019 {
1020 if (state) break;
1021 firstloop = 0;
1022 }
1023 } while ( !state );
1024 state = firstloop;
1025 }
1026 state = 0;
1027 if (state) { RESTORE; break; };
1028 state = __BNF_input_string( "\'" ); /* --- Call function --- */
1029 if (state) { RESTORE; break; };
1030 state = out_str_ch( ); /* --- Call function --- */
1031 if (state) { RESTORE; break; };
1032 } while( 0 );
1033
1034 return state;}
1035
1036 /* ----------------------------------------------------------------------*/
1037 /* rparen ::= ')'*/
1038 /**/
1039
rparen(void)1040 int rparen(void)
1041 {
1042 int state;
1043
1044 do {
1045 state = __BNF_input_string( ")" ); /* --- Call function --- */
1046 if (!state) break;
1047 user_error( "\')\' expected" ); /* --- Call function --- */
1048 state = 0;
1049 } while( 0 );
1050
1051 return state;}
1052
1053 /* ----------------------------------------------------------------------*/
1054 /* wc ::= white or comment in an expression*/
1055 /**/
1056
wc(void)1057 int wc(void)
1058 {
1059 int state;
1060
1061 {
1062 int firstloop = 1;
1063 do {
1064 do {
1065 state = white( ); /* --- Call function --- */
1066 if (!state) break;
1067 state = comment( ); /* --- Call function --- */
1068 } while( 0 );
1069
1070 if (firstloop)
1071 {
1072 if (state) break;
1073 firstloop = 0;
1074 }
1075 } while ( !state );
1076 state = firstloop;
1077 }
1078 return state;}
1079
1080 /**/
1081 /* ---------------------------------------------------------------------*/
1082 /**/
1083 /* OUTPUT SECTION*/
1084 /**/
1085 /* ---------------------------------------------------------------------*/
1086 /**/
1087
out_lbrace(void)1088 int out_lbrace(void)
1089 {
1090 int state;
1091
1092 do {
1093 HOLD;
1094
1095 state = __BNF_output_string( "{\n" ); /* --- Call function --- */
1096 if (state) break;
1097 state = inc_level( ); /* --- Call function --- */
1098 if (state) { RESTORE; break; };
1099 } while( 0 );
1100
1101 return state;}
1102
1103
out_rbrace(void)1104 int out_rbrace(void)
1105 {
1106 int state;
1107
1108 do {
1109 HOLD;
1110
1111 state = dec_level( ); /* --- Call function --- */
1112 if (state) break;
1113 state = out_indent( ); /* --- Call function --- */
1114 if (state) { RESTORE; break; };
1115 state = __BNF_output_string( "}" ); /* --- Call function --- */
1116 if (state) { RESTORE; break; };
1117 } while( 0 );
1118
1119 return state;}
1120
1121
out_state_zero(void)1122 int out_state_zero(void)
1123 {
1124 int state;
1125
1126 do {
1127 HOLD;
1128
1129 state = out_indent( ); /* --- Call function --- */
1130 if (state) break;
1131 state = __BNF_output_string( "state = 0;\n" ); /* --- Call function --- */
1132 if (state) { RESTORE; break; };
1133 } while( 0 );
1134
1135 return state;}
1136
1137
out_do_begin(void)1138 int out_do_begin(void)
1139 {
1140 int state;
1141
1142 do {
1143 HOLD;
1144
1145 state = out_indent( ); /* --- Call function --- */
1146 if (state) break;
1147 state = __BNF_output_string( "do " ); /* --- Call function --- */
1148 if (state) { RESTORE; break; };
1149 state = out_lbrace( ); /* --- Call function --- */
1150 if (state) { RESTORE; break; };
1151 } while( 0 );
1152
1153 return state;}
1154
1155
out_do_end(void)1156 int out_do_end(void)
1157 {
1158 int state;
1159
1160 do {
1161 HOLD;
1162
1163 state = out_rbrace( ); /* --- Call function --- */
1164 if (state) break;
1165 state = __BNF_output_string( " while( 0 );\n\n" ); /* --- Call function --- */
1166 if (state) { RESTORE; break; };
1167 } while( 0 );
1168
1169 return state;}
1170
1171
out_hold(void)1172 int out_hold(void)
1173 {
1174 int state;
1175
1176 do {
1177 HOLD;
1178
1179 state = out_indent( ); /* --- Call function --- */
1180 if (state) break;
1181 state = __BNF_output_string( "HOLD; /* --- remember current I/O state --- */\n" ); /* --- Call function --- */
1182 if (state) { RESTORE; break; };
1183 } while( 0 );
1184
1185 return state;}
1186
1187
out_restore(void)1188 int out_restore(void)
1189 {
1190 int state;
1191
1192 state = __BNF_output_string( "RESTORE; /* --- restore I/O state --- */" ); /* --- Call function --- */
1193 return state;}
1194
1195
out_do_hold_begin(void)1196 int out_do_hold_begin(void)
1197 {
1198 int state;
1199
1200 do {
1201 HOLD;
1202
1203 state = out_do_begin( ); /* --- Call function --- */
1204 if (state) break;
1205 state = out_indent( ); /* --- Call function --- */
1206 if (state) { RESTORE; break; };
1207 state = __BNF_output_string( "HOLD;\n\n" ); /* --- Call function --- */
1208 if (state) { RESTORE; break; };
1209 } while( 0 );
1210
1211 return state;}
1212
1213
out_endfn(void)1214 int out_endfn(void)
1215 {
1216 int state;
1217
1218 state = __BNF_output_string( " ); /* --- Call function --- */\n" ); /* --- Call function --- */
1219 return state;}
1220
1221
out_end_strfn(void)1222 int out_end_strfn(void)
1223 {
1224 int state;
1225
1226 do {
1227 HOLD;
1228
1229 state = __BNF_output_string( " " ); /* --- Call function --- */
1230 if (state) break;
1231 state = out_endfn( ); /* --- Call function --- */
1232 if (state) { RESTORE; break; };
1233 } while( 0 );
1234
1235 return state;}
1236
1237
out_set_state(void)1238 int out_set_state(void)
1239 {
1240 int state;
1241
1242 do {
1243 HOLD;
1244
1245 state = out_indent( ); /* --- Call function --- */
1246 if (state) break;
1247 state = __BNF_output_string( "state = " ); /* --- Call function --- */
1248 if (state) { RESTORE; break; };
1249 } while( 0 );
1250
1251 return state;}
1252
1253
out_break_on_accept(void)1254 int out_break_on_accept(void)
1255 {
1256 int state;
1257
1258 do {
1259 HOLD;
1260
1261 state = out_indent( ); /* --- Call function --- */
1262 if (state) break;
1263 state = __BNF_output_string( "if (!state) break;\n" ); /* --- Call function --- */
1264 if (state) { RESTORE; break; };
1265 } while( 0 );
1266
1267 return state;}
1268
1269
out_break_on_reject(void)1270 int out_break_on_reject(void)
1271 {
1272 int state;
1273
1274 do {
1275 HOLD;
1276
1277 state = out_indent( ); /* --- Call function --- */
1278 if (state) break;
1279 state = __BNF_output_string( "if (state) break;\n" ); /* --- Call function --- */
1280 if (state) { RESTORE; break; };
1281 } while( 0 );
1282
1283 return state;}
1284
1285
out_break_and_restore_on_reject(void)1286 int out_break_and_restore_on_reject(void)
1287 {
1288 int state;
1289
1290 do {
1291 HOLD;
1292
1293 state = out_indent( ); /* --- Call function --- */
1294 if (state) break;
1295 state = __BNF_output_string( "if (state) { RESTORE; break; };\n" ); /* --- Call function --- */
1296 if (state) { RESTORE; break; };
1297 } while( 0 );
1298
1299 return state;}
1300
1301 /* ---------------------------------------------------------------------*/
1302 /* out_header, out_footer: Generated code in the grammar rule*/
1303 /**/
1304
out_header(void)1305 int out_header(void)
1306 {
1307 int state;
1308
1309 do {
1310 HOLD;
1311
1312 state = __BNF_output_string( "/* This generated file is licenced and copyrighted under the same \n" ); /* --- Call function --- */
1313 if (state) break;
1314 state = __BNF_output_string( " * conditions as the sourcefile. Happy debugging:) */\n" ); /* --- Call function --- */
1315 if (state) { RESTORE; break; };
1316 state = __BNF_output_string( "\n" ); /* --- Call function --- */
1317 if (state) { RESTORE; break; };
1318 state = __BNF_output_string( "/*\n" ); /* --- Call function --- */
1319 if (state) { RESTORE; break; };
1320 state = __BNF_output_string( " defines:\n" ); /* --- Call function --- */
1321 if (state) { RESTORE; break; };
1322 state = __BNF_output_string( "*/\n" ); /* --- Call function --- */
1323 if (state) { RESTORE; break; };
1324 state = __BNF_output_string( "\n" ); /* --- Call function --- */
1325 if (state) { RESTORE; break; };
1326 state = __BNF_output_string( "#define HOLD unsigned hold___BNF_level = __BNF_level; char *hold___BNF_input = __BNF_input, *hold___BNF_output = __BNF_output\n" ); /* --- Call function --- */
1327 if (state) { RESTORE; break; };
1328 state = __BNF_output_string( "#define RESTORE {__BNF_level = hold___BNF_level; __BNF_input = hold___BNF_input; __BNF_output = hold___BNF_output;}\n" ); /* --- Call function --- */
1329 if (state) { RESTORE; break; };
1330 state = __BNF_output_string( "\n" ); /* --- Call function --- */
1331 if (state) { RESTORE; break; };
1332 state = __BNF_output_string( "#ifdef __TURBOC__\n" ); /* --- Call function --- */
1333 if (state) { RESTORE; break; };
1334 state = __BNF_output_string( "# pragma warn -pro\n" ); /* --- Call function --- */
1335 if (state) { RESTORE; break; };
1336 state = __BNF_output_string( "# pragma warn -nod\n" ); /* --- Call function --- */
1337 if (state) { RESTORE; break; };
1338 state = __BNF_output_string( "#endif\n" ); /* --- Call function --- */
1339 if (state) { RESTORE; break; };
1340 state = __BNF_output_string( "\n" ); /* --- Call function --- */
1341 if (state) { RESTORE; break; };
1342 state = __BNF_output_string( "#ifdef _MSC_VER\n" ); /* --- Call function --- */
1343 if (state) { RESTORE; break; };
1344 state = __BNF_output_string( "# pragma warning (disable:4013)\n" ); /* --- Call function --- */
1345 if (state) { RESTORE; break; };
1346 state = __BNF_output_string( "# pragma warning (disable:4005)\n" ); /* --- Call function --- */
1347 if (state) { RESTORE; break; };
1348 state = __BNF_output_string( "#endif\n" ); /* --- Call function --- */
1349 if (state) { RESTORE; break; };
1350 state = __BNF_output_string( "\n" ); /* --- Call function --- */
1351 if (state) { RESTORE; break; };
1352 state = __BNF_output_string( "/*\n" ); /* --- Call function --- */
1353 if (state) { RESTORE; break; };
1354 state = __BNF_output_string( " externals:\n" ); /* --- Call function --- */
1355 if (state) { RESTORE; break; };
1356 state = __BNF_output_string( "*/\n" ); /* --- Call function --- */
1357 if (state) { RESTORE; break; };
1358 state = __BNF_output_string( "\n" ); /* --- Call function --- */
1359 if (state) { RESTORE; break; };
1360 state = __BNF_output_string( "extern char *__BNF_input, *__BNF_output;\nextern unsigned __BNF_level;\n" ); /* --- Call function --- */
1361 if (state) { RESTORE; break; };
1362 state = __BNF_output_string( "extern unsigned int __BNF_tabsize;\n" ); /* --- Call function --- */
1363 if (state) { RESTORE; break; };
1364 state = __BNF_output_string( "\n" ); /* --- Call function --- */
1365 if (state) { RESTORE; break; };
1366 state = __BNF_output_string( "extern int __BNF_trans_string(char *),\n" ); /* --- Call function --- */
1367 if (state) { RESTORE; break; };
1368 state = __BNF_output_string( " __BNF_input_string(char *), __BNF_output_string(char *),\n" ); /* --- Call function --- */
1369 if (state) { RESTORE; break; };
1370 state = __BNF_output_string( " __BNF_trans_char(void), __BNF_swap(char *, char *, char *);\n" ); /* --- Call function --- */
1371 if (state) { RESTORE; break; };
1372 state = __BNF_output_string( "\n" ); /* --- Call function --- */
1373 if (state) { RESTORE; break; };
1374 state = __BNF_output_string( "\n" ); /* --- Call function --- */
1375 if (state) { RESTORE; break; };
1376 state = __BNF_output_string( "extern void user_error(char *); /* user provided error handler must TERMINATE */\n" ); /* --- Call function --- */
1377 if (state) { RESTORE; break; };
1378 state = __BNF_output_string( "\n" ); /* --- Call function --- */
1379 if (state) { RESTORE; break; };
1380 state = __BNF_output_string( "\n" ); /* --- Call function --- */
1381 if (state) { RESTORE; break; };
1382 } while( 0 );
1383
1384 return state;}
1385
1386
out_footer(void)1387 int out_footer(void)
1388 {
1389 int state;
1390
1391 do {
1392 HOLD;
1393
1394 state = __BNF_output_string( "\n\n" ); /* --- Call function --- */
1395 if (state) break;
1396 state = out_comment_begin( ); /* --- Call function --- */
1397 if (state) { RESTORE; break; };
1398 state = __BNF_output_string( " begining of standard utility functions " ); /* --- Call function --- */
1399 if (state) { RESTORE; break; };
1400 state = out_comment_end( ); /* --- Call function --- */
1401 if (state) { RESTORE; break; };
1402 state = __BNF_output_string( "\n" ); /* --- Call function --- */
1403 if (state) { RESTORE; break; };
1404 state = now_do_the_builtins_dump_mister( ); /* --- Call function --- */
1405 if (state) { RESTORE; break; };
1406 state = now_do_the_strfilio_mister( ); /* --- Call function --- */
1407 if (state) { RESTORE; break; };
1408 } while( 0 );
1409
1410 return state;}
1411
1412 /* ---------------------------------------------------------------------*/
1413 /* out_comment_begin, out_comment_end: Generated code in the comment rule*/
1414 /**/
1415
out_comment_begin(void)1416 int out_comment_begin(void)
1417 {
1418 int state;
1419
1420 state = __BNF_output_string( "/*" ); /* --- Call function --- */
1421 return state;}
1422
1423
out_comment_end(void)1424 int out_comment_end(void)
1425 {
1426 int state;
1427
1428 state = __BNF_output_string( "*/\n" ); /* --- Call function --- */
1429 return state;}
1430
1431 /* ---------------------------------------------------------------------*/
1432 /* out_func_begin, out_func_end:*/
1433 /* Generated code in the assigment rule.*/
1434 /**/
1435
out_func_type(void)1436 int out_func_type(void)
1437 {
1438 int state;
1439
1440 state = __BNF_output_string( "\nint " ); /* --- Call function --- */
1441 return state;}
1442
1443
out_func_begin(void)1444 int out_func_begin(void)
1445 {
1446 int state;
1447
1448 do {
1449 HOLD;
1450
1451 state = __BNF_output_string( "(void)\n" ); /* --- Call function --- */
1452 if (state) break;
1453 state = out_lbrace( ); /* --- Call function --- */
1454 if (state) { RESTORE; break; };
1455 state = out_indent( ); /* --- Call function --- */
1456 if (state) { RESTORE; break; };
1457 state = __BNF_output_string( "int state;\n\n" ); /* --- Call function --- */
1458 if (state) { RESTORE; break; };
1459 } while( 0 );
1460
1461 return state;}
1462
1463
out_expr_empty(void)1464 int out_expr_empty(void)
1465 {
1466 int state;
1467
1468 state = out_state_zero( ); /* --- Call function --- */
1469 return state;}
1470
1471
out_func_end(void)1472 int out_func_end(void)
1473 {
1474 int state;
1475
1476 do {
1477 HOLD;
1478
1479 state = out_indent( ); /* --- Call function --- */
1480 if (state) break;
1481 state = __BNF_output_string( "return state;" ); /* --- Call function --- */
1482 if (state) { RESTORE; break; };
1483 state = out_rbrace( ); /* --- Call function --- */
1484 if (state) { RESTORE; break; };
1485 state = __BNF_output_string( "\n\n" ); /* --- Call function --- */
1486 if (state) { RESTORE; break; };
1487 } while( 0 );
1488
1489 return state;}
1490
1491 /* ---------------------------------------------------------------------*/
1492 /* out_or_begin, out_or_end, out_or_end:*/
1493 /**/
1494
out_or_begin(void)1495 int out_or_begin(void)
1496 {
1497 int state;
1498
1499 state = out_do_begin( ); /* --- Call function --- */
1500 return state;}
1501
1502
out_or_operator(void)1503 int out_or_operator(void)
1504 {
1505 int state;
1506
1507 state = out_break_on_accept( ); /* --- Call function --- */
1508 return state;}
1509
1510
out_or_end(void)1511 int out_or_end(void)
1512 {
1513 int state;
1514
1515 state = out_do_end( ); /* --- Call function --- */
1516 return state;}
1517
1518 /* ---------------------------------------------------------------------*/
1519 /* out_and_begin,out_and_1,out_and_2,out_and_end:*/
1520 /**/
1521
out_and_begin(void)1522 int out_and_begin(void)
1523 {
1524 int state;
1525
1526 state = out_do_hold_begin( ); /* --- Call function --- */
1527 return state;}
1528
1529
out_and_1(void)1530 int out_and_1(void)
1531 {
1532 int state;
1533
1534 state = out_break_on_reject( ); /* --- Call function --- */
1535 return state;}
1536
1537
out_and_2(void)1538 int out_and_2(void)
1539 {
1540 int state;
1541
1542 state = out_break_and_restore_on_reject( ); /* --- Call function --- */
1543 return state;}
1544
1545
out_and_end(void)1546 int out_and_end(void)
1547 {
1548 int state;
1549
1550 state = out_do_end( ); /* --- Call function --- */
1551 return state;}
1552
1553 /*------------------------------------------------------*/
1554 /* output for 'swapped and'*/
1555 /**/
1556
out_swp_begin(void)1557 int out_swp_begin(void)
1558 {
1559 int state;
1560
1561 do {
1562 HOLD;
1563
1564 state = out_do_hold_begin( ); /* --- Call function --- */
1565 if (state) break;
1566 state = out_indent( ); /* --- Call function --- */
1567 if (state) { RESTORE; break; };
1568 state = __BNF_output_string( "register char *swap_first = __BNF_output, *swap_second;\n" ); /* --- Call function --- */
1569 if (state) { RESTORE; break; };
1570 } while( 0 );
1571
1572 return state;}
1573
1574
out_swp_1(void)1575 int out_swp_1(void)
1576 {
1577 int state;
1578
1579 state = out_break_on_reject( ); /* --- Call function --- */
1580 return state;}
1581
1582
out_swp_2(void)1583 int out_swp_2(void)
1584 {
1585 int state;
1586
1587 do {
1588 HOLD;
1589
1590 state = out_indent( ); /* --- Call function --- */
1591 if (state) break;
1592 state = __BNF_output_string( "swap_second = __BNF_output;\n" ); /* --- Call function --- */
1593 if (state) { RESTORE; break; };
1594 } while( 0 );
1595
1596 return state;}
1597
1598
out_swp_3(void)1599 int out_swp_3(void)
1600 {
1601 int state;
1602
1603 do {
1604 HOLD;
1605
1606 state = out_break_and_restore_on_reject( ); /* --- Call function --- */
1607 if (state) break;
1608 state = out_indent( ); /* --- Call function --- */
1609 if (state) { RESTORE; break; };
1610 state = __BNF_output_string( "__BNF_swap( swap_first, swap_second, __BNF_output );\n" ); /* --- Call function --- */
1611 if (state) { RESTORE; break; };
1612 state = out_indent( ); /* --- Call function --- */
1613 if (state) { RESTORE; break; };
1614 state = __BNF_output_string( "swap_first = __BNF_output;\n" ); /* --- Call function --- */
1615 if (state) { RESTORE; break; };
1616 } while( 0 );
1617
1618 return state;}
1619
1620
out_swp_4(void)1621 int out_swp_4(void)
1622 {
1623 int state;
1624
1625 state = out_break_and_restore_on_reject( ); /* --- Call function --- */
1626 return state;}
1627
1628
out_swp_end(void)1629 int out_swp_end(void)
1630 {
1631 int state;
1632
1633 state = out_do_end( ); /* --- Call function --- */
1634 return state;}
1635
1636 /*-------------------------------------------------------*/
1637 /* output for 'option'*/
1638 /**/
1639
out_option(void)1640 int out_option(void)
1641 {
1642 int state;
1643
1644 state = out_state_zero( ); /* --- Call function --- */
1645 return state;}
1646
1647 /*------------------------------------------*/
1648 /* output for 'repetition'*/
1649 /**/
1650
out_rep_begin(void)1651 int out_rep_begin(void)
1652 {
1653 int state;
1654
1655 do {
1656 HOLD;
1657
1658 state = out_indent( ); /* --- Call function --- */
1659 if (state) break;
1660 state = out_lbrace( ); /* --- Call function --- */
1661 if (state) { RESTORE; break; };
1662 state = out_indent( ); /* --- Call function --- */
1663 if (state) { RESTORE; break; };
1664 state = __BNF_output_string( "int firstloop = 1;\n" ); /* --- Call function --- */
1665 if (state) { RESTORE; break; };
1666 state = out_do_begin( ); /* --- Call function --- */
1667 if (state) { RESTORE; break; };
1668 } while( 0 );
1669
1670 return state;}
1671
1672
out_rep_end(void)1673 int out_rep_end(void)
1674 {
1675 int state;
1676
1677 do {
1678 HOLD;
1679
1680 state = out_indent( ); /* --- Call function --- */
1681 if (state) break;
1682 state = __BNF_output_string( "if (firstloop)\n" ); /* --- Call function --- */
1683 if (state) { RESTORE; break; };
1684 state = out_indent( ); /* --- Call function --- */
1685 if (state) { RESTORE; break; };
1686 state = out_lbrace( ); /* --- Call function --- */
1687 if (state) { RESTORE; break; };
1688 state = out_indent( ); /* --- Call function --- */
1689 if (state) { RESTORE; break; };
1690 state = __BNF_output_string( "if (state) break;\n" ); /* --- Call function --- */
1691 if (state) { RESTORE; break; };
1692 state = out_indent( ); /* --- Call function --- */
1693 if (state) { RESTORE; break; };
1694 state = __BNF_output_string( "firstloop = 0;\n" ); /* --- Call function --- */
1695 if (state) { RESTORE; break; };
1696 state = out_rbrace( ); /* --- Call function --- */
1697 if (state) { RESTORE; break; };
1698 state = __BNF_output_string( "\n" ); /* --- Call function --- */
1699 if (state) { RESTORE; break; };
1700 state = out_rbrace( ); /* --- Call function --- */
1701 if (state) { RESTORE; break; };
1702 state = __BNF_output_string( " while ( !state );\n" ); /* --- Call function --- */
1703 if (state) { RESTORE; break; };
1704 state = out_indent( ); /* --- Call function --- */
1705 if (state) { RESTORE; break; };
1706 state = __BNF_output_string( "state = firstloop;\n" ); /* --- Call function --- */
1707 if (state) { RESTORE; break; };
1708 state = out_rbrace( ); /* --- Call function --- */
1709 if (state) { RESTORE; break; };
1710 state = __BNF_output_string( "\n" ); /* --- Call function --- */
1711 if (state) { RESTORE; break; };
1712 } while( 0 );
1713
1714 return state;}
1715
1716 /*---------------------------------------------*/
1717 /* output for 'trans any character' (a shortcut...)*/
1718 /**/
1719
out_trans_char(void)1720 int out_trans_char(void)
1721 {
1722 int state;
1723
1724 do {
1725 HOLD;
1726
1727 state = out_call_begin( ); /* --- Call function --- */
1728 if (state) break;
1729 state = __BNF_output_string( "__BNF_trans_char" ); /* --- Call function --- */
1730 if (state) { RESTORE; break; };
1731 state = out_call_end( ); /* --- Call function --- */
1732 if (state) { RESTORE; break; };
1733 } while( 0 );
1734
1735 return state;}
1736
1737 /* ---------------------------------------------*/
1738 /* output for 'input a string'*/
1739 /**/
1740
out_str_begin(void)1741 int out_str_begin(void)
1742 {
1743 int state;
1744
1745 do {
1746 HOLD;
1747
1748 state = out_set_state( ); /* --- Call function --- */
1749 if (state) break;
1750 state = __BNF_output_string( "__BNF_input_string( " ); /* --- Call function --- */
1751 if (state) { RESTORE; break; };
1752 } while( 0 );
1753
1754 return state;}
1755
1756
out_str_end(void)1757 int out_str_end(void)
1758 {
1759 int state;
1760
1761 state = out_end_strfn( ); /* --- Call function --- */
1762 return state;}
1763
1764 /*------------------------------------------------------*/
1765 /* output for 'output a string'*/
1766 /**/
1767
out_out_1_begin(void)1768 int out_out_1_begin(void)
1769 {
1770 int state;
1771
1772 do {
1773 HOLD;
1774
1775 state = out_set_state( ); /* --- Call function --- */
1776 if (state) break;
1777 state = __BNF_output_string( "__BNF_output_string( " ); /* --- Call function --- */
1778 if (state) { RESTORE; break; };
1779 } while( 0 );
1780
1781 return state;}
1782
1783
out_out_1_end(void)1784 int out_out_1_end(void)
1785 {
1786 int state;
1787
1788 state = out_end_strfn( ); /* --- Call function --- */
1789 return state;}
1790
1791
out_out_2_begin(void)1792 int out_out_2_begin(void)
1793 {
1794 int state;
1795
1796 do {
1797 HOLD;
1798
1799 state = out_set_state( ); /* --- Call function --- */
1800 if (state) break;
1801 state = __BNF_output_string( "__BNF_output_string( \"" ); /* --- Call function --- */
1802 if (state) { RESTORE; break; };
1803 } while( 0 );
1804
1805 return state;}
1806
1807
out_out_2_end(void)1808 int out_out_2_end(void)
1809 {
1810 int state;
1811
1812 do {
1813 HOLD;
1814
1815 state = __BNF_output_string( "\"" ); /* --- Call function --- */
1816 if (state) break;
1817 state = out_end_strfn( ); /* --- Call function --- */
1818 if (state) { RESTORE; break; };
1819 } while( 0 );
1820
1821 return state;}
1822
1823 /*---------------------------------*/
1824 /* output for 'trans a string'*/
1825 /**/
1826
out_tran_1_begin(void)1827 int out_tran_1_begin(void)
1828 {
1829 int state;
1830
1831 do {
1832 HOLD;
1833
1834 state = out_call_begin( ); /* --- Call function --- */
1835 if (state) break;
1836 state = __BNF_output_string( "__BNF_trans_string( " ); /* --- Call function --- */
1837 if (state) { RESTORE; break; };
1838 } while( 0 );
1839
1840 return state;}
1841
1842
out_tran_1_end(void)1843 int out_tran_1_end(void)
1844 {
1845 int state;
1846
1847 state = out_end_strfn( ); /* --- Call function --- */
1848 return state;}
1849
1850
out_tran_2_begin(void)1851 int out_tran_2_begin(void)
1852 {
1853 int state;
1854
1855 do {
1856 HOLD;
1857
1858 state = out_call_begin( ); /* --- Call function --- */
1859 if (state) break;
1860 state = __BNF_output_string( "__BNF_trans_string( \"" ); /* --- Call function --- */
1861 if (state) { RESTORE; break; };
1862 } while( 0 );
1863
1864 return state;}
1865
1866
out_tran_2_end(void)1867 int out_tran_2_end(void)
1868 {
1869 int state;
1870
1871 do {
1872 HOLD;
1873
1874 state = __BNF_output_string( "\"" ); /* --- Call function --- */
1875 if (state) break;
1876 state = out_end_strfn( ); /* --- Call function --- */
1877 if (state) { RESTORE; break; };
1878 } while( 0 );
1879
1880 return state;}
1881
1882 /* ---------------------------------*/
1883 /* output for 'error(...)' call*/
1884 /**/
1885
out_err_begin(void)1886 int out_err_begin(void)
1887 {
1888 int state;
1889
1890 do {
1891 HOLD;
1892
1893 state = out_indent( ); /* --- Call function --- */
1894 if (state) break;
1895 state = __BNF_output_string( "user_error( " ); /* --- Call function --- */
1896 if (state) { RESTORE; break; };
1897 } while( 0 );
1898
1899 return state;}
1900
1901
out_err_end(void)1902 int out_err_end(void)
1903 {
1904 int state;
1905
1906 do {
1907 HOLD;
1908
1909 state = out_end_strfn( ); /* --- Call function --- */
1910 if (state) break;
1911 state = out_state_zero( ); /* --- Call function --- */
1912 if (state) { RESTORE; break; };
1913 } while( 0 );
1914
1915 return state;}
1916
1917 /*--------------------------------------------*/
1918 /* output for <call>*/
1919 /**/
1920
out_call_begin(void)1921 int out_call_begin(void)
1922 {
1923 int state;
1924
1925 state = out_set_state( ); /* --- Call function --- */
1926 return state;}
1927
1928
out_call_end(void)1929 int out_call_end(void)
1930 {
1931 int state;
1932
1933 do {
1934 HOLD;
1935
1936 state = __BNF_output_string( "(" ); /* --- Call function --- */
1937 if (state) break;
1938 state = out_endfn( ); /* --- Call function --- */
1939 if (state) { RESTORE; break; };
1940 } while( 0 );
1941
1942 return state;}
1943
1944 /*----------------------------------------------*/
1945 /* output a 'string start/stop symbol' (`"` in C)*/
1946 /**/
1947
out_str_ch(void)1948 int out_str_ch(void)
1949 {
1950 int state;
1951
1952 state = __BNF_output_string( "\"" ); /* --- Call function --- */
1953 return state;}
1954
1955 /*-------------------------*/
1956 /* output between multiple spaces*/
1957 /**/
1958
out_str_seperator(void)1959 int out_str_seperator(void)
1960 {
1961 int state;
1962
1963 do {
1964 HOLD;
1965
1966 state = __BNF_output_string( "\n" ); /* --- Call function --- */
1967 if (state) break;
1968 state = out_indent( ); /* --- Call function --- */
1969 if (state) { RESTORE; break; };
1970 } while( 0 );
1971
1972 return state;}
1973
1974 /* eof*/
1975
now_do_the_builtins_dump_mister(void)1976 int now_do_the_builtins_dump_mister(void)
1977 {
1978 int state;
1979
1980 do {
1981 HOLD;
1982
1983 state = __BNF_output_string( "\n" ); /* --- Call function --- */
1984 if (state) break;
1985 state = __BNF_output_string( "\n" ); /* --- Call function --- */
1986 if (state) { RESTORE; break; };
1987 state = __BNF_output_string( "#include <stdio.h> /* for EOF */\n" ); /* --- Call function --- */
1988 if (state) { RESTORE; break; };
1989 state = __BNF_output_string( "#include <ctype.h>\n" ); /* --- Call function --- */
1990 if (state) { RESTORE; break; };
1991 state = __BNF_output_string( "#include <stdlib.h>\n" ); /* --- Call function --- */
1992 if (state) { RESTORE; break; };
1993 state = __BNF_output_string( "#include <string.h>\n" ); /* --- Call function --- */
1994 if (state) { RESTORE; break; };
1995 state = __BNF_output_string( "\n" ); /* --- Call function --- */
1996 if (state) { RESTORE; break; };
1997 state = __BNF_output_string( "/*#define HOLD unsigned hold___BNF_level = __BNF_level; char *hold___BNF_input = __BNF_input, *hold___BNF_output = __BNF_output\n" ); /* --- Call function --- */
1998 if (state) { RESTORE; break; };
1999 state = __BNF_output_string( "#define RESTORE {__BNF_level = hold___BNF_level, __BNF_input = hold___BNF_input; __BNF_output = hold___BNF_output;}*/\n" ); /* --- Call function --- */
2000 if (state) { RESTORE; break; };
2001 state = __BNF_output_string( "#define DEFUN(f) int f(void)\n" ); /* --- Call function --- */
2002 if (state) { RESTORE; break; };
2003 state = __BNF_output_string( "#define CALL(f) state = f();\n" ); /* --- Call function --- */
2004 if (state) { RESTORE; break; };
2005 state = __BNF_output_string( "#define IN__BNF_put(s) state = __BNF_input_string( s );\n" ); /* --- Call function --- */
2006 if (state) { RESTORE; break; };
2007 state = __BNF_output_string( "#define OUT__BNF_put(s) state = __BNF_output_string( s );\n" ); /* --- Call function --- */
2008 if (state) { RESTORE; break; };
2009 state = __BNF_output_string( "#define FUN_begin { int state; HOLD;\n" ); /* --- Call function --- */
2010 if (state) { RESTORE; break; };
2011 state = __BNF_output_string( "#define FUN_end if (state) RESTORE; return state; }\n" ); /* --- Call function --- */
2012 if (state) { RESTORE; break; };
2013 state = __BNF_output_string( "#define AND_begin do { HOLD;\n" ); /* --- Call function --- */
2014 if (state) { RESTORE; break; };
2015 state = __BNF_output_string( "#define AND_1 if (state) break;\n" ); /* --- Call function --- */
2016 if (state) { RESTORE; break; };
2017 state = __BNF_output_string( "#define AND_2 if (state) { RESTORE; break; }\n" ); /* --- Call function --- */
2018 if (state) { RESTORE; break; };
2019 state = __BNF_output_string( "#define AND_end } while (0);\n" ); /* --- Call function --- */
2020 if (state) { RESTORE; break; };
2021 state = __BNF_output_string( "#define OR_begin do {\n" ); /* --- Call function --- */
2022 if (state) { RESTORE; break; };
2023 state = __BNF_output_string( "#define OR_1 if (!state) break;\n" ); /* --- Call function --- */
2024 if (state) { RESTORE; break; };
2025 state = __BNF_output_string( "#define OR_end } while (0);\n" ); /* --- Call function --- */
2026 if (state) { RESTORE; break; };
2027 state = __BNF_output_string( "#define OPT_begin\n" ); /* --- Call function --- */
2028 if (state) { RESTORE; break; };
2029 state = __BNF_output_string( "#define OPT_end state = 0;\n" ); /* --- Call function --- */
2030 if (state) { RESTORE; break; };
2031 state = __BNF_output_string( "#define REP_begin { inte firstloop=1; do {\n" ); /* --- Call function --- */
2032 if (state) { RESTORE; break; };
2033 state = __BNF_output_string( "#define REP_end if (firstloop) {if(state) break; firstloop=0;} } while (!state); state=firstloop; }\n" ); /* --- Call function --- */
2034 if (state) { RESTORE; break; };
2035 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2036 if (state) { RESTORE; break; };
2037 state = __BNF_output_string( "extern char *__BNF_input, *__BNF_output;\n" ); /* --- Call function --- */
2038 if (state) { RESTORE; break; };
2039 state = __BNF_output_string( "unsigned __BNF_level;\n" ); /* --- Call function --- */
2040 if (state) { RESTORE; break; };
2041 state = __BNF_output_string( "unsigned int __BNF_rulecnt;" ); /* --- Call function --- */
2042 if (state) { RESTORE; break; };
2043 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2044 if (state) { RESTORE; break; };
2045 state = __BNF_output_string( "/* we need some prototypes .... */\n" ); /* --- Call function --- */
2046 if (state) { RESTORE; break; };
2047 state = __BNF_output_string( "int __BNF_get(void); /* returns EOF when eof read... */\n" ); /* --- Call function --- */
2048 if (state) { RESTORE; break; };
2049 state = __BNF_output_string( "int __BNF_flush(void);\n" ); /* --- Call function --- */
2050 if (state) { RESTORE; break; };
2051 state = __BNF_output_string( "#define __BNF_put(ch) *__BNF_output++ = (ch)\n" ); /* --- Call function --- */
2052 if (state) { RESTORE; break; };
2053 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2054 if (state) { RESTORE; break; };
2055 state = __BNF_output_string( "int __BNF_input_string( char *s )\n" ); /* --- Call function --- */
2056 if (state) { RESTORE; break; };
2057 state = __BNF_output_string( "FUN_begin\n" ); /* --- Call function --- */
2058 if (state) { RESTORE; break; };
2059 state = __BNF_output_string( " char *t;\n" ); /* --- Call function --- */
2060 if (state) { RESTORE; break; };
2061 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2062 if (state) { RESTORE; break; };
2063 state = __BNF_output_string( " for (t = s, state = 0; *t; t++)\n" ); /* --- Call function --- */
2064 if (state) { RESTORE; break; };
2065 state = __BNF_output_string( " if ((state = (__BNF_get() != *t)) != 0) break;\n" ); /* --- Call function --- */
2066 if (state) { RESTORE; break; };
2067 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2068 if (state) { RESTORE; break; };
2069 state = __BNF_output_string( "FUN_end\n" ); /* --- Call function --- */
2070 if (state) { RESTORE; break; };
2071 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2072 if (state) { RESTORE; break; };
2073 state = __BNF_output_string( "int __BNF_output_string( char *source )\n" ); /* --- Call function --- */
2074 if (state) { RESTORE; break; };
2075 state = __BNF_output_string( "{\n" ); /* --- Call function --- */
2076 if (state) { RESTORE; break; };
2077 state = __BNF_output_string( " register char *s = source, *t = __BNF_output;\n" ); /* --- Call function --- */
2078 if (state) { RESTORE; break; };
2079 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2080 if (state) { RESTORE; break; };
2081 state = __BNF_output_string( " while ( *s ) *t++ = *s++;\n" ); /* --- Call function --- */
2082 if (state) { RESTORE; break; };
2083 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2084 if (state) { RESTORE; break; };
2085 state = __BNF_output_string( " __BNF_output = t;\n" ); /* --- Call function --- */
2086 if (state) { RESTORE; break; };
2087 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2088 if (state) { RESTORE; break; };
2089 state = __BNF_output_string( " return 0;\n" ); /* --- Call function --- */
2090 if (state) { RESTORE; break; };
2091 state = __BNF_output_string( "}\n" ); /* --- Call function --- */
2092 if (state) { RESTORE; break; };
2093 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2094 if (state) { RESTORE; break; };
2095 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2096 if (state) { RESTORE; break; };
2097 state = __BNF_output_string( "int __BNF_trans_string( char *str )\n" ); /* --- Call function --- */
2098 if (state) { RESTORE; break; };
2099 state = __BNF_output_string( "FUN_begin\n" ); /* --- Call function --- */
2100 if (state) { RESTORE; break; };
2101 state = __BNF_output_string( " char *s, ch;\n" ); /* --- Call function --- */
2102 if (state) { RESTORE; break; };
2103 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2104 if (state) { RESTORE; break; };
2105 state = __BNF_output_string( " for ( s = str; *s; s++) {\n" ); /* --- Call function --- */
2106 if (state) { RESTORE; break; };
2107 state = __BNF_output_string( " ch = __BNF_get();\n" ); /* --- Call function --- */
2108 if (state) { RESTORE; break; };
2109 state = __BNF_output_string( " if ( ch == *s )\n" ); /* --- Call function --- */
2110 if (state) { RESTORE; break; };
2111 state = __BNF_output_string( " __BNF_put( ch );\n" ); /* --- Call function --- */
2112 if (state) { RESTORE; break; };
2113 state = __BNF_output_string( " else {\n" ); /* --- Call function --- */
2114 if (state) { RESTORE; break; };
2115 state = __BNF_output_string( " RESTORE;\n" ); /* --- Call function --- */
2116 if (state) { RESTORE; break; };
2117 state = __BNF_output_string( " return 1;\n" ); /* --- Call function --- */
2118 if (state) { RESTORE; break; };
2119 state = __BNF_output_string( " }\n" ); /* --- Call function --- */
2120 if (state) { RESTORE; break; };
2121 state = __BNF_output_string( " }\n" ); /* --- Call function --- */
2122 if (state) { RESTORE; break; };
2123 state = __BNF_output_string( " state = 0;\n" ); /* --- Call function --- */
2124 if (state) { RESTORE; break; };
2125 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2126 if (state) { RESTORE; break; };
2127 state = __BNF_output_string( "FUN_end\n" ); /* --- Call function --- */
2128 if (state) { RESTORE; break; };
2129 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2130 if (state) { RESTORE; break; };
2131 state = __BNF_output_string( "int __BNF_swap( char *first, char *second, char *third )\n" ); /* --- Call function --- */
2132 if (state) { RESTORE; break; };
2133 state = __BNF_output_string( "{\n" ); /* --- Call function --- */
2134 if (state) { RESTORE; break; };
2135 state = __BNF_output_string( " unsigned len1 = second - first, len2 = third - second;\n" ); /* --- Call function --- */
2136 if (state) { RESTORE; break; };
2137 state = __BNF_output_string( " char *hold = strncpy( (char *) malloc(len1+1), first, len1 );\n" ); /* --- Call function --- */
2138 if (state) { RESTORE; break; };
2139 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2140 if (state) { RESTORE; break; };
2141 state = __BNF_output_string( " strncpy( first, second, len2 );\n" ); /* --- Call function --- */
2142 if (state) { RESTORE; break; };
2143 state = __BNF_output_string( " strncpy( first+len2, hold, len1 );\n" ); /* --- Call function --- */
2144 if (state) { RESTORE; break; };
2145 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2146 if (state) { RESTORE; break; };
2147 state = __BNF_output_string( " free(hold);\n" ); /* --- Call function --- */
2148 if (state) { RESTORE; break; };
2149 state = __BNF_output_string( " return 0;\n" ); /* --- Call function --- */
2150 if (state) { RESTORE; break; };
2151 state = __BNF_output_string( "}\n" ); /* --- Call function --- */
2152 if (state) { RESTORE; break; };
2153 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2154 if (state) { RESTORE; break; };
2155 state = __BNF_output_string( "DEFUN(__BNF_trans_char)\n" ); /* --- Call function --- */
2156 if (state) { RESTORE; break; };
2157 state = __BNF_output_string( "FUN_begin\n" ); /* --- Call function --- */
2158 if (state) { RESTORE; break; };
2159 state = __BNF_output_string( " int ch;\n" ); /* --- Call function --- */
2160 if (state) { RESTORE; break; };
2161 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2162 if (state) { RESTORE; break; };
2163 state = __BNF_output_string( " if ( (state = ((ch = __BNF_get()) == EOF)) == 0) __BNF_put( ch );\n" ); /* --- Call function --- */
2164 if (state) { RESTORE; break; };
2165 state = __BNF_output_string( "FUN_end\n" ); /* --- Call function --- */
2166 if (state) { RESTORE; break; };
2167 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2168 if (state) { RESTORE; break; };
2169 state = __BNF_output_string( "DEFUN(eoi)\n" ); /* --- Call function --- */
2170 if (state) { RESTORE; break; };
2171 state = __BNF_output_string( "FUN_begin\n" ); /* --- Call function --- */
2172 if (state) { RESTORE; break; };
2173 state = __BNF_output_string( " state = !(__BNF_get() == EOF);\n" ); /* --- Call function --- */
2174 if (state) { RESTORE; break; };
2175 state = __BNF_output_string( "FUN_end\n" ); /* --- Call function --- */
2176 if (state) { RESTORE; break; };
2177 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2178 if (state) { RESTORE; break; };
2179 state = __BNF_output_string( "DEFUN(commentchars)\n" ); /* --- Call function --- */
2180 if (state) { RESTORE; break; };
2181 state = __BNF_output_string( "{\n" ); /* --- Call function --- */
2182 if (state) { RESTORE; break; };
2183 state = __BNF_output_string( " register char ch;\n" ); /* --- Call function --- */
2184 if (state) { RESTORE; break; };
2185 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2186 if (state) { RESTORE; break; };
2187 state = __BNF_output_string( " for ( ch = __BNF_get(); ch != '\\n'; ch = __BNF_get() )\n" ); /* --- Call function --- */
2188 if (state) { RESTORE; break; };
2189 state = __BNF_output_string( " __BNF_put(ch);\n" ); /* --- Call function --- */
2190 if (state) { RESTORE; break; };
2191 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2192 if (state) { RESTORE; break; };
2193 state = __BNF_output_string( " --__BNF_input;\n" ); /* --- Call function --- */
2194 if (state) { RESTORE; break; };
2195 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2196 if (state) { RESTORE; break; };
2197 state = __BNF_output_string( " return 0;\n" ); /* --- Call function --- */
2198 if (state) { RESTORE; break; };
2199 state = __BNF_output_string( "}\n" ); /* --- Call function --- */
2200 if (state) { RESTORE; break; };
2201 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2202 if (state) { RESTORE; break; };
2203 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2204 if (state) { RESTORE; break; };
2205 state = __BNF_output_string( "int ignorechars (void)\n" ); /* --- Call function --- */
2206 if (state) { RESTORE; break; };
2207 state = __BNF_output_string( "{\n" ); /* --- Call function --- */
2208 if (state) { RESTORE; break; };
2209 state = __BNF_output_string( " int ch;\n" ); /* --- Call function --- */
2210 if (state) { RESTORE; break; };
2211 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2212 if (state) { RESTORE; break; };
2213 state = __BNF_output_string( " ch = __BNF_get();\n" ); /* --- Call function --- */
2214 if (state) { RESTORE; break; };
2215 state = __BNF_output_string( " while ( ch != '\\n' && ch != EOF )\n" ); /* --- Call function --- */
2216 if (state) { RESTORE; break; };
2217 state = __BNF_output_string( " ch = __BNF_get();\n" ); /* --- Call function --- */
2218 if (state) { RESTORE; break; };
2219 state = __BNF_output_string( " -- __BNF_input;\n" ); /* --- Call function --- */
2220 if (state) { RESTORE; break; };
2221 state = __BNF_output_string( " return 0;\n" ); /* --- Call function --- */
2222 if (state) { RESTORE; break; };
2223 state = __BNF_output_string( "}\n" ); /* --- Call function --- */
2224 if (state) { RESTORE; break; };
2225 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2226 if (state) { RESTORE; break; };
2227 state = __BNF_output_string( "DEFUN(stringchar)\n" ); /* --- Call function --- */
2228 if (state) { RESTORE; break; };
2229 state = __BNF_output_string( "FUN_begin\n" ); /* --- Call function --- */
2230 if (state) { RESTORE; break; };
2231 state = __BNF_output_string( " int ch=__BNF_get();\n" ); /* --- Call function --- */
2232 if (state) { RESTORE; break; };
2233 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2234 if (state) { RESTORE; break; };
2235 state = __BNF_output_string( " state = !(isprint( ch ) && ch != '\\n' && ch != '\\'');\n" ); /* --- Call function --- */
2236 if (state) { RESTORE; break; };
2237 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2238 if (state) { RESTORE; break; };
2239 state = __BNF_output_string( " if ( ch == '\\\\' ) {\n" ); /* --- Call function --- */
2240 if (state) { RESTORE; break; };
2241 state = __BNF_output_string( " ch = __BNF_get();\n" ); /* --- Call function --- */
2242 if (state) { RESTORE; break; };
2243 state = __BNF_output_string( " if ( !state ) {\n" ); /* --- Call function --- */
2244 if (state) { RESTORE; break; };
2245 state = __BNF_output_string( " state = !isprint( ch );\n" ); /* --- Call function --- */
2246 if (state) { RESTORE; break; };
2247 state = __BNF_output_string( " if (!state) {\n" ); /* --- Call function --- */
2248 if (state) { RESTORE; break; };
2249 state = __BNF_output_string( " __BNF_put( '\\\\' );\n" ); /* --- Call function --- */
2250 if (state) { RESTORE; break; };
2251 state = __BNF_output_string( " __BNF_put( ch );\n" ); /* --- Call function --- */
2252 if (state) { RESTORE; break; };
2253 state = __BNF_output_string( " }\n" ); /* --- Call function --- */
2254 if (state) { RESTORE; break; };
2255 state = __BNF_output_string( " }\n" ); /* --- Call function --- */
2256 if (state) { RESTORE; break; };
2257 state = __BNF_output_string( " }\n" ); /* --- Call function --- */
2258 if (state) { RESTORE; break; };
2259 state = __BNF_output_string( " else\n" ); /* --- Call function --- */
2260 if (state) { RESTORE; break; };
2261 state = __BNF_output_string( " if ( !state ) __BNF_put( ch );\n" ); /* --- Call function --- */
2262 if (state) { RESTORE; break; };
2263 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2264 if (state) { RESTORE; break; };
2265 state = __BNF_output_string( "FUN_end\n" ); /* --- Call function --- */
2266 if (state) { RESTORE; break; };
2267 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2268 if (state) { RESTORE; break; };
2269 state = __BNF_output_string( "DEFUN(o_stringchar)\n" ); /* --- Call function --- */
2270 if (state) { RESTORE; break; };
2271 state = __BNF_output_string( "FUN_begin\n" ); /* --- Call function --- */
2272 if (state) { RESTORE; break; };
2273 state = __BNF_output_string( " int ch=__BNF_get();\n" ); /* --- Call function --- */
2274 if (state) { RESTORE; break; };
2275 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2276 if (state) { RESTORE; break; };
2277 state = __BNF_output_string( " state = !(isprint( ch ) && ch != '\\n' && ch != '" ); /* --- Call function --- */
2278 if (state) { RESTORE; break; };
2279 state = __BNF_output_string( "`" ); /* --- Call function --- */
2280 if (state) { RESTORE; break; };
2281 state = __BNF_output_string( "');\n" ); /* --- Call function --- */
2282 if (state) { RESTORE; break; };
2283 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2284 if (state) { RESTORE; break; };
2285 state = __BNF_output_string( " if ( ch == '\\\\' ) {\n" ); /* --- Call function --- */
2286 if (state) { RESTORE; break; };
2287 state = __BNF_output_string( " ch = __BNF_get();\n" ); /* --- Call function --- */
2288 if (state) { RESTORE; break; };
2289 state = __BNF_output_string( " if ( !state ) {\n" ); /* --- Call function --- */
2290 if (state) { RESTORE; break; };
2291 state = __BNF_output_string( " state = !isprint( ch );\n" ); /* --- Call function --- */
2292 if (state) { RESTORE; break; };
2293 state = __BNF_output_string( " if (!state) {\n" ); /* --- Call function --- */
2294 if (state) { RESTORE; break; };
2295 state = __BNF_output_string( " *__BNF_output++ = '\\\\';\n" ); /* --- Call function --- */
2296 if (state) { RESTORE; break; };
2297 state = __BNF_output_string( " *__BNF_output++ = ch;\n" ); /* --- Call function --- */
2298 if (state) { RESTORE; break; };
2299 state = __BNF_output_string( " }\n" ); /* --- Call function --- */
2300 if (state) { RESTORE; break; };
2301 state = __BNF_output_string( " }\n" ); /* --- Call function --- */
2302 if (state) { RESTORE; break; };
2303 state = __BNF_output_string( " }\n" ); /* --- Call function --- */
2304 if (state) { RESTORE; break; };
2305 state = __BNF_output_string( " else\n" ); /* --- Call function --- */
2306 if (state) { RESTORE; break; };
2307 state = __BNF_output_string( " if ( !state ) *__BNF_output++ = ch ;\n" ); /* --- Call function --- */
2308 if (state) { RESTORE; break; };
2309 state = __BNF_output_string( "FUN_end\n" ); /* --- Call function --- */
2310 if (state) { RESTORE; break; };
2311 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2312 if (state) { RESTORE; break; };
2313 state = __BNF_output_string( "DEFUN(t_stringchar)\n" ); /* --- Call function --- */
2314 if (state) { RESTORE; break; };
2315 state = __BNF_output_string( "FUN_begin\n" ); /* --- Call function --- */
2316 if (state) { RESTORE; break; };
2317 state = __BNF_output_string( " int ch=__BNF_get();\n" ); /* --- Call function --- */
2318 if (state) { RESTORE; break; };
2319 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2320 if (state) { RESTORE; break; };
2321 state = __BNF_output_string( " state = !(isprint( ch ) && ch != '\\n' && ch != '\"');\n" ); /* --- Call function --- */
2322 if (state) { RESTORE; break; };
2323 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2324 if (state) { RESTORE; break; };
2325 state = __BNF_output_string( " if ( ch == '\\\\' ) {\n" ); /* --- Call function --- */
2326 if (state) { RESTORE; break; };
2327 state = __BNF_output_string( " ch = __BNF_get();\n" ); /* --- Call function --- */
2328 if (state) { RESTORE; break; };
2329 state = __BNF_output_string( " if ( !state ) {\n" ); /* --- Call function --- */
2330 if (state) { RESTORE; break; };
2331 state = __BNF_output_string( " state = !isprint( ch );\n" ); /* --- Call function --- */
2332 if (state) { RESTORE; break; };
2333 state = __BNF_output_string( " if (!state)\n" ); /* --- Call function --- */
2334 if (state) { RESTORE; break; };
2335 state = __BNF_output_string( " { __BNF_put( '\\\\' );\n" ); /* --- Call function --- */
2336 if (state) { RESTORE; break; };
2337 state = __BNF_output_string( " __BNF_put( ch );\n" ); /* --- Call function --- */
2338 if (state) { RESTORE; break; };
2339 state = __BNF_output_string( " }\n" ); /* --- Call function --- */
2340 if (state) { RESTORE; break; };
2341 state = __BNF_output_string( " }\n" ); /* --- Call function --- */
2342 if (state) { RESTORE; break; };
2343 state = __BNF_output_string( " }\n" ); /* --- Call function --- */
2344 if (state) { RESTORE; break; };
2345 state = __BNF_output_string( " else\n" ); /* --- Call function --- */
2346 if (state) { RESTORE; break; };
2347 state = __BNF_output_string( " if ( !state ) __BNF_put( ch );\n" ); /* --- Call function --- */
2348 if (state) { RESTORE; break; };
2349 state = __BNF_output_string( "FUN_end\n" ); /* --- Call function --- */
2350 if (state) { RESTORE; break; };
2351 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2352 if (state) { RESTORE; break; };
2353 state = __BNF_output_string( "DEFUN(letter)\n" ); /* --- Call function --- */
2354 if (state) { RESTORE; break; };
2355 state = __BNF_output_string( "FUN_begin\n" ); /* --- Call function --- */
2356 if (state) { RESTORE; break; };
2357 state = __BNF_output_string( " int ch=__BNF_get();\n" ); /* --- Call function --- */
2358 if (state) { RESTORE; break; };
2359 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2360 if (state) { RESTORE; break; };
2361 state = __BNF_output_string( " state = !(isalpha( ch ) || ch == '_');\n" ); /* --- Call function --- */
2362 if (state) { RESTORE; break; };
2363 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2364 if (state) { RESTORE; break; };
2365 state = __BNF_output_string( " if (state)\n" ); /* --- Call function --- */
2366 if (state) { RESTORE; break; };
2367 state = __BNF_output_string( " RESTORE\n" ); /* --- Call function --- */
2368 if (state) { RESTORE; break; };
2369 state = __BNF_output_string( " else\n" ); /* --- Call function --- */
2370 if (state) { RESTORE; break; };
2371 state = __BNF_output_string( " __BNF_put( ch );\n" ); /* --- Call function --- */
2372 if (state) { RESTORE; break; };
2373 state = __BNF_output_string( "FUN_end\n" ); /* --- Call function --- */
2374 if (state) { RESTORE; break; };
2375 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2376 if (state) { RESTORE; break; };
2377 state = __BNF_output_string( "DEFUN(digit)\n" ); /* --- Call function --- */
2378 if (state) { RESTORE; break; };
2379 state = __BNF_output_string( "FUN_begin\n" ); /* --- Call function --- */
2380 if (state) { RESTORE; break; };
2381 state = __BNF_output_string( " int ch = __BNF_get();\n" ); /* --- Call function --- */
2382 if (state) { RESTORE; break; };
2383 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2384 if (state) { RESTORE; break; };
2385 state = __BNF_output_string( " state = !isdigit( ch );\n" ); /* --- Call function --- */
2386 if (state) { RESTORE; break; };
2387 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2388 if (state) { RESTORE; break; };
2389 state = __BNF_output_string( " if (state)\n" ); /* --- Call function --- */
2390 if (state) { RESTORE; break; };
2391 state = __BNF_output_string( " RESTORE\n" ); /* --- Call function --- */
2392 if (state) { RESTORE; break; };
2393 state = __BNF_output_string( " else\n" ); /* --- Call function --- */
2394 if (state) { RESTORE; break; };
2395 state = __BNF_output_string( " __BNF_put( ch );\n" ); /* --- Call function --- */
2396 if (state) { RESTORE; break; };
2397 state = __BNF_output_string( "FUN_end\n" ); /* --- Call function --- */
2398 if (state) { RESTORE; break; };
2399 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2400 if (state) { RESTORE; break; };
2401 state = __BNF_output_string( "DEFUN(special)\n" ); /* --- Call function --- */
2402 if (state) { RESTORE; break; };
2403 state = __BNF_output_string( "FUN_begin\n" ); /* --- Call function --- */
2404 if (state) { RESTORE; break; };
2405 state = __BNF_output_string( " int ch = __BNF_get();\n" ); /* --- Call function --- */
2406 if (state) { RESTORE; break; };
2407 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2408 if (state) { RESTORE; break; };
2409 state = __BNF_output_string( " state = !isgraph( ch );\n" ); /* --- Call function --- */
2410 if (state) { RESTORE; break; };
2411 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2412 if (state) { RESTORE; break; };
2413 state = __BNF_output_string( " if (state)\n" ); /* --- Call function --- */
2414 if (state) { RESTORE; break; };
2415 state = __BNF_output_string( " RESTORE\n" ); /* --- Call function --- */
2416 if (state) { RESTORE; break; };
2417 state = __BNF_output_string( " else\n" ); /* --- Call function --- */
2418 if (state) { RESTORE; break; };
2419 state = __BNF_output_string( " __BNF_put( ch );\n" ); /* --- Call function --- */
2420 if (state) { RESTORE; break; };
2421 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2422 if (state) { RESTORE; break; };
2423 state = __BNF_output_string( "FUN_end\n" ); /* --- Call function --- */
2424 if (state) { RESTORE; break; };
2425 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2426 if (state) { RESTORE; break; };
2427 state = __BNF_output_string( "DEFUN(control)\n" ); /* --- Call function --- */
2428 if (state) { RESTORE; break; };
2429 state = __BNF_output_string( "FUN_begin\n" ); /* --- Call function --- */
2430 if (state) { RESTORE; break; };
2431 state = __BNF_output_string( " int ch = __BNF_get();\n" ); /* --- Call function --- */
2432 if (state) { RESTORE; break; };
2433 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2434 if (state) { RESTORE; break; };
2435 state = __BNF_output_string( " state = !iscntrl( ch );\n" ); /* --- Call function --- */
2436 if (state) { RESTORE; break; };
2437 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2438 if (state) { RESTORE; break; };
2439 state = __BNF_output_string( " if (state)\n" ); /* --- Call function --- */
2440 if (state) { RESTORE; break; };
2441 state = __BNF_output_string( " RESTORE\n" ); /* --- Call function --- */
2442 if (state) { RESTORE; break; };
2443 state = __BNF_output_string( " else\n" ); /* --- Call function --- */
2444 if (state) { RESTORE; break; };
2445 state = __BNF_output_string( " __BNF_put( ch );\n" ); /* --- Call function --- */
2446 if (state) { RESTORE; break; };
2447 state = __BNF_output_string( "FUN_end\n" ); /* --- Call function --- */
2448 if (state) { RESTORE; break; };
2449 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2450 if (state) { RESTORE; break; };
2451 state = __BNF_output_string( "DEFUN(character)\n" ); /* --- Call function --- */
2452 if (state) { RESTORE; break; };
2453 state = __BNF_output_string( "FUN_begin\n" ); /* --- Call function --- */
2454 if (state) { RESTORE; break; };
2455 state = __BNF_output_string( " OR_begin\n" ); /* --- Call function --- */
2456 if (state) { RESTORE; break; };
2457 state = __BNF_output_string( " CALL(stringchar)\n" ); /* --- Call function --- */
2458 if (state) { RESTORE; break; };
2459 state = __BNF_output_string( " OR_1\n" ); /* --- Call function --- */
2460 if (state) { RESTORE; break; };
2461 state = __BNF_output_string( " CALL(control)\n" ); /* --- Call function --- */
2462 if (state) { RESTORE; break; };
2463 state = __BNF_output_string( " OR_end\n" ); /* --- Call function --- */
2464 if (state) { RESTORE; break; };
2465 state = __BNF_output_string( "FUN_end\n" ); /* --- Call function --- */
2466 if (state) { RESTORE; break; };
2467 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2468 if (state) { RESTORE; break; };
2469 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2470 if (state) { RESTORE; break; };
2471 state = __BNF_output_string( "DEFUN(white)\n" ); /* --- Call function --- */
2472 if (state) { RESTORE; break; };
2473 state = __BNF_output_string( "FUN_begin\n" ); /* --- Call function --- */
2474 if (state) { RESTORE; break; };
2475 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2476 if (state) { RESTORE; break; };
2477 state = __BNF_output_string( " state = !isspace( __BNF_get() );\n" ); /* --- Call function --- */
2478 if (state) { RESTORE; break; };
2479 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2480 if (state) { RESTORE; break; };
2481 state = __BNF_output_string( " if ( !state ) {\n" ); /* --- Call function --- */
2482 if (state) { RESTORE; break; };
2483 state = __BNF_output_string( " while ( isspace( __BNF_get() ) )\n" ); /* --- Call function --- */
2484 if (state) { RESTORE; break; };
2485 state = __BNF_output_string( " ;\n" ); /* --- Call function --- */
2486 if (state) { RESTORE; break; };
2487 state = __BNF_output_string( " --__BNF_input;\n" ); /* --- Call function --- */
2488 if (state) { RESTORE; break; };
2489 state = __BNF_output_string( " };\n" ); /* --- Call function --- */
2490 if (state) { RESTORE; break; };
2491 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2492 if (state) { RESTORE; break; };
2493 state = __BNF_output_string( "FUN_end\n" ); /* --- Call function --- */
2494 if (state) { RESTORE; break; };
2495 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2496 if (state) { RESTORE; break; };
2497 state = __BNF_output_string( "DEFUN(inc_level)\n" ); /* --- Call function --- */
2498 if (state) { RESTORE; break; };
2499 state = __BNF_output_string( "FUN_begin\n" ); /* --- Call function --- */
2500 if (state) { RESTORE; break; };
2501 state = __BNF_output_string( " ++__BNF_level;\n" ); /* --- Call function --- */
2502 if (state) { RESTORE; break; };
2503 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2504 if (state) { RESTORE; break; };
2505 state = __BNF_output_string( " state=0;\n" ); /* --- Call function --- */
2506 if (state) { RESTORE; break; };
2507 state = __BNF_output_string( "FUN_end\n" ); /* --- Call function --- */
2508 if (state) { RESTORE; break; };
2509 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2510 if (state) { RESTORE; break; };
2511 state = __BNF_output_string( "DEFUN(dec_level)\n" ); /* --- Call function --- */
2512 if (state) { RESTORE; break; };
2513 state = __BNF_output_string( "FUN_begin\n" ); /* --- Call function --- */
2514 if (state) { RESTORE; break; };
2515 state = __BNF_output_string( " --__BNF_level;\n" ); /* --- Call function --- */
2516 if (state) { RESTORE; break; };
2517 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2518 if (state) { RESTORE; break; };
2519 state = __BNF_output_string( " state=0;\n" ); /* --- Call function --- */
2520 if (state) { RESTORE; break; };
2521 state = __BNF_output_string( "FUN_end\n" ); /* --- Call function --- */
2522 if (state) { RESTORE; break; };
2523 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2524 if (state) { RESTORE; break; };
2525 state = __BNF_output_string( "DEFUN(out_indent)\n" ); /* --- Call function --- */
2526 if (state) { RESTORE; break; };
2527 state = __BNF_output_string( "FUN_begin\n" ); /* --- Call function --- */
2528 if (state) { RESTORE; break; };
2529 state = __BNF_output_string( " unsigned i,j;\n" ); /* --- Call function --- */
2530 if (state) { RESTORE; break; };
2531 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2532 if (state) { RESTORE; break; };
2533 state = __BNF_output_string( " for (i=0; i<__BNF_level; i++ )\n" ); /* --- Call function --- */
2534 if (state) { RESTORE; break; };
2535 state = __BNF_output_string( " if (__BNF_tabsize) {\n" ); /* --- Call function --- */
2536 if (state) { RESTORE; break; };
2537 state = __BNF_output_string( " for(j=0;j<__BNF_tabsize;j++) __BNF_put(' ');\n" ); /* --- Call function --- */
2538 if (state) { RESTORE; break; };
2539 state = __BNF_output_string( " }\n" ); /* --- Call function --- */
2540 if (state) { RESTORE; break; };
2541 state = __BNF_output_string( " else\n" ); /* --- Call function --- */
2542 if (state) { RESTORE; break; };
2543 state = __BNF_output_string( " __BNF_put('\t');\n" ); /* --- Call function --- */
2544 if (state) { RESTORE; break; };
2545 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2546 if (state) { RESTORE; break; };
2547 state = __BNF_output_string( " state=0;\n" ); /* --- Call function --- */
2548 if (state) { RESTORE; break; };
2549 state = __BNF_output_string( "FUN_end\n" ); /* --- Call function --- */
2550 if (state) { RESTORE; break; };
2551 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2552 if (state) { RESTORE; break; };
2553 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2554 if (state) { RESTORE; break; };
2555 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2556 if (state) { RESTORE; break; };
2557 state = __BNF_output_string( "int inc_rule (void)\n" ); /* --- Call function --- */
2558 if (state) { RESTORE; break; };
2559 state = __BNF_output_string( "{\n" ); /* --- Call function --- */
2560 if (state) { RESTORE; break; };
2561 state = __BNF_output_string( " ++ __BNF_rulecnt;\n" ); /* --- Call function --- */
2562 if (state) { RESTORE; break; };
2563 state = __BNF_output_string( " return 0;\n" ); /* --- Call function --- */
2564 if (state) { RESTORE; break; };
2565 state = __BNF_output_string( "}\n" ); /* --- Call function --- */
2566 if (state) { RESTORE; break; };
2567 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2568 if (state) { RESTORE; break; };
2569 state = __BNF_output_string( "int flush( void )\n" ); /* --- Call function --- */
2570 if (state) { RESTORE; break; };
2571 state = __BNF_output_string( "{\n" ); /* --- Call function --- */
2572 if (state) { RESTORE; break; };
2573 state = __BNF_output_string( " return __BNF_flush();\n" ); /* --- Call function --- */
2574 if (state) { RESTORE; break; };
2575 state = __BNF_output_string( "}\n" ); /* --- Call function --- */
2576 if (state) { RESTORE; break; };
2577 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2578 if (state) { RESTORE; break; };
2579 state = __BNF_output_string( "/* eof */\n" ); /* --- Call function --- */
2580 if (state) { RESTORE; break; };
2581 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2582 if (state) { RESTORE; break; };
2583 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2584 if (state) { RESTORE; break; };
2585 } while( 0 );
2586
2587 return state;}
2588
2589
now_do_the_strfilio_mister(void)2590 int now_do_the_strfilio_mister(void)
2591 {
2592 int state;
2593
2594 do {
2595 HOLD;
2596
2597 state = ndt_a( ); /* --- Call function --- */
2598 if (state) break;
2599 state = ndt_b( ); /* --- Call function --- */
2600 if (state) { RESTORE; break; };
2601 } while( 0 );
2602
2603 return state;}
2604
2605
ndt_a(void)2606 int ndt_a(void)
2607 {
2608 int state;
2609
2610 do {
2611 HOLD;
2612
2613 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2614 if (state) break;
2615 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2616 if (state) { RESTORE; break; };
2617 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2618 if (state) { RESTORE; break; };
2619 state = __BNF_output_string( "#include <stdio.h>\n" ); /* --- Call function --- */
2620 if (state) { RESTORE; break; };
2621 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2622 if (state) { RESTORE; break; };
2623 state = __BNF_output_string( "/****************************************************************************************\n" ); /* --- Call function --- */
2624 if (state) { RESTORE; break; };
2625 state = __BNF_output_string( " * We have either a strings or files as input and output.\n" ); /* --- Call function --- */
2626 if (state) { RESTORE; break; };
2627 state = __BNF_output_string( " */\n" ); /* --- Call function --- */
2628 if (state) { RESTORE; break; };
2629 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2630 if (state) { RESTORE; break; };
2631 state = __BNF_output_string( "int __BNF_str_io_parser(char* input,char* output,int (*syntax)());\n" ); /* --- Call function --- */
2632 if (state) { RESTORE; break; };
2633 state = __BNF_output_string( "int __BNF_fil_io_parser(FILE* input,FILE* output,int (*syntax)());\n" ); /* --- Call function --- */
2634 if (state) { RESTORE; break; };
2635 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2636 if (state) { RESTORE; break; };
2637 state = __BNF_output_string( "/****************************************************************************************\n" ); /* --- Call function --- */
2638 if (state) { RESTORE; break; };
2639 state = __BNF_output_string( " * STRIO/FILIO COMMON DEFS\n" ); /* --- Call function --- */
2640 if (state) { RESTORE; break; };
2641 state = __BNF_output_string( " */\n" ); /* --- Call function --- */
2642 if (state) { RESTORE; break; };
2643 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2644 if (state) { RESTORE; break; };
2645 state = __BNF_output_string( "#include <stdlib.h>\n" ); /* --- Call function --- */
2646 if (state) { RESTORE; break; };
2647 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2648 if (state) { RESTORE; break; };
2649 state = __BNF_output_string( "#define BUFFER_SIZE (8*20480)\n" ); /* --- Call function --- */
2650 if (state) { RESTORE; break; };
2651 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2652 if (state) { RESTORE; break; };
2653 state = __BNF_output_string( "unsigned __BNF_err_line;\n" ); /* --- Call function --- */
2654 if (state) { RESTORE; break; };
2655 state = __BNF_output_string( "unsigned long __BNF_no_read, __BNF_no_written;\n" ); /* --- Call function --- */
2656 if (state) { RESTORE; break; };
2657 state = __BNF_output_string( "char *__BNF_input, *__BNF_output;\n" ); /* --- Call function --- */
2658 if (state) { RESTORE; break; };
2659 state = __BNF_output_string( "unsigned int __BNF_tabsize = 0;\n" ); /* --- Call function --- */
2660 if (state) { RESTORE; break; };
2661 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2662 if (state) { RESTORE; break; };
2663 state = __BNF_output_string( "static int __is_file_io = 0;\n" ); /* --- Call function --- */
2664 if (state) { RESTORE; break; };
2665 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2666 if (state) { RESTORE; break; };
2667 state = __BNF_output_string( "/****************************************************************************************\n" ); /* --- Call function --- */
2668 if (state) { RESTORE; break; };
2669 state = __BNF_output_string( " * FILIO\n" ); /* --- Call function --- */
2670 if (state) { RESTORE; break; };
2671 state = __BNF_output_string( " */\n" ); /* --- Call function --- */
2672 if (state) { RESTORE; break; };
2673 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2674 if (state) { RESTORE; break; };
2675 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2676 if (state) { RESTORE; break; };
2677 state = __BNF_output_string( "FILE *if_ptr = NULL, *of_ptr = NULL;\n" ); /* --- Call function --- */
2678 if (state) { RESTORE; break; };
2679 state = __BNF_output_string( "static char *max___BNF_input;\n" ); /* --- Call function --- */
2680 if (state) { RESTORE; break; };
2681 state = __BNF_output_string( "static char *__BNF_input_buffer = NULL, *__BNF_output_buffer = NULL;\n" ); /* --- Call function --- */
2682 if (state) { RESTORE; break; };
2683 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2684 if (state) { RESTORE; break; };
2685 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2686 if (state) { RESTORE; break; };
2687 state = __BNF_output_string( "static int init(void);\n" ); /* --- Call function --- */
2688 if (state) { RESTORE; break; };
2689 state = __BNF_output_string( "static int done(void);\n" ); /* --- Call function --- */
2690 if (state) { RESTORE; break; };
2691 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2692 if (state) { RESTORE; break; };
2693 state = __BNF_output_string( "int __BNF_fil_io_parser( FILE *input, FILE *output, int (*syntax)() )\n" ); /* --- Call function --- */
2694 if (state) { RESTORE; break; };
2695 state = __BNF_output_string( "{\n" ); /* --- Call function --- */
2696 if (state) { RESTORE; break; };
2697 state = __BNF_output_string( " int retval;\n" ); /* --- Call function --- */
2698 if (state) { RESTORE; break; };
2699 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2700 if (state) { RESTORE; break; };
2701 } while( 0 );
2702
2703 return state;}
2704
2705
ndt_b(void)2706 int ndt_b(void)
2707 {
2708 int state;
2709
2710 do {
2711 HOLD;
2712
2713 state = __BNF_output_string( " __is_file_io = 1;\n" ); /* --- Call function --- */
2714 if (state) break;
2715 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2716 if (state) { RESTORE; break; };
2717 state = __BNF_output_string( " /* --- initialisation --- */\n" ); /* --- Call function --- */
2718 if (state) { RESTORE; break; };
2719 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2720 if (state) { RESTORE; break; };
2721 state = __BNF_output_string( " __BNF_level = __BNF_rulecnt = 0;\n" ); /* --- Call function --- */
2722 if (state) { RESTORE; break; };
2723 state = __BNF_output_string( " if_ptr = input;\n" ); /* --- Call function --- */
2724 if (state) { RESTORE; break; };
2725 state = __BNF_output_string( " of_ptr = output;\n" ); /* --- Call function --- */
2726 if (state) { RESTORE; break; };
2727 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2728 if (state) { RESTORE; break; };
2729 state = __BNF_output_string( " if ( init() ) {\n" ); /* --- Call function --- */
2730 if (state) { RESTORE; break; };
2731 state = __BNF_output_string( " fprintf( stderr, \"Fatal: Cannot allocate enough memory.\\n\" );\n" ); /* --- Call function --- */
2732 if (state) { RESTORE; break; };
2733 state = __BNF_output_string( " return 1;\n" ); /* --- Call function --- */
2734 if (state) { RESTORE; break; };
2735 state = __BNF_output_string( " }\n" ); /* --- Call function --- */
2736 if (state) { RESTORE; break; };
2737 state = __BNF_output_string( " /* --- call the syntax parser --- */\n" ); /* --- Call function --- */
2738 if (state) { RESTORE; break; };
2739 state = __BNF_output_string( " retval = (*syntax)();\n" ); /* --- Call function --- */
2740 if (state) { RESTORE; break; };
2741 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2742 if (state) { RESTORE; break; };
2743 state = __BNF_output_string( " /* --- clean up --- */\n" ); /* --- Call function --- */
2744 if (state) { RESTORE; break; };
2745 state = __BNF_output_string( " done();\n" ); /* --- Call function --- */
2746 if (state) { RESTORE; break; };
2747 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2748 if (state) { RESTORE; break; };
2749 state = __BNF_output_string( " return retval;\n" ); /* --- Call function --- */
2750 if (state) { RESTORE; break; };
2751 state = __BNF_output_string( "}\n" ); /* --- Call function --- */
2752 if (state) { RESTORE; break; };
2753 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2754 if (state) { RESTORE; break; };
2755 state = __BNF_output_string( "int __BNF_fil_get(void)\n" ); /* --- Call function --- */
2756 if (state) { RESTORE; break; };
2757 state = __BNF_output_string( "{\n" ); /* --- Call function --- */
2758 if (state) { RESTORE; break; };
2759 state = __BNF_output_string( " int ch;\n" ); /* --- Call function --- */
2760 if (state) { RESTORE; break; };
2761 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2762 if (state) { RESTORE; break; };
2763 state = __BNF_output_string( " if ( __BNF_input == max___BNF_input ) {\n" ); /* --- Call function --- */
2764 if (state) { RESTORE; break; };
2765 state = __BNF_output_string( " if ( (ch = fgetc(if_ptr)) != 0 ) {\n" ); /* --- Call function --- */
2766 if (state) { RESTORE; break; };
2767 state = __BNF_output_string( " *__BNF_input++ = ch;\n" ); /* --- Call function --- */
2768 if (state) { RESTORE; break; };
2769 state = __BNF_output_string( " max___BNF_input++;\n" ); /* --- Call function --- */
2770 if (state) { RESTORE; break; };
2771 state = __BNF_output_string( " __BNF_no_read++;\n" ); /* --- Call function --- */
2772 if (state) { RESTORE; break; };
2773 state = __BNF_output_string( " }\n" ); /* --- Call function --- */
2774 if (state) { RESTORE; break; };
2775 state = __BNF_output_string( " if ( ch == '\\n' ) __BNF_err_line++;\n" ); /* --- Call function --- */
2776 if (state) { RESTORE; break; };
2777 state = __BNF_output_string( " return ch;\n" ); /* --- Call function --- */
2778 if (state) { RESTORE; break; };
2779 state = __BNF_output_string( " }\n" ); /* --- Call function --- */
2780 if (state) { RESTORE; break; };
2781 state = __BNF_output_string( " else\n" ); /* --- Call function --- */
2782 if (state) { RESTORE; break; };
2783 state = __BNF_output_string( " return *__BNF_input++;\n" ); /* --- Call function --- */
2784 if (state) { RESTORE; break; };
2785 state = __BNF_output_string( "}\n" ); /* --- Call function --- */
2786 if (state) { RESTORE; break; };
2787 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2788 if (state) { RESTORE; break; };
2789 state = __BNF_output_string( "int __BNF_fil_put(int ch)\n" ); /* --- Call function --- */
2790 if (state) { RESTORE; break; };
2791 state = __BNF_output_string( "{\n" ); /* --- Call function --- */
2792 if (state) { RESTORE; break; };
2793 state = __BNF_output_string( " if ( __BNF_output == __BNF_output_buffer+BUFFER_SIZE ) {\n" ); /* --- Call function --- */
2794 if (state) { RESTORE; break; };
2795 state = __BNF_output_string( " return 1;\n" ); /* --- Call function --- */
2796 if (state) { RESTORE; break; };
2797 state = __BNF_output_string( " }\n" ); /* --- Call function --- */
2798 if (state) { RESTORE; break; };
2799 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2800 if (state) { RESTORE; break; };
2801 state = __BNF_output_string( " *__BNF_output++ = ch;\n" ); /* --- Call function --- */
2802 if (state) { RESTORE; break; };
2803 state = __BNF_output_string( " return 0;\n" ); /* --- Call function --- */
2804 if (state) { RESTORE; break; };
2805 state = __BNF_output_string( "}\n" ); /* --- Call function --- */
2806 if (state) { RESTORE; break; };
2807 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2808 if (state) { RESTORE; break; };
2809 state = __BNF_output_string( "int __BNF_fil_flush(void)\n" ); /* --- Call function --- */
2810 if (state) { RESTORE; break; };
2811 state = __BNF_output_string( "{\n" ); /* --- Call function --- */
2812 if (state) { RESTORE; break; };
2813 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2814 if (state) { RESTORE; break; };
2815 state = __BNF_output_string( " char *s = __BNF_output_buffer;\n" ); /* --- Call function --- */
2816 if (state) { RESTORE; break; };
2817 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2818 if (state) { RESTORE; break; };
2819 state = __BNF_output_string( " while ( s < __BNF_output ) {\n" ); /* --- Call function --- */
2820 if (state) { RESTORE; break; };
2821 state = __BNF_output_string( " __BNF_no_written++;\n" ); /* --- Call function --- */
2822 if (state) { RESTORE; break; };
2823 state = __BNF_output_string( " fputc( *s++, of_ptr );\n" ); /* --- Call function --- */
2824 if (state) { RESTORE; break; };
2825 state = __BNF_output_string( " }\n" ); /* --- Call function --- */
2826 if (state) { RESTORE; break; };
2827 state = __BNF_output_string( " __BNF_output = __BNF_output_buffer;\n" ); /* --- Call function --- */
2828 if (state) { RESTORE; break; };
2829 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2830 if (state) { RESTORE; break; };
2831 state = __BNF_output_string( " return 0;\n" ); /* --- Call function --- */
2832 if (state) { RESTORE; break; };
2833 state = __BNF_output_string( "}\n" ); /* --- Call function --- */
2834 if (state) { RESTORE; break; };
2835 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2836 if (state) { RESTORE; break; };
2837 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2838 if (state) { RESTORE; break; };
2839 state = __BNF_output_string( "static int init(void)\n" ); /* --- Call function --- */
2840 if (state) { RESTORE; break; };
2841 state = __BNF_output_string( "{\n" ); /* --- Call function --- */
2842 if (state) { RESTORE; break; };
2843 state = __BNF_output_string( " if ( (__BNF_input_buffer = malloc( BUFFER_SIZE )) != NULL ) {\n" ); /* --- Call function --- */
2844 if (state) { RESTORE; break; };
2845 state = __BNF_output_string( " if ( (__BNF_output_buffer = malloc( BUFFER_SIZE )) != NULL ) {\n" ); /* --- Call function --- */
2846 if (state) { RESTORE; break; };
2847 state = __BNF_output_string( " __BNF_input = max___BNF_input = __BNF_input_buffer;\n" ); /* --- Call function --- */
2848 if (state) { RESTORE; break; };
2849 state = __BNF_output_string( " __BNF_output = __BNF_output_buffer;\n" ); /* --- Call function --- */
2850 if (state) { RESTORE; break; };
2851 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2852 if (state) { RESTORE; break; };
2853 state = __BNF_output_string( " __BNF_no_read = 0;\n" ); /* --- Call function --- */
2854 if (state) { RESTORE; break; };
2855 state = __BNF_output_string( " __BNF_no_written = 0;\n" ); /* --- Call function --- */
2856 if (state) { RESTORE; break; };
2857 state = __BNF_output_string( " __BNF_err_line=1;\n" ); /* --- Call function --- */
2858 if (state) { RESTORE; break; };
2859 state = __BNF_output_string( " return 0;\n" ); /* --- Call function --- */
2860 if (state) { RESTORE; break; };
2861 state = __BNF_output_string( "}\n" ); /* --- Call function --- */
2862 if (state) { RESTORE; break; };
2863 state = __BNF_output_string( "else\n" ); /* --- Call function --- */
2864 if (state) { RESTORE; break; };
2865 state = __BNF_output_string( " free( __BNF_input_buffer );\n" ); /* --- Call function --- */
2866 if (state) { RESTORE; break; };
2867 state = __BNF_output_string( " }\n" ); /* --- Call function --- */
2868 if (state) { RESTORE; break; };
2869 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2870 if (state) { RESTORE; break; };
2871 state = __BNF_output_string( " return 1;\n" ); /* --- Call function --- */
2872 if (state) { RESTORE; break; };
2873 state = __BNF_output_string( "}\n" ); /* --- Call function --- */
2874 if (state) { RESTORE; break; };
2875 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2876 if (state) { RESTORE; break; };
2877 state = __BNF_output_string( "static int done(void)\n" ); /* --- Call function --- */
2878 if (state) { RESTORE; break; };
2879 state = __BNF_output_string( "{\n" ); /* --- Call function --- */
2880 if (state) { RESTORE; break; };
2881 state = __BNF_output_string( " __BNF_flush();\n" ); /* --- Call function --- */
2882 if (state) { RESTORE; break; };
2883 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2884 if (state) { RESTORE; break; };
2885 state = __BNF_output_string( " free( __BNF_output_buffer);\n" ); /* --- Call function --- */
2886 if (state) { RESTORE; break; };
2887 state = __BNF_output_string( " free( __BNF_input_buffer );\n" ); /* --- Call function --- */
2888 if (state) { RESTORE; break; };
2889 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2890 if (state) { RESTORE; break; };
2891 state = __BNF_output_string( " __BNF_input_buffer = 0;\n" ); /* --- Call function --- */
2892 if (state) { RESTORE; break; };
2893 state = __BNF_output_string( " __BNF_output_buffer = 0;\n" ); /* --- Call function --- */
2894 if (state) { RESTORE; break; };
2895 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2896 if (state) { RESTORE; break; };
2897 state = __BNF_output_string( " return 0;\n" ); /* --- Call function --- */
2898 if (state) { RESTORE; break; };
2899 state = __BNF_output_string( "}\n" ); /* --- Call function --- */
2900 if (state) { RESTORE; break; };
2901 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2902 if (state) { RESTORE; break; };
2903 state = __BNF_output_string( "/****************************************************************************************\n" ); /* --- Call function --- */
2904 if (state) { RESTORE; break; };
2905 state = __BNF_output_string( "* STRIO\n" ); /* --- Call function --- */
2906 if (state) { RESTORE; break; };
2907 state = __BNF_output_string( "****************************************************************************************/\n" ); /* --- Call function --- */
2908 if (state) { RESTORE; break; };
2909 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2910 if (state) { RESTORE; break; };
2911 state = __BNF_output_string( "int __BNF_str_io_parser( char *input, char *output, int (*syntax)() )\n" ); /* --- Call function --- */
2912 if (state) { RESTORE; break; };
2913 state = __BNF_output_string( "{\n" ); /* --- Call function --- */
2914 if (state) { RESTORE; break; };
2915 state = __BNF_output_string( " int retval;\n" ); /* --- Call function --- */
2916 if (state) { RESTORE; break; };
2917 state = __BNF_output_string( " char *s;\n" ); /* --- Call function --- */
2918 if (state) { RESTORE; break; };
2919 state = __BNF_output_string( " __is_file_io = 0;\n" ); /* --- Call function --- */
2920 if (state) { RESTORE; break; };
2921 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2922 if (state) { RESTORE; break; };
2923 state = __BNF_output_string( " /* --- initialisation --- */\n" ); /* --- Call function --- */
2924 if (state) { RESTORE; break; };
2925 state = __BNF_output_string( " __BNF_input = max___BNF_input = __BNF_input_buffer = input;\n" ); /* --- Call function --- */
2926 if (state) { RESTORE; break; };
2927 state = __BNF_output_string( " __BNF_output = __BNF_output_buffer = output;\n" ); /* --- Call function --- */
2928 if (state) { RESTORE; break; };
2929 state = __BNF_output_string( " __BNF_no_read = __BNF_no_written = 0;\n" ); /* --- Call function --- */
2930 if (state) { RESTORE; break; };
2931 state = __BNF_output_string( " __BNF_err_line = 1;\n" ); /* --- Call function --- */
2932 if (state) { RESTORE; break; };
2933 state = __BNF_output_string( " __BNF_level = __BNF_rulecnt = 0;\n" ); /* --- Call function --- */
2934 if (state) { RESTORE; break; };
2935 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2936 if (state) { RESTORE; break; };
2937 state = __BNF_output_string( " /* --- call the syntax parser --- */\n" ); /* --- Call function --- */
2938 if (state) { RESTORE; break; };
2939 state = __BNF_output_string( " retval = syntax();\n" ); /* --- Call function --- */
2940 if (state) { RESTORE; break; };
2941 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2942 if (state) { RESTORE; break; };
2943 state = __BNF_output_string( " /* --- count the number of output-bytes --- */\n" ); /* --- Call function --- */
2944 if (state) { RESTORE; break; };
2945 state = __BNF_output_string( " for ( s = __BNF_output_buffer; s < __BNF_output ; s++ )\n" ); /* --- Call function --- */
2946 if (state) { RESTORE; break; };
2947 state = __BNF_output_string( " ++ __BNF_no_written;\n" ); /* --- Call function --- */
2948 if (state) { RESTORE; break; };
2949 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2950 if (state) { RESTORE; break; };
2951 state = __BNF_output_string( " return retval;\n" ); /* --- Call function --- */
2952 if (state) { RESTORE; break; };
2953 state = __BNF_output_string( "}\n" ); /* --- Call function --- */
2954 if (state) { RESTORE; break; };
2955 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2956 if (state) { RESTORE; break; };
2957 state = __BNF_output_string( "int __BNF_str_get( void )\n" ); /* --- Call function --- */
2958 if (state) { RESTORE; break; };
2959 state = __BNF_output_string( "{\n" ); /* --- Call function --- */
2960 if (state) { RESTORE; break; };
2961 state = __BNF_output_string( " register ch;\n" ); /* --- Call function --- */
2962 if (state) { RESTORE; break; };
2963 state = __BNF_output_string( "\n" ); /* --- Call function --- */
2964 if (state) { RESTORE; break; };
2965 state = __BNF_output_string( " if ( __BNF_input == max___BNF_input ) {\n" ); /* --- Call function --- */
2966 if (state) { RESTORE; break; };
2967 state = __BNF_output_string( " \n" ); /* --- Call function --- */
2968 if (state) { RESTORE; break; };
2969 state = __BNF_output_string( " if ( (ch = *max___BNF_input) != '\\0' ) {\n" ); /* --- Call function --- */
2970 if (state) { RESTORE; break; };
2971 state = __BNF_output_string( " ++ max___BNF_input;\n" ); /* --- Call function --- */
2972 if (state) { RESTORE; break; };
2973 state = __BNF_output_string( " ++ __BNF_input;\n" ); /* --- Call function --- */
2974 if (state) { RESTORE; break; };
2975 state = __BNF_output_string( " ++ __BNF_no_read;\n" ); /* --- Call function --- */
2976 if (state) { RESTORE; break; };
2977 state = __BNF_output_string( " \n" ); /* --- Call function --- */
2978 if (state) { RESTORE; break; };
2979 state = __BNF_output_string( " if ( ch == '\\n' ) __BNF_err_line++;\n" ); /* --- Call function --- */
2980 if (state) { RESTORE; break; };
2981 state = __BNF_output_string( " \n" ); /* --- Call function --- */
2982 if (state) { RESTORE; break; };
2983 state = __BNF_output_string( " return ch;\n" ); /* --- Call function --- */
2984 if (state) { RESTORE; break; };
2985 state = __BNF_output_string( " }\n" ); /* --- Call function --- */
2986 if (state) { RESTORE; break; };
2987 state = __BNF_output_string( " else\n" ); /* --- Call function --- */
2988 if (state) { RESTORE; break; };
2989 state = __BNF_output_string( " return EOF;\n" ); /* --- Call function --- */
2990 if (state) { RESTORE; break; };
2991 state = __BNF_output_string( " }\n" ); /* --- Call function --- */
2992 if (state) { RESTORE; break; };
2993 state = __BNF_output_string( " else\n" ); /* --- Call function --- */
2994 if (state) { RESTORE; break; };
2995 state = __BNF_output_string( " return *__BNF_input++;\n" ); /* --- Call function --- */
2996 if (state) { RESTORE; break; };
2997 state = __BNF_output_string( "}\n" ); /* --- Call function --- */
2998 if (state) { RESTORE; break; };
2999 state = __BNF_output_string( "\n" ); /* --- Call function --- */
3000 if (state) { RESTORE; break; };
3001 state = __BNF_output_string( "int __BNF_str_put( int ch )\n" ); /* --- Call function --- */
3002 if (state) { RESTORE; break; };
3003 state = __BNF_output_string( "{\n" ); /* --- Call function --- */
3004 if (state) { RESTORE; break; };
3005 state = __BNF_output_string( " *__BNF_output++ = ch;\n" ); /* --- Call function --- */
3006 if (state) { RESTORE; break; };
3007 state = __BNF_output_string( " return 0;\n" ); /* --- Call function --- */
3008 if (state) { RESTORE; break; };
3009 state = __BNF_output_string( "}\n" ); /* --- Call function --- */
3010 if (state) { RESTORE; break; };
3011 state = __BNF_output_string( "\n" ); /* --- Call function --- */
3012 if (state) { RESTORE; break; };
3013 state = __BNF_output_string( "\n" ); /* --- Call function --- */
3014 if (state) { RESTORE; break; };
3015 state = __BNF_output_string( "int __BNF_str_flush( void )\n" ); /* --- Call function --- */
3016 if (state) { RESTORE; break; };
3017 state = __BNF_output_string( "{\n" ); /* --- Call function --- */
3018 if (state) { RESTORE; break; };
3019 state = __BNF_output_string( " return 0;\n" ); /* --- Call function --- */
3020 if (state) { RESTORE; break; };
3021 state = __BNF_output_string( "}\n" ); /* --- Call function --- */
3022 if (state) { RESTORE; break; };
3023 state = __BNF_output_string( "\n" ); /* --- Call function --- */
3024 if (state) { RESTORE; break; };
3025 state = __BNF_output_string( "\n" ); /* --- Call function --- */
3026 if (state) { RESTORE; break; };
3027 state = __BNF_output_string( "/****************************************************************************************\n" ); /* --- Call function --- */
3028 if (state) { RESTORE; break; };
3029 state = __BNF_output_string( "* STRIO/FILIO COMMON HOOKS\n" ); /* --- Call function --- */
3030 if (state) { RESTORE; break; };
3031 state = __BNF_output_string( "****************************************************************************************/\n" ); /* --- Call function --- */
3032 if (state) { RESTORE; break; };
3033 state = __BNF_output_string( "\n" ); /* --- Call function --- */
3034 if (state) { RESTORE; break; };
3035 state = __BNF_output_string( "\n" ); /* --- Call function --- */
3036 if (state) { RESTORE; break; };
3037 state = __BNF_output_string( "#if 0\n" ); /* --- Call function --- */
3038 if (state) { RESTORE; break; };
3039 state = __BNF_output_string( "int __BNF_put(int ch)\n" ); /* --- Call function --- */
3040 if (state) { RESTORE; break; };
3041 state = __BNF_output_string( "{\n" ); /* --- Call function --- */
3042 if (state) { RESTORE; break; };
3043 state = __BNF_output_string( " return (__is_file_io == 1) ? __BNF_fil_put(ch) : __BNF_str_put(ch);\n" ); /* --- Call function --- */
3044 if (state) { RESTORE; break; };
3045 state = __BNF_output_string( "}\n" ); /* --- Call function --- */
3046 if (state) { RESTORE; break; };
3047 state = __BNF_output_string( "#endif\n" ); /* --- Call function --- */
3048 if (state) { RESTORE; break; };
3049 state = __BNF_output_string( "int __BNF_get(void)\n" ); /* --- Call function --- */
3050 if (state) { RESTORE; break; };
3051 state = __BNF_output_string( "{\n" ); /* --- Call function --- */
3052 if (state) { RESTORE; break; };
3053 state = __BNF_output_string( " return (__is_file_io == 1) ? __BNF_fil_get() : __BNF_str_get();\n" ); /* --- Call function --- */
3054 if (state) { RESTORE; break; };
3055 state = __BNF_output_string( "}\n" ); /* --- Call function --- */
3056 if (state) { RESTORE; break; };
3057 state = __BNF_output_string( "int __BNF_flush(void)\n" ); /* --- Call function --- */
3058 if (state) { RESTORE; break; };
3059 state = __BNF_output_string( "{\n" ); /* --- Call function --- */
3060 if (state) { RESTORE; break; };
3061 state = __BNF_output_string( " return (__is_file_io == 1) ? __BNF_fil_flush() : __BNF_str_flush();\n" ); /* --- Call function --- */
3062 if (state) { RESTORE; break; };
3063 state = __BNF_output_string( "}\n" ); /* --- Call function --- */
3064 if (state) { RESTORE; break; };
3065 state = __BNF_output_string( "\n" ); /* --- Call function --- */
3066 if (state) { RESTORE; break; };
3067 state = __BNF_output_string( "\n" ); /* --- Call function --- */
3068 if (state) { RESTORE; break; };
3069 } while( 0 );
3070
3071 return state;}
3072
3073
3074
3075 /* begining of standard utility functions */
3076
3077
3078
3079 #include <stdio.h> /* for EOF */
3080 #include <ctype.h>
3081 #include <stdlib.h>
3082 #include <string.h>
3083
3084 /*#define HOLD unsigned hold___BNF_level = __BNF_level; char *hold___BNF_input = __BNF_input, *hold___BNF_output = __BNF_output
3085 #define RESTORE {__BNF_level = hold___BNF_level, __BNF_input = hold___BNF_input; __BNF_output = hold___BNF_output;}*/
3086 #define DEFUN(f) int f(void)
3087 #define CALL(f) state = f();
3088 #define IN__BNF_put(s) state = __BNF_input_string( s );
3089 #define OUT__BNF_put(s) state = __BNF_output_string( s );
3090 #define FUN_begin { int state; HOLD;
3091 #define FUN_end if (state) RESTORE; return state; }
3092 #define AND_begin do { HOLD;
3093 #define AND_1 if (state) break;
3094 #define AND_2 if (state) { RESTORE; break; }
3095 #define AND_end } while (0);
3096 #define OR_begin do {
3097 #define OR_1 if (!state) break;
3098 #define OR_end } while (0);
3099 #define OPT_begin
3100 #define OPT_end state = 0;
3101 #define REP_begin { inte firstloop=1; do {
3102 #define REP_end if (firstloop) {if(state) break; firstloop=0;} } while (!state); state=firstloop; }
3103
3104 extern char *__BNF_input, *__BNF_output;
3105 unsigned __BNF_level;
3106 unsigned int __BNF_rulecnt;
3107 /* we need some prototypes .... */
3108 int __BNF_get(void); /* returns EOF when eof read... */
3109 int __BNF_flush(void);
3110 #define __BNF_put(ch) *__BNF_output++ = (ch)
3111
3112 int __BNF_input_string( char *s )
3113 FUN_begin
3114 char *t;
3115
3116 for (t = s, state = 0; *t; t++)
3117 if ((state = (__BNF_get() != *t)) != 0) break;
3118
3119 FUN_end
3120
__BNF_output_string(char * source)3121 int __BNF_output_string( char *source )
3122 {
3123 register char *s = source, *t = __BNF_output;
3124
3125 while ( *s ) *t++ = *s++;
3126
3127 __BNF_output = t;
3128
3129 return 0;
3130 }
3131
3132
3133 int __BNF_trans_string( char *str )
3134 FUN_begin
3135 char *s, ch;
3136
3137 for ( s = str; *s; s++) {
3138 ch = __BNF_get();
3139 if ( ch == *s )
3140 __BNF_put( ch );
3141 else {
3142 RESTORE;
3143 return 1;
3144 }
3145 }
3146 state = 0;
3147
3148 FUN_end
3149
__BNF_swap(char * first,char * second,char * third)3150 int __BNF_swap( char *first, char *second, char *third )
3151 {
3152 unsigned len1 = second - first, len2 = third - second;
3153 char *hold = strncpy( (char *) malloc(len1+1), first, len1 );
3154
3155 strncpy( first, second, len2 );
3156 strncpy( first+len2, hold, len1 );
3157
3158 free(hold);
3159 return 0;
3160 }
3161
3162 DEFUN(__BNF_trans_char)
3163 FUN_begin
3164 int ch;
3165
3166 if ( (state = ((ch = __BNF_get()) == EOF)) == 0) __BNF_put( ch );
3167 FUN_end
3168
3169 DEFUN(eoi)
3170 FUN_begin
3171 state = !(__BNF_get() == EOF);
3172 FUN_end
3173
DEFUN(commentchars)3174 DEFUN(commentchars)
3175 {
3176 register char ch;
3177
3178 for ( ch = __BNF_get(); ch != '\n'; ch = __BNF_get() )
3179 __BNF_put(ch);
3180
3181 --__BNF_input;
3182
3183 return 0;
3184 }
3185
3186
ignorechars(void)3187 int ignorechars (void)
3188 {
3189 int ch;
3190
3191 ch = __BNF_get();
3192 while ( ch != '\n' && ch != EOF )
3193 ch = __BNF_get();
3194 -- __BNF_input;
3195 return 0;
3196 }
3197
3198 DEFUN(stringchar)
3199 FUN_begin
3200 int ch=__BNF_get();
3201
3202 state = !(isprint( ch ) && ch != '\n' && ch != '\'');
3203
3204 if ( ch == '\\' ) {
3205 ch = __BNF_get();
3206 if ( !state ) {
3207 state = !isprint( ch );
3208 if (!state) {
3209 __BNF_put( '\\' );
3210 __BNF_put( ch );
3211 }
3212 }
3213 }
3214 else
3215 if ( !state ) __BNF_put( ch );
3216
3217 FUN_end
3218
3219 DEFUN(o_stringchar)
3220 FUN_begin
3221 int ch=__BNF_get();
3222
3223 state = !(isprint( ch ) && ch != '\n' && ch != '`');
3224
3225 if ( ch == '\\' ) {
3226 ch = __BNF_get();
3227 if ( !state ) {
3228 state = !isprint( ch );
3229 if (!state) {
3230 *__BNF_output++ = '\\';
3231 *__BNF_output++ = ch;
3232 }
3233 }
3234 }
3235 else
3236 if ( !state ) *__BNF_output++ = ch ;
3237 FUN_end
3238
3239 DEFUN(t_stringchar)
3240 FUN_begin
3241 int ch=__BNF_get();
3242
3243 state = !(isprint( ch ) && ch != '\n' && ch != '"');
3244
3245 if ( ch == '\\' ) {
3246 ch = __BNF_get();
3247 if ( !state ) {
3248 state = !isprint( ch );
3249 if (!state)
3250 { __BNF_put( '\\' );
3251 __BNF_put( ch );
3252 }
3253 }
3254 }
3255 else
3256 if ( !state ) __BNF_put( ch );
3257 FUN_end
3258
3259 DEFUN(letter)
3260 FUN_begin
3261 int ch=__BNF_get();
3262
3263 state = !(isalpha( ch ) || ch == '_');
3264
3265 if (state)
3266 RESTORE
3267 else
3268 __BNF_put( ch );
3269 FUN_end
3270
3271 DEFUN(digit)
3272 FUN_begin
3273 int ch = __BNF_get();
3274
3275 state = !isdigit( ch );
3276
3277 if (state)
3278 RESTORE
3279 else
3280 __BNF_put( ch );
3281 FUN_end
3282
3283 DEFUN(special)
3284 FUN_begin
3285 int ch = __BNF_get();
3286
3287 state = !isgraph( ch );
3288
3289 if (state)
3290 RESTORE
3291 else
3292 __BNF_put( ch );
3293
3294 FUN_end
3295
3296 DEFUN(control)
3297 FUN_begin
3298 int ch = __BNF_get();
3299
3300 state = !iscntrl( ch );
3301
3302 if (state)
3303 RESTORE
3304 else
3305 __BNF_put( ch );
3306 FUN_end
3307
3308 DEFUN(character)
3309 FUN_begin
3310 OR_begin
3311 CALL(stringchar)
3312 OR_1
3313 CALL(control)
3314 OR_end
3315 FUN_end
3316
3317
3318 DEFUN(white)
3319 FUN_begin
3320
3321 state = !isspace( __BNF_get() );
3322
3323 if ( !state ) {
3324 while ( isspace( __BNF_get() ) )
3325 ;
3326 --__BNF_input;
3327 };
3328
3329 FUN_end
3330
3331 DEFUN(inc_level)
3332 FUN_begin
3333 ++__BNF_level;
3334
3335 state=0;
3336 FUN_end
3337
3338 DEFUN(dec_level)
3339 FUN_begin
3340 --__BNF_level;
3341
3342 state=0;
3343 FUN_end
3344
DEFUN(out_indent)3345 DEFUN(out_indent)
3346 FUN_begin
3347 unsigned i,j;
3348
3349 for (i=0; i<__BNF_level; i++ )
3350 if (__BNF_tabsize) {
3351 for(j=0;j<__BNF_tabsize;j++) __BNF_put(' ');
3352 }
3353 else
3354 __BNF_put(' ');
3355
3356 state=0;
3357 FUN_end
3358
3359
3360
inc_rule(void)3361 int inc_rule (void)
3362 {
3363 ++ __BNF_rulecnt;
3364 return 0;
3365 }
3366
flush(void)3367 int flush( void )
3368 {
3369 return __BNF_flush();
3370 }
3371
3372 /* eof */
3373
3374
3375
3376
3377
3378 #include <stdio.h>
3379
3380 /****************************************************************************************
3381 * We have either a strings or files as input and output.
3382 */
3383
3384 int __BNF_str_io_parser(char* input,char* output,int (*syntax)());
3385 int __BNF_fil_io_parser(FILE* input,FILE* output,int (*syntax)());
3386
3387 /****************************************************************************************
3388 * STRIO/FILIO COMMON DEFS
3389 */
3390
3391 #include <stdlib.h>
3392
3393 #define BUFFER_SIZE (8*20480)
3394
3395 unsigned __BNF_err_line;
3396 unsigned long __BNF_no_read, __BNF_no_written;
3397 char *__BNF_input, *__BNF_output;
3398 unsigned int __BNF_tabsize = 0;
3399
3400 static int __is_file_io = 0;
3401
3402 /****************************************************************************************
3403 * FILIO
3404 */
3405
3406
3407 FILE *if_ptr = NULL, *of_ptr = NULL;
3408 static char *max___BNF_input;
3409 static char *__BNF_input_buffer = NULL, *__BNF_output_buffer = NULL;
3410
3411
3412 static int init(void);
3413 static int done(void);
3414
__BNF_fil_io_parser(FILE * input,FILE * output,int (* syntax)())3415 int __BNF_fil_io_parser( FILE *input, FILE *output, int (*syntax)() )
3416 {
3417 int retval;
3418
3419 __is_file_io = 1;
3420
3421 /* --- initialisation --- */
3422
3423 __BNF_level = __BNF_rulecnt = 0;
3424 if_ptr = input;
3425 of_ptr = output;
3426
3427 if ( init() ) {
3428 fprintf( stderr, "Fatal: Cannot allocate enough memory.\n" );
3429 return 1;
3430 }
3431 /* --- call the syntax parser --- */
3432 retval = (*syntax)();
3433
3434 /* --- clean up --- */
3435 done();
3436
3437 return retval;
3438 }
3439
__BNF_fil_get(void)3440 int __BNF_fil_get(void)
3441 {
3442 int ch;
3443
3444 if ( __BNF_input == max___BNF_input ) {
3445 if ( (ch = fgetc(if_ptr)) != 0 ) {
3446 *__BNF_input++ = ch;
3447 max___BNF_input++;
3448 __BNF_no_read++;
3449 }
3450 if ( ch == '\n' ) __BNF_err_line++;
3451 return ch;
3452 }
3453 else
3454 return *__BNF_input++;
3455 }
3456
__BNF_fil_put(int ch)3457 int __BNF_fil_put(int ch)
3458 {
3459 if ( __BNF_output == __BNF_output_buffer+BUFFER_SIZE ) {
3460 return 1;
3461 }
3462
3463 *__BNF_output++ = ch;
3464 return 0;
3465 }
3466
__BNF_fil_flush(void)3467 int __BNF_fil_flush(void)
3468 {
3469
3470 char *s = __BNF_output_buffer;
3471
3472 while ( s < __BNF_output ) {
3473 __BNF_no_written++;
3474 fputc( *s++, of_ptr );
3475 }
3476 __BNF_output = __BNF_output_buffer;
3477
3478 return 0;
3479 }
3480
3481
init(void)3482 static int init(void)
3483 {
3484 if ( (__BNF_input_buffer = malloc( BUFFER_SIZE )) != NULL ) {
3485 if ( (__BNF_output_buffer = malloc( BUFFER_SIZE )) != NULL ) {
3486 __BNF_input = max___BNF_input = __BNF_input_buffer;
3487 __BNF_output = __BNF_output_buffer;
3488
3489 __BNF_no_read = 0;
3490 __BNF_no_written = 0;
3491 __BNF_err_line=1;
3492 return 0;
3493 }
3494 else
3495 free( __BNF_input_buffer );
3496 }
3497
3498 return 1;
3499 }
3500
done(void)3501 static int done(void)
3502 {
3503 __BNF_flush();
3504
3505 free( __BNF_output_buffer);
3506 free( __BNF_input_buffer );
3507
3508 __BNF_input_buffer = 0;
3509 __BNF_output_buffer = 0;
3510
3511 return 0;
3512 }
3513
3514 /****************************************************************************************
3515 * STRIO
3516 ****************************************************************************************/
3517
__BNF_str_io_parser(char * input,char * output,int (* syntax)())3518 int __BNF_str_io_parser( char *input, char *output, int (*syntax)() )
3519 {
3520 int retval;
3521 char *s;
3522 __is_file_io = 0;
3523
3524 /* --- initialisation --- */
3525 __BNF_input = max___BNF_input = __BNF_input_buffer = input;
3526 __BNF_output = __BNF_output_buffer = output;
3527 __BNF_no_read = __BNF_no_written = 0;
3528 __BNF_err_line = 1;
3529 __BNF_level = __BNF_rulecnt = 0;
3530
3531 /* --- call the syntax parser --- */
3532 retval = syntax();
3533
3534 /* --- count the number of output-bytes --- */
3535 for ( s = __BNF_output_buffer; s < __BNF_output ; s++ )
3536 ++ __BNF_no_written;
3537
3538 return retval;
3539 }
3540
__BNF_str_get(void)3541 int __BNF_str_get( void )
3542 {
3543 register ch;
3544
3545 if ( __BNF_input == max___BNF_input ) {
3546
3547 if ( (ch = *max___BNF_input) != '\0' ) {
3548 ++ max___BNF_input;
3549 ++ __BNF_input;
3550 ++ __BNF_no_read;
3551
3552 if ( ch == '\n' ) __BNF_err_line++;
3553
3554 return ch;
3555 }
3556 else
3557 return EOF;
3558 }
3559 else
3560 return *__BNF_input++;
3561 }
3562
__BNF_str_put(int ch)3563 int __BNF_str_put( int ch )
3564 {
3565 *__BNF_output++ = ch;
3566 return 0;
3567 }
3568
3569
__BNF_str_flush(void)3570 int __BNF_str_flush( void )
3571 {
3572 return 0;
3573 }
3574
3575
3576 /****************************************************************************************
3577 * STRIO/FILIO COMMON HOOKS
3578 ****************************************************************************************/
3579
3580
3581 #if 0
3582 int __BNF_put(int ch)
3583 {
3584 return (__is_file_io == 1) ? __BNF_fil_put(ch) : __BNF_str_put(ch);
3585 }
3586 #endif
__BNF_get(void)3587 int __BNF_get(void)
3588 {
3589 return (__is_file_io == 1) ? __BNF_fil_get() : __BNF_str_get();
3590 }
__BNF_flush(void)3591 int __BNF_flush(void)
3592 {
3593 return (__is_file_io == 1) ? __BNF_fil_flush() : __BNF_str_flush();
3594 }
3595
3596
3597