Warning: Attempt to read property "date" on null in /usr/local/www/websvn.planix.org/blame.php on line 247

Warning: Attempt to read property "msg" on null in /usr/local/www/websvn.planix.org/blame.php on line 247
WebSVN – tendra.SVN – Blame – //branches/tendra4/src/utilities/lexi/syntax.c – Rev 2

Subversion Repositories tendra.SVN

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 7u83 1
/*
2
 * Automatically generated from the files:
3
 *	/u/g/release/Source/src/utilities/lexi/syntax.sid
4
 * and
5
 *	/u/g/release/Source/src/utilities/lexi/syntax.act
6
 * by:
7
 *	sid
8
 */
9
 
10
/* BEGINNING OF HEADER */
11
 
12
 
13
/*
14
    		 Crown Copyright (c) 1997
15
 
16
    This TenDRA(r) Computer Program is subject to Copyright
17
    owned by the United Kingdom Secretary of State for Defence
18
    acting through the Defence Evaluation and Research Agency
19
    (DERA).  It is made available to Recipients with a
20
    royalty-free licence for its use, reproduction, transfer
21
    to other parties and amendment for any purpose not excluding
22
    product development provided that any such use et cetera
23
    shall be deemed to be acceptance of the following conditions:-
24
 
25
        (1) Its Recipients shall ensure that this Notice is
26
        reproduced upon any copies or amended versions of it;
27
 
28
        (2) Any amended version of it shall be clearly marked to
29
        show both the nature of and the organisation responsible
30
        for the relevant amendment or amendments;
31
 
32
        (3) Its onward transfer from a recipient to another
33
        party shall be deemed to be that party's acceptance of
34
        these conditions;
35
 
36
        (4) DERA gives no warranty or assurance as to its
37
        quality or suitability for any purpose and DERA accepts
38
        no liability whatsoever in relation to any use to which
39
        it may be put.
40
*/
41
 
42
 
43
#include "config.h"
44
#include "char.h"
45
#include "error.h"
46
#include "lex.h"
47
#include "syntax.h"
48
#include "xalloc.h"
49
 
50
 
51
/*
52
    PARSER TYPES
53
 
54
    These types give the implementation of the types used in the syntax.
55
*/
56
 
57
typedef letter *SID_CHARS ;
58
typedef char *SID_STRING ;
59
 
60
 
61
/*
62
    SID IDENTIFIER PREFIX
63
 
64
    This string is added to the start of each sid identifier.
65
*/
66
 
67
char *sid_prefix = "lex_" ;
68
 
69
 
70
/*
71
    CURRENT CONDITIONAL
72
 
73
    This variable is used to record the current conditional.
74
*/
75
 
76
static char *crt_cond = NULL ;
77
 
78
 
79
/*
80
    COMPILATION MODE
81
 
82
    We allow unreached code in the automatically generated sections.
83
*/
84
 
85
#if FS_TENDRA
86
#pragma TenDRA begin
87
#ifndef OLD_PRODUCER
88
#pragma TenDRA unreachable code allow
89
#endif
90
#endif
91
 
92
 
93
 
94
/* BEGINNING OF FUNCTION DECLARATIONS */
95
 
96
static void ZRstring_Hplus PROTO_S ((SID_STRING *));
97
static void ZRchars PROTO_S ((SID_CHARS *));
98
static void ZRargs PROTO_S ((int *));
99
static void ZRtrigraph_Hdefn PROTO_S ((void));
100
static void ZR60 PROTO_S ((SID_STRING *, int *));
101
extern void read_lex PROTO_S ((void));
102
static void ZR68 PROTO_S ((void));
103
static void ZRcommand_Hlist PROTO_S ((void));
104
static void ZRkeyword_Hdefn PROTO_S ((void));
105
static void ZRif_Hcommand PROTO_S ((void));
106
static void ZRcommand PROTO_S ((void));
107
static void ZRtoken_Hdefn PROTO_S ((void));
108
 
109
/* BEGINNING OF STATIC VARIABLES */
110
 
111
 
112
/* BEGINNING OF FUNCTION DEFINITIONS */
113
 
114
static void
115
ZRstring_Hplus PROTO_N ((ZOs))
116
  PROTO_T (SID_STRING *ZOs)
117
{
118
    SID_STRING ZIs;
119
 
120
    if ((CURRENT_TERMINAL) == 23) {
121
	return;
122
    }
123
    {
124
	SID_STRING ZIa;
125
 
126
	{
127
	    switch (CURRENT_TERMINAL) {
128
	      case 5:
129
		{
130
		    {
131
 ZIa = "0123456789" ; 
132
		    }
133
		    ADVANCE_LEXER;
134
		}
135
		break;
136
	      case 4:
137
		{
138
		    {
139
 ZIa = "abcdefghijklmnopqrstuvwxyz" ; 
140
		    }
141
		    ADVANCE_LEXER;
142
		}
143
		break;
144
	      case 2:
145
		{
146
		    {
147
 
148
    ZIa = xstrcpy ( token_buff ) ;
149
		    }
150
		    ADVANCE_LEXER;
151
		}
152
		break;
153
	      case 3:
154
		{
155
		    {
156
 ZIa = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" ; 
157
		    }
158
		    ADVANCE_LEXER;
159
		}
160
		break;
161
	      default:
162
		goto ZL1;
163
	    }
164
	}
165
	{
166
	    switch (CURRENT_TERMINAL) {
167
	      case 20:
168
		{
169
		    SID_STRING ZIb;
170
 
171
		    ADVANCE_LEXER;
172
		    ZRstring_Hplus (&ZIb);
173
		    if ((CURRENT_TERMINAL) == 23) {
174
			RESTORE_LEXER;
175
			goto ZL1;
176
		    }
177
		    {
178
 
179
    (ZIs) = xstrcat ( (ZIa), (ZIb) ) ;
180
		    }
181
		}
182
		break;
183
	      default:
184
		{
185
		    ZIs = ZIa;
186
		}
187
		break;
188
	    }
189
	}
190
    }
191
    goto ZL0;
192
  ZL1:;
193
    SAVE_LEXER (23);
194
    return;
195
  ZL0:;
196
    *ZOs = ZIs;
197
}
198
 
199
static void
200
ZRchars PROTO_N ((ZOc))
201
  PROTO_T (SID_CHARS *ZOc)
202
{
203
    SID_CHARS ZIc;
204
 
205
    if ((CURRENT_TERMINAL) == 23) {
206
	return;
207
    }
208
    {
209
	SID_STRING ZIs;
210
 
211
	ZRstring_Hplus (&ZIs);
212
	if ((CURRENT_TERMINAL) == 23) {
213
	    RESTORE_LEXER;
214
	    goto ZL1;
215
	}
216
	{
217
 
218
    (ZIc) = make_string ( (ZIs) ) ;
219
	}
220
    }
221
    goto ZL0;
222
  ZL1:;
223
    SAVE_LEXER (23);
224
    return;
225
  ZL0:;
226
    *ZOc = ZIc;
227
}
228
 
229
static void
230
ZRargs PROTO_N ((ZOa))
231
  PROTO_T (int *ZOa)
232
{
233
    int ZIa;
234
 
235
    switch (CURRENT_TERMINAL) {
236
      case 13:
237
	{
238
	    ADVANCE_LEXER;
239
	    switch (CURRENT_TERMINAL) {
240
	      case 14:
241
		break;
242
	      default:
243
		goto ZL1;
244
	    }
245
	    ADVANCE_LEXER;
246
	    {
247
 (ZIa) = 1 ; 
248
	    }
249
	}
250
	break;
251
      default:
252
	{
253
	    {
254
 (ZIa) = 0 ; 
255
	    }
256
	}
257
	break;
258
      case 23:
259
	return;
260
    }
261
    goto ZL0;
262
  ZL1:;
263
    SAVE_LEXER (23);
264
    return;
265
  ZL0:;
266
    *ZOa = ZIa;
267
}
268
 
269
static void
270
ZRtrigraph_Hdefn PROTO_Z ()
271
{
272
    if ((CURRENT_TERMINAL) == 23) {
273
	return;
274
    }
275
    {
276
	SID_CHARS ZIs;
277
	SID_STRING ZIt;
278
 
279
	switch (CURRENT_TERMINAL) {
280
	  case 8:
281
	    break;
282
	  default:
283
	    goto ZL1;
284
	}
285
	ADVANCE_LEXER;
286
	ZRchars (&ZIs);
287
	switch (CURRENT_TERMINAL) {
288
	  case 17:
289
	    break;
290
	  case 23:
291
	    RESTORE_LEXER;
292
	    goto ZL1;
293
	  default:
294
	    goto ZL1;
295
	}
296
	ADVANCE_LEXER;
297
	ZRstring_Hplus (&ZIt);
298
	if ((CURRENT_TERMINAL) == 23) {
299
	    RESTORE_LEXER;
300
	    goto ZL1;
301
	}
302
	{
303
 
304
    char *data [3] ;
305
    data [0] = (ZIt) ;
306
    data [1] = NULL ;
307
    data [2] = crt_cond ;
308
    add_char ( pre_pass, (ZIs), data ) ;
309
	}
310
    }
311
    return;
312
  ZL1:;
313
    SAVE_LEXER (23);
314
    return;
315
}
316
 
317
static void
318
ZR60 PROTO_N ((ZOi, ZOa))
319
  PROTO_T (SID_STRING *ZOi X int *ZOa)
320
{
321
    SID_STRING ZIi;
322
    int ZIa;
323
 
324
    switch (CURRENT_TERMINAL) {
325
      case 0:
326
	{
327
	    {
328
 
329
    ZIi = xstrcpy ( token_buff ) ;
330
	    }
331
	    ADVANCE_LEXER;
332
	    ZRargs (&ZIa);
333
	    if ((CURRENT_TERMINAL) == 23) {
334
		RESTORE_LEXER;
335
		goto ZL1;
336
	    }
337
	}
338
	break;
339
      case 1:
340
	{
341
	    {
342
 
343
    int n ;
344
    char *s ;
345
    char buff [1000] ;
346
    strcpy_v ( buff, sid_prefix ) ;
347
    n = ( int ) strlen ( buff ) ;
348
    for ( s = token_buff ; *s ; s++ ) {
349
	if ( *s == '-' ) {
350
	    buff [ n++ ] = '_' ;
351
	    buff [ n++ ] = 'H' ;
352
	} else if ( *s == '_' ) {
353
	    buff [ n++ ] = '_' ;
354
	    buff [ n++ ] = '_' ;
355
	} else {
356
	    buff [ n++ ] = *s ;
357
	}
358
	if ( n >= 900 ) {
359
	    error ( ERROR_SERIOUS, "Identifier too long" ) ;
360
	    break ;
361
	}
362
    }
363
    buff [n] = 0 ;
364
    ZIi = xstrcpy ( buff ) ;
365
	    }
366
	    ADVANCE_LEXER;
367
	    {
368
 (ZIa) = 0 ; 
369
	    }
370
	}
371
	break;
372
      case 23:
373
	return;
374
      default:
375
	goto ZL1;
376
    }
377
    goto ZL0;
378
  ZL1:;
379
    SAVE_LEXER (23);
380
    return;
381
  ZL0:;
382
    *ZOi = ZIi;
383
    *ZOa = ZIa;
384
}
385
 
386
void
387
read_lex PROTO_Z ()
388
{
389
    if ((CURRENT_TERMINAL) == 23) {
390
	return;
391
    }
392
    {
393
	ZRcommand_Hlist ();
394
	{
395
	    if ((CURRENT_TERMINAL) == 23) {
396
		RESTORE_LEXER;
397
		goto ZL1;
398
	    }
399
	    {
400
		switch (CURRENT_TERMINAL) {
401
		  case 18:
402
		    break;
403
		  default:
404
		    goto ZL3;
405
		}
406
		ADVANCE_LEXER;
407
	    }
408
	    goto ZL2;
409
	  ZL3:;
410
	    {
411
		{
412
 
413
    error ( ERROR_SERIOUS, "Syntax error" ) ;
414
		}
415
	    }
416
	  ZL2:;
417
	}
418
    }
419
    return;
420
  ZL1:;
421
    SAVE_LEXER (23);
422
    return;
423
}
424
 
425
static void
426
ZR68 PROTO_Z ()
427
{
428
    switch (CURRENT_TERMINAL) {
429
      case 0:
430
	{
431
	    SID_STRING ZIi;
432
	    SID_CHARS ZIs;
433
 
434
	    {
435
 
436
    ZIi = xstrcpy ( token_buff ) ;
437
	    }
438
	    ADVANCE_LEXER;
439
	    switch (CURRENT_TERMINAL) {
440
	      case 19:
441
		break;
442
	      default:
443
		goto ZL1;
444
	    }
445
	    ADVANCE_LEXER;
446
	    ZRchars (&ZIs);
447
	    if ((CURRENT_TERMINAL) == 23) {
448
		RESTORE_LEXER;
449
		goto ZL1;
450
	    }
451
	    {
452
 
453
    make_group ( (ZIi), (ZIs) ) ;
454
	    }
455
	    switch (CURRENT_TERMINAL) {
456
	      case 21:
457
		break;
458
	      default:
459
		goto ZL1;
460
	    }
461
	    ADVANCE_LEXER;
462
	}
463
	break;
464
      case 10:
465
	{
466
	    SID_CHARS ZIs;
467
 
468
	    ADVANCE_LEXER;
469
	    switch (CURRENT_TERMINAL) {
470
	      case 19:
471
		break;
472
	      default:
473
		goto ZL1;
474
	    }
475
	    ADVANCE_LEXER;
476
	    ZRchars (&ZIs);
477
	    if ((CURRENT_TERMINAL) == 23) {
478
		RESTORE_LEXER;
479
		goto ZL1;
480
	    }
481
	    {
482
 
483
    if ( white_space ) {
484
	error ( ERROR_SERIOUS, "White space group already defined" ) ;
485
    }
486
    white_space = (ZIs) ;
487
	    }
488
	    switch (CURRENT_TERMINAL) {
489
	      case 21:
490
		break;
491
	      default:
492
		goto ZL1;
493
	    }
494
	    ADVANCE_LEXER;
495
	}
496
	break;
497
      case 23:
498
	return;
499
      default:
500
	goto ZL1;
501
    }
502
    return;
503
  ZL1:;
504
    SAVE_LEXER (23);
505
    return;
506
}
507
 
508
static void
509
ZRcommand_Hlist PROTO_Z ()
510
{
511
  ZL2_command_Hlist:;
512
    switch (CURRENT_TERMINAL) {
513
      case 6: case 7: case 8: case 9: case 11:
514
      case 15: case 21:
515
	{
516
	    ZRcommand ();
517
	    if ((CURRENT_TERMINAL) == 23) {
518
		RESTORE_LEXER;
519
		goto ZL1;
520
	    } else {
521
		goto ZL2_command_Hlist;
522
	    }
523
	}
524
	/*UNREACHED*/
525
      case 23:
526
	return;
527
      default:
528
	break;
529
    }
530
    return;
531
  ZL1:;
532
    {
533
	{
534
 
535
    error ( ERROR_SERIOUS, "Syntax error" ) ;
536
	}
537
    }
538
}
539
 
540
static void
541
ZRkeyword_Hdefn PROTO_Z ()
542
{
543
    if ((CURRENT_TERMINAL) == 23) {
544
	return;
545
    }
546
    {
547
	SID_STRING ZIs;
548
	SID_STRING ZIi;
549
	int ZIa;
550
 
551
	switch (CURRENT_TERMINAL) {
552
	  case 7:
553
	    break;
554
	  default:
555
	    goto ZL1;
556
	}
557
	ADVANCE_LEXER;
558
	switch (CURRENT_TERMINAL) {
559
	  case 2:
560
	    {
561
 
562
    ZIs = xstrcpy ( token_buff ) ;
563
	    }
564
	    break;
565
	  default:
566
	    goto ZL1;
567
	}
568
	ADVANCE_LEXER;
569
	switch (CURRENT_TERMINAL) {
570
	  case 17:
571
	    break;
572
	  default:
573
	    goto ZL1;
574
	}
575
	ADVANCE_LEXER;
576
	ZR60 (&ZIi, &ZIa);
577
	if ((CURRENT_TERMINAL) == 23) {
578
	    RESTORE_LEXER;
579
	    goto ZL1;
580
	}
581
	{
582
 
583
    char *data [3] ;
584
    data [0] = (ZIi) ;
585
    data [1] = ( (ZIa) ? "()" : NULL ) ;
586
    data [2] = crt_cond ;
587
    add_keyword ( (ZIs), data ) ;
588
	}
589
    }
590
    return;
591
  ZL1:;
592
    SAVE_LEXER (23);
593
    return;
594
}
595
 
596
static void
597
ZRif_Hcommand PROTO_Z ()
598
{
599
    if ((CURRENT_TERMINAL) == 23) {
600
	return;
601
    }
602
    {
603
	SID_STRING ZIi;
604
	SID_STRING ZIj;
605
 
606
	switch (CURRENT_TERMINAL) {
607
	  case 11:
608
	    break;
609
	  default:
610
	    goto ZL1;
611
	}
612
	ADVANCE_LEXER;
613
	switch (CURRENT_TERMINAL) {
614
	  case 13:
615
	    break;
616
	  default:
617
	    goto ZL1;
618
	}
619
	ADVANCE_LEXER;
620
	switch (CURRENT_TERMINAL) {
621
	  case 0:
622
	    {
623
 
624
    ZIi = xstrcpy ( token_buff ) ;
625
	    }
626
	    break;
627
	  default:
628
	    goto ZL1;
629
	}
630
	ADVANCE_LEXER;
631
	switch (CURRENT_TERMINAL) {
632
	  case 14:
633
	    break;
634
	  default:
635
	    goto ZL1;
636
	}
637
	ADVANCE_LEXER;
638
	{
639
 
640
    (ZIj) = crt_cond ;
641
	}
642
	{
643
 
644
    if ( crt_cond ) {
645
	crt_cond = xstrcat ( crt_cond, xstrcat ( " && ", (ZIi) ) ) ;
646
    } else {
647
	crt_cond = (ZIi) ;
648
    }
649
	}
650
	ZRcommand ();
651
	{
652
	    if ((CURRENT_TERMINAL) == 23) {
653
		RESTORE_LEXER;
654
		goto ZL1;
655
	    }
656
	    {
657
		switch (CURRENT_TERMINAL) {
658
		  case 12:
659
		    break;
660
		  default:
661
		    goto ZL3;
662
		}
663
		ADVANCE_LEXER;
664
		{
665
 
666
    if ( crt_cond ) {
667
	if ( strchr ( crt_cond, '&' ) ) {
668
	    crt_cond = xstrcat ( xstrcat ( "!( ", crt_cond ), " )" ) ;
669
	} else {
670
	    crt_cond = xstrcat ( "!", crt_cond ) ;
671
	}
672
    }
673
		}
674
		ZRcommand ();
675
		if ((CURRENT_TERMINAL) == 23) {
676
		    RESTORE_LEXER;
677
		    goto ZL3;
678
		}
679
		{
680
 
681
    crt_cond = (ZIj) ;
682
		}
683
	    }
684
	    goto ZL2;
685
	  ZL3:;
686
	    {
687
		{
688
 
689
    crt_cond = (ZIj) ;
690
		}
691
	    }
692
	  ZL2:;
693
	}
694
    }
695
    return;
696
  ZL1:;
697
    SAVE_LEXER (23);
698
    return;
699
}
700
 
701
static void
702
ZRcommand PROTO_Z ()
703
{
704
    switch (CURRENT_TERMINAL) {
705
      case 6:
706
	{
707
	    ADVANCE_LEXER;
708
	    ZR68 ();
709
	    if ((CURRENT_TERMINAL) == 23) {
710
		RESTORE_LEXER;
711
		goto ZL1;
712
	    }
713
	}
714
	break;
715
      case 15:
716
	{
717
	    ADVANCE_LEXER;
718
	    ZRcommand_Hlist ();
719
	    switch (CURRENT_TERMINAL) {
720
	      case 16:
721
		break;
722
	      case 23:
723
		RESTORE_LEXER;
724
		goto ZL1;
725
	      default:
726
		goto ZL1;
727
	    }
728
	    ADVANCE_LEXER;
729
	}
730
	break;
731
      case 21:
732
	{
733
	    ADVANCE_LEXER;
734
	}
735
	break;
736
      case 11:
737
	{
738
	    ZRif_Hcommand ();
739
	    if ((CURRENT_TERMINAL) == 23) {
740
		RESTORE_LEXER;
741
		goto ZL1;
742
	    }
743
	}
744
	break;
745
      case 7:
746
	{
747
	    ZRkeyword_Hdefn ();
748
	    switch (CURRENT_TERMINAL) {
749
	      case 21:
750
		break;
751
	      case 23:
752
		RESTORE_LEXER;
753
		goto ZL1;
754
	      default:
755
		goto ZL1;
756
	    }
757
	    ADVANCE_LEXER;
758
	}
759
	break;
760
      case 9:
761
	{
762
	    ZRtoken_Hdefn ();
763
	    switch (CURRENT_TERMINAL) {
764
	      case 21:
765
		break;
766
	      case 23:
767
		RESTORE_LEXER;
768
		goto ZL1;
769
	      default:
770
		goto ZL1;
771
	    }
772
	    ADVANCE_LEXER;
773
	}
774
	break;
775
      case 8:
776
	{
777
	    ZRtrigraph_Hdefn ();
778
	    switch (CURRENT_TERMINAL) {
779
	      case 21:
780
		break;
781
	      case 23:
782
		RESTORE_LEXER;
783
		goto ZL1;
784
	      default:
785
		goto ZL1;
786
	    }
787
	    ADVANCE_LEXER;
788
	}
789
	break;
790
      case 23:
791
	return;
792
      default:
793
	goto ZL1;
794
    }
795
    return;
796
  ZL1:;
797
    SAVE_LEXER (23);
798
    return;
799
}
800
 
801
static void
802
ZRtoken_Hdefn PROTO_Z ()
803
{
804
    if ((CURRENT_TERMINAL) == 23) {
805
	return;
806
    }
807
    {
808
	SID_CHARS ZIs;
809
	SID_STRING ZIi;
810
	int ZIa;
811
 
812
	switch (CURRENT_TERMINAL) {
813
	  case 9:
814
	    break;
815
	  default:
816
	    goto ZL1;
817
	}
818
	ADVANCE_LEXER;
819
	ZRchars (&ZIs);
820
	switch (CURRENT_TERMINAL) {
821
	  case 17:
822
	    break;
823
	  case 23:
824
	    RESTORE_LEXER;
825
	    goto ZL1;
826
	  default:
827
	    goto ZL1;
828
	}
829
	ADVANCE_LEXER;
830
	ZR60 (&ZIi, &ZIa);
831
	if ((CURRENT_TERMINAL) == 23) {
832
	    RESTORE_LEXER;
833
	    goto ZL1;
834
	}
835
	{
836
 
837
    char *data [3] ;
838
    data [0] = (ZIi) ;
839
    data [1] = ( (ZIa) ? "()" : NULL ) ;
840
    data [2] = crt_cond ;
841
    add_char ( main_pass, (ZIs), data ) ;
842
	}
843
    }
844
    return;
845
  ZL1:;
846
    SAVE_LEXER (23);
847
    return;
848
}
849
 
850
/* BEGINNING OF TRAILER */
851
 
852
 
853
 
854
/* END OF FILE */