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/tendra5/src/producers/common/parse/psyntax.sid – 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
    		 Crown Copyright (c) 1997, 1998
3
 
4
    This TenDRA(r) Computer Program is subject to Copyright
5
    owned by the United Kingdom Secretary of State for Defence
6
    acting through the Defence Evaluation and Research Agency
7
    (DERA).  It is made available to Recipients with a
8
    royalty-free licence for its use, reproduction, transfer
9
    to other parties and amendment for any purpose not excluding
10
    product development provided that any such use et cetera
11
    shall be deemed to be acceptance of the following conditions:-
12
 
13
        (1) Its Recipients shall ensure that this Notice is
14
        reproduced upon any copies or amended versions of it;
15
 
16
        (2) Any amended version of it shall be clearly marked to
17
        show both the nature of and the organisation responsible
18
        for the relevant amendment or amendments;
19
 
20
        (3) Its onward transfer from a recipient to another
21
        party shall be deemed to be that party's acceptance of
22
        these conditions;
23
 
24
        (4) DERA gives no warranty or assurance as to its
25
        quality or suitability for any purpose and DERA accepts
26
        no liability whatsoever in relation to any use to which
27
        it may be put.
28
*/
29
 
30
 
31
/*
32
    PRAGMA SYNTAX
33
 
34
    This module gives the syntax for the '#pragma' directives recognised
35
    by the producer.
36
*/
37
 
38
 
39
/*
40
    TYPE DECLARATIONS
41
 
42
    The types BOOL, COUNT and LEX are natural types arising from the
43
    parser.  The remaining types directly correspond to types within the
44
    main program, or composite types formed from them.
45
*/
46
 
47
%types%
48
 
49
ACCESS ;
50
BOOL ;
51
BTYPE ;
52
CV ;
53
EXP ;
54
IDENTIFIER ;
55
LEX ;
56
LINKAGE ;
57
LIST-ID ;
58
NAMESPACE ;
59
NUMBER ;
60
STATE ;
61
TOKEN ;
62
TYPE ;
63
VALUE ;
64
 
65
 
66
/*
67
    LIST OF TERMINALS
68
 
69
    This list of terminals corresponds to that given in symbols.h and
70
    syntax.h.
71
*/
72
 
73
%terminals%
74
 
75
!unknown ;
76
 
77
/* Identifiers */
78
identifier : () -> ( :IDENTIFIER ) ;
79
type-name : () -> ( :IDENTIFIER ) ;
80
namespace-name : () -> ( :IDENTIFIER ) ;
81
statement-name : () -> ( :IDENTIFIER ) ;
82
!destructor-name : () -> ( :IDENTIFIER ) ;
83
!template-id : () -> ( :IDENTIFIER ) ;
84
!template-type : () -> ( :IDENTIFIER ) ;
85
 
86
/* Nested name specifiers */
87
!nested-name : () -> ( :NAMESPACE ) ;
88
!full-name : () -> ( :NAMESPACE ) ;
89
!nested-name-star : () -> ( :IDENTIFIER ) ;
90
!full-name-star : () -> ( :IDENTIFIER ) ;
91
 
92
/* Literals */
93
!char-lit ; !wchar-lit ; !string-lit ; !wstring-lit ; !integer-lit ;
94
 
95
/* Literal expressions */
96
char-exp : () -> ( :EXP ) ;
97
wchar-exp : () -> ( :EXP ) ;
98
string-exp : () -> ( :EXP ) ;
99
wstring-exp : () -> ( :EXP ) ;
100
integer-exp : () -> ( :EXP ) ;
101
!floating-exp : () -> ( :EXP ) ;
102
 
103
/* Token applications */
104
!complex-exp : () -> ( :EXP ) ;
105
!complex-stmt : () -> ( :EXP ) ;
106
!complex-type : () -> ( :TYPE ) ;
107
 
108
/* Target-dependent preprocessing directives */
109
!hash-if : () -> ( :EXP ) ;
110
!hash-elif : () -> ( :EXP ) ;
111
!hash-else ;
112
!hash-endif ;
113
!hash-pragma ;
114
 
115
/* End of file markers */
116
!newline ; !eof ;
117
 
118
/* Symbols */
119
!and-1 ; !and-eq-1 ; !arrow ; !assign ; !backslash ; close-brace-1 ;
120
close-round ; !close-square-1 ; colon ; comma ; !compl-1 ; div ; !div-eq ;
121
dot ; ellipsis ; eq ; !greater ; !greater-eq ; hash-1 ; !hash-hash-1 ;
122
!less ; !less-eq ; !logical-and-1 ; !logical-or-1 ; !lshift ; !lshift-eq ;
123
minus ; !minus-eq ; !minus-minus ; !not-1 ; !not-eq-1 ; open-brace-1 ;
124
open-round ; !open-square-1 ; or-1 ; !or-eq-1 ; plus ; !plus-eq ;
125
!plus-plus ; question ; !rem ; !rem-eq ; !rshift ; !rshift-eq ;
126
semicolon ; star ; !star-eq ; !xor-1 ; !xor-eq-1 ; !arrow-star ;
127
colon-colon ; !dot-star ; !abs ; !max ; !min ;
128
 
129
/* Digraphs */
130
!close-brace-2 ; !close-square-2 ; !hash-2 ; !hash-hash-2 ;
131
!open-brace-2 ; !open-square-2 ;
132
 
133
/* C keywords */
134
auto ; !break ; case ; !char ; const ; !continue ; !default ; !do ;
135
!double ; !else ; enum ; !extern ; !float ; for ; !goto ; !if ; int ;
136
long ; !register ; return ; !short ; signed ; !sizeof ; static ; struct ;
137
switch ; !typedef ; union ; unsigned ; void ; volatile ; !while ;
138
 
139
/* C++ keywords */
140
asm ; bool ; catch ; !class ; const-cast ; !delete ; !dynamic-cast ;
141
explicit ; export ; !false ; !friend ; inline ; !mutable ; namespace ;
142
!new ; operator ; private ; protected ; public ; reinterpret-cast ;
143
static-cast ; template ; this ; throw ; !true ; !try ; !typeid ;
144
!typename ; !using ; !virtual ; wchar-t ;
145
 
146
/* ISO keywords */
147
!and-2 ; !and-eq-2 ; !compl-2 ; !logical-and-2 ; !logical-or-2 ;
148
!not-2 ; !not-eq-2 ; !or-2 ; !or-eq-2 ; !xor-2 ; !xor-eq-2 ;
149
 
150
/* TenDRA keywords */
151
accept ; after ; !alignof ; all ; allow ; ambiguous ; analysis ;
152
argument ; arith-cap ; !array ; as ; assert ; assignment ; begin ;
153
bitfield ; block ; bottom ; cast ; character ; class-cap ; code ;
154
comment ; compatible ; complete ; compute ; conditional ; conversion ;
155
decimal ; decl ; define ; !define-cap ; !defined ; definition ; depth ;
156
directive ; directory ; disallow ; discard ; dollar ; either ; !elif ;
157
ellipsis-exp ; end ; !endif ; environment ; equality ; error ; escape ;
158
exhaustive ; exp-cap ; !explain ; !extend ; external ; extra ; fall ;
159
file ; float-cap ; forward ; func-cap ; function ; hexadecimal ; hiding ;
160
ident ; identif ; !ifdef ; !ifndef ; ignore ; !implement ; implicit ;
161
import ; !include ; includes ; include-next ; incompatible ; incomplete ;
162
indented ; initialization ; integer ; interface ; internal ; into ;
163
int-cap ; keyword ; limit ; !line ; linkage ; lit ; longlong ; lvalue ;
164
macro ; !main ; member ; member-cap ; name ; nat-cap ; nested ; nline ;
165
no ; no-def ; object ; octal ; of ; off ; on ; option ; overflow ;
166
overload ; pointer ; postpone ; pragma ; precedence ; preserve ; printf ;
167
proc-cap ; promote ; promoted ; prototype ; ptrdiff-t ; qualifier ;
168
quote ; reachable ; !reference ; reject ; representation ; reset ;
169
resolution ; rvalue ; scalar-cap ; scanf ; set ; size-t ; !size-t-2 ;
170
!sort ; std ; stmt-cap ; string ; struct-cap ; suspend ; tag ; tag-cap ;
171
!tendra ; text ; !this-name ; token ; type ; type-cap ; !typeof ;
172
un-known ; unassert ; undef ; unify ; union-cap ; unmatched ; unpostpone ;
173
unreachable ; !unused ; use ; value ; variable ; variety-cap ;
174
volatile-t ; !vtable ; warning ; weak ; writeable ; !zzzz ;
175
 
176
/* Miscellaneous symbols */
177
!array-op ; !builtin-file ; !builtin-line ; !close-template ; !cond-op ;
178
!delete-full ; !delete-array ; !delete-array-full ; !func-op ; !hash-op ;
179
!hash-hash-op ; !inset-start ; !inset-end ; !macro-arg ; !new-full ;
180
!new-array ; !new-array-full ; !open-init ; !open-template ; !zzzzzz ;
181
 
182
 
183
/*
184
    ALTERNATIVE REPRESENTATIONS
185
 
186
    The ISO keywords and digraphs will have been replaced by their primary
187
    representations by this stage.  These rules are effectively identities
188
    for these alternatives.  Don't try removing them - SID gets very
189
    confused.
190
*/
191
 
192
%productions%
193
 
194
close-brace =	{ close-brace-1 ; } ;
195
open-brace =	{ open-brace-1 ; } ;
196
hash =		{ hash-1 ; } ;
197
or =		{ or-1 ; } ;
198
ellipsis-aux =	{ ellipsis ; || ellipsis-exp ; } ;
199
 
200
 
201
/*
202
    IDENTIFIERS
203
 
204
    The identifier terminal is exclusive - it does not include those
205
    identifiers which are actually type and namespace names.  This rule
206
    gives all identifiers and sets the appropriate identifier type.
207
*/
208
 
209
any-identifier : () -> ( id : IDENTIFIER ) = {
210
	id = identifier ;
211
    ||	id = type-name ;
212
    ||	id = namespace-name ;
213
    ||	id = statement-name ;
214
} ;
215
 
216
 
217
/*
218
    LITERAL EXPRESSIONS
219
 
220
    These rules describe the literal expressions.  These are the integer
221
    and floating point literals, the character and string literals, plus
222
    the boolean literals true and false.  Concatenation of adjacent string
223
    literals has already been performed.
224
*/
225
 
226
integer-literal : () -> ( e : EXP ) = {
227
	e = integer-exp ;
228
} ;
229
 
230
character-literal : () -> ( e : EXP ) = {
231
	e = char-exp ;
232
    ||	e = wchar-exp ;
233
} ;
234
 
235
string-literal : () -> ( e : EXP ) = {
236
	e = string-exp ;
237
    ||	e = wstring-exp ;
238
} ;
239
 
240
 
241
/*
242
    PROCEDURE TOKEN SYNTAX
243
 
244
    These rules describe the parameter syntax for procedure tokens.
245
*/
246
 
247
<parse_type> : () -> ( :TYPE ) ;
248
<parse_mem_type> : () -> ( :TYPE ) ;
249
<parse_func_type> : () -> ( :TYPE ) ;
250
<list_id_null> : () -> ( :LIST-ID ) ;
251
<list_id_cons> : ( :IDENTIFIER, :LIST-ID ) -> ( :LIST-ID ) ;
252
<token_param> : ( :TOKEN, :BOOL, :IDENTIFIER ) -> ( :IDENTIFIER ) ;
253
<token_exp_par> : ( :IDENTIFIER, :LIST-ID ) -> ( :IDENTIFIER ) ;
254
<token_stmt_par> : ( :IDENTIFIER, :LIST-ID ) -> ( :IDENTIFIER ) ;
255
<token_type_par> : ( :TYPE, :LIST-ID ) -> ( :IDENTIFIER ) ;
256
<token_member_par> : ( :TYPE, :IDENTIFIER, :LIST-ID ) -> ( :IDENTIFIER ) ;
257
<token_proc_par> : ( :IDENTIFIER, :LIST-ID ) -> ( :IDENTIFIER ) ;
258
<id_anon> : () -> ( :IDENTIFIER ) ;
259
<bool_true> : () -> ( :BOOL ) ;
260
<bool_false> : () -> ( :BOOL ) ;
261
<error_comma> : () -> () ;
262
 
263
token-introduction : () -> ( :TOKEN ) ;
264
 
265
tag-opt : () -> ( t : BOOL ) = {
266
	tag-cap ; t = <bool_true> ;
267
    ||	t = <bool_false> ;
268
} ;
269
 
270
bound-tok-param : () -> ( id : IDENTIFIER ) = {
271
	tok = token-introduction ;
272
	t = tag-opt ; tid = any-identifier ;
273
	id = <token_param> ( tok, t, tid ) ;
274
} ;
275
 
276
bound-tok-pars : () -> ( p : LIST-ID ) = {
277
	id = bound-tok-param ;
278
	{
279
		comma ; q = bound-tok-pars ;
280
	    ||	comma ; <error_comma> ; q = <list_id_null> ;
281
	    ||	q = <list_id_null> ;
282
	} ;
283
	p = <list_id_cons> ( id, q ) ;
284
} ;
285
 
286
prog-tok-param : ( r : LIST-ID ) -> ( id : IDENTIFIER ) = {
287
	exp-cap ; tid = any-identifier ;
288
	id = <token_exp_par> ( tid, r ) ;
289
    ||
290
	stmt-cap ; tid = any-identifier ;
291
	id = <token_stmt_par> ( tid, r ) ;
292
    ||
293
	type-cap ; t = <parse_type> ;
294
	id = <token_type_par> ( t, r ) ;
295
    ||
296
	member-cap ;
297
	t = <parse_type> ; colon ; tid = any-identifier ;
298
	id = <token_member_par> ( t, tid, r ) ;
299
    ||
300
	proc-cap ; tid = any-identifier ;
301
	id = <token_proc_par> ( tid, r ) ;
302
} ;
303
 
304
prog-tok-pars : ( r : LIST-ID ) -> ( p : LIST-ID ) = {
305
	a = prog-tok-param ( r ) ;
306
	{
307
		comma ; q = prog-tok-pars ( r ) ;
308
	    ||	comma ; <error_comma> ; q = <list_id_null> ;
309
	    ||	q = <list_id_null> ;
310
	} ;
311
	p = <list_id_cons> ( a, q ) ;
312
} ;
313
 
314
simple-tok-param : () -> ( id : IDENTIFIER ) = {
315
	tok = token-introduction ;
316
	t = tag-opt ;
317
	{
318
		tid = any-identifier ;
319
	    ||	tid = <id_anon> ;
320
	} ;
321
	id = <token_param> ( tok, t, tid ) ;
322
} ;
323
 
324
simple-tok-pars : () -> ( p : LIST-ID ) = {
325
	id = simple-tok-param ;
326
	{
327
		comma ; q = simple-tok-pars ;
328
	    ||	comma ; <error_comma> ; q = <list_id_null> ;
329
	    ||	q = <list_id_null> ;
330
	} ;
331
	p = <list_id_cons> ( id, q ) ;
332
} ;
333
 
334
 
335
/*
336
    TOKEN SYNTAX
337
 
338
    These rules describe the '#pragma token' syntax.
339
*/
340
 
341
<rescan_id> : () -> () ;
342
<rescan_keyword> : () -> () ;
343
<rescan_tag_line> : () -> () ;
344
<token_nat> : () -> ( :TOKEN ) ;
345
<token_snat> : () -> ( :TOKEN ) ;
346
<token_stmt> : () -> ( :TOKEN ) ;
347
<token_type> : () -> ( :TOKEN ) ;
348
<token_variety> : () -> ( :TOKEN ) ;
349
<token_signed> : () -> ( :TOKEN ) ;
350
<token_unsigned> : () -> ( :TOKEN ) ;
351
<token_float> : () -> ( :TOKEN ) ;
352
<token_arith> : () -> ( :TOKEN ) ;
353
<token_class> : () -> ( :TOKEN ) ;
354
<token_scalar> : () -> ( :TOKEN ) ;
355
<token_struct> : () -> ( :TOKEN ) ;
356
<token_union> : () -> ( :TOKEN ) ;
357
<token_exp> : ( :BOOL, :BOOL, :TYPE ) -> ( :TOKEN ) ;
358
<token_member> : ( :ACCESS, :TYPE, :TYPE ) -> ( :TOKEN ) ;
359
<token_func> : ( :TYPE ) -> ( :TOKEN ) ;
360
<token_proc_begin> : () -> ( :TOKEN ) ;
361
<token_proc_simple> : ( :TOKEN, :LIST-ID ) -> ( :TOKEN ) ;
362
<token_proc_complex> : ( :TOKEN, :LIST-ID, :LIST-ID ) -> ( :TOKEN ) ;
363
<token_proc_end> : ( :TOKEN, :TOKEN ) -> ( :TOKEN ) ;
364
<token_decl> : ( :TOKEN, :BOOL, :IDENTIFIER, :IDENTIFIER ) -> () ;
365
 
366
<is_operator> : () -> ( :BOOL ) ;
367
<parse_operator> : () -> ( :IDENTIFIER ) ;
368
 
369
<access_private> : () -> ( :ACCESS ) ;
370
<access_protected> : () -> ( :ACCESS ) ;
371
<access_public> : () -> ( :ACCESS ) ;
372
 
373
exp-storage : () -> ( b : BOOL, c : BOOL ) = {
374
	lvalue ; b = <bool_true> ; c = <bool_false> ;
375
    ||	rvalue ; b = <bool_false> ; c = <bool_false> ;
376
    ||	const ; b = <bool_false> ; c = <bool_true> ;
377
    ||	b = <bool_false> ; c = <bool_false> ;
378
} ;
379
 
380
access-specifier-opt : () -> ( a : ACCESS ) = {
381
	private ; a = <access_private> ;
382
    ||	protected ; a = <access_protected> ;
383
    ||	public ; a = <access_public> ;
384
    ||	a = <access_public> ;
385
} ;
386
 
387
token-introduction : () -> ( tok : TOKEN ) = {
388
	nat-cap ;
389
	tok = <token_nat> ;
390
    ||
391
	int-cap ;
392
	tok = <token_snat> ;
393
    ||
394
	stmt-cap ;
395
	tok = <token_stmt> ;
396
    ||
397
	type-cap ;
398
	tok = <token_type> ;
399
    ||
400
	variety-cap ;
401
	tok = <token_variety> ;
402
    ||
403
	variety-cap ; signed ;
404
	tok = <token_signed> ;
405
    ||
406
	variety-cap ; unsigned ;
407
	tok = <token_unsigned> ;
408
    ||
409
	float-cap ;
410
	tok = <token_float> ;
411
    ||
412
	arith-cap ;
413
	tok = <token_arith> ;
414
    ||
415
	class-cap ;
416
	tok = <token_class> ;
417
    ||
418
	scalar-cap ;
419
	tok = <token_scalar> ;
420
    ||
421
	struct-cap ;
422
	tok = <token_struct> ;
423
    ||
424
	union-cap ;
425
	tok = <token_union> ;
426
    ||
427
	exp-cap ; ( b, c ) = exp-storage ; colon ;
428
	t = <parse_type> ; colon ;
429
	tok = <token_exp> ( b, c, t ) ;
430
    ||
431
	member-cap ; a = access-specifier-opt ;
432
	t = <parse_mem_type> ; colon ; s = <parse_type> ; colon ;
433
	tok = <token_member> ( a, t, s ) ;
434
    ||
435
	func-cap ; t = <parse_func_type> ; colon ;
436
	tok = <token_func> ( t ) ;
437
    ||
438
	proc-cap ; open-brace ;
439
	a = <token_proc_begin> ;
440
	{
441
		p0 = bound-tok-pars ;
442
	    ||	p0 = <list_id_null> ;
443
	} ;
444
	p = p0 ;
445
	or ;
446
	{
447
		q0 = prog-tok-pars ( p ) ;
448
	    ||	q0 = <list_id_null> ;
449
	} ;
450
	q = q0 ;
451
	close-brace ;
452
	b = <token_proc_complex> ( a, p, q ) ;
453
	r = token-introduction ;
454
	tok = <token_proc_end> ( b, r ) ;
455
    ||
456
	proc-cap ; open-round ;
457
	a = <token_proc_begin> ;
458
	{
459
		p = simple-tok-pars ;
460
	    ||	p = <list_id_null> ;
461
	} ;
462
	close-round ;
463
	b = <token_proc_simple> ( a, p ) ;
464
	r = token-introduction ;
465
	tok = <token_proc_end> ( b, r ) ;
466
} ;
467
 
468
token-rule : () -> () = {
469
	token ; tok = token-introduction ;
470
	<rescan_tag_line> ;
471
	{
472
		t = tag-opt ; <rescan_id> ; a = any-identifier ;
473
	    ||
474
		? = <is_operator> ;
475
		a = <parse_operator> ; t = <bool_false> ;
476
	} ;
477
	hash ; <rescan_id> ;
478
	{
479
		b = any-identifier ;
480
	    ||	minus ; b = <id_anon> ;
481
	    ||	b = a ;
482
	} ;
483
	<token_decl> ( tok, t, a, b ) ;
484
} ;
485
 
486
 
487
/*
488
    TOKEN INTERFACE LISTS
489
 
490
    These rules are concerned with the '#pragma interface' statements.
491
*/
492
 
493
<token_name> : ( :IDENTIFIER ) -> ( :IDENTIFIER ) ;
494
<token_tag> : ( :IDENTIFIER ) -> ( :IDENTIFIER ) ;
495
<token_selector> : ( :IDENTIFIER, :IDENTIFIER ) -> ( :IDENTIFIER ) ;
496
<token_extern> : ( :IDENTIFIER ) -> ( :IDENTIFIER ) ;
497
<token_interface> : ( :IDENTIFIER, :LEX ) -> () ;
498
<interface_define> : () -> ( :LEX ) ;
499
<interface_no_def> : () -> ( :LEX ) ;
500
<interface_ignore> : () -> ( :LEX ) ;
501
<interface_crt> : () -> ( :LEX ) ;
502
<interface_undef> : () -> ( :LEX ) ;
503
 
504
token-id : () -> ( id : IDENTIFIER ) = {
505
	nm = any-identifier ;
506
	id = <token_name> ( nm ) ;
507
    ||
508
	tag-cap ; <rescan_id> ; nm = any-identifier ;
509
	id = <token_tag> ( nm ) ;
510
    ||
511
	? = <is_operator> ;
512
	nm = <parse_operator> ;
513
	id = <token_name> ( nm ) ;
514
    ||
515
	nm = token-id ; dot ; <rescan_id> ; mem = any-identifier ;
516
	id = <token_selector> ( nm, mem ) ;
517
    ||
518
	hash ; <rescan_id> ; nm = any-identifier ;
519
	id = <token_extern> ( nm ) ;
520
} ;
521
 
522
token-id-list : ( i : LEX ) -> () = {
523
	id = token-id ;
524
	<token_interface> ( id, i ) ;
525
	<rescan_tag_line> ;
526
	{
527
		token-id-list ( i ) ;
528
	    ||	$ ;
529
	} ;
530
} ;
531
 
532
interface-command : () -> ( i : LEX ) = {
533
	define ; i = <interface_define> ;
534
    ||	no-def ; i = <interface_no_def> ;
535
    ||	reject ; i = <interface_ignore> ;
536
    ||	interface ; i = <interface_crt> ;
537
    ||	undef ; token ; i = <interface_undef> ;
538
} ;
539
 
540
interface-rule : () -> () = {
541
	i = interface-command ;
542
	<rescan_tag_line> ;
543
	{
544
		token-id-list ( i ) ;
545
	    ||	$ ;
546
	} ;
547
} ;
548
 
549
 
550
/*
551
    TOKEN DEFINITION PRAGMAS
552
 
553
    These rules are concerned with those '#pragma' statements which are
554
    concerned with token definitions.
555
*/
556
 
557
<tokdef_start> : () -> () ;
558
<tokdef_end> : () -> () ;
559
<token_member_def> : ( :TYPE, :IDENTIFIER ) -> () ;
560
 
561
tokdef-rule : () -> () = {
562
	<tokdef_start> ;
563
	member ; definition ;
564
	t = <parse_type> ; colon ; id = any-identifier ;
565
	<tokdef_end> ;
566
	<token_member_def> ( t, id ) ;
567
} ;
568
 
569
 
570
/*
571
    IDENTIFIER PRAGMAS
572
 
573
    These rules are concerned with those '#pragma' statements which are
574
    concerned with special identifiers.
575
*/
576
 
577
<rescan_line> : () -> () ;
578
<rescan_allow_line> : () -> () ;
579
<rescan_as_line> : () -> () ;
580
<id_conv> : ( :IDENTIFIER ) -> () ;
581
<id_init> : ( :IDENTIFIER ) -> () ;
582
<id_postpone> : ( :IDENTIFIER, :LEX ) -> () ;
583
<id_preserve> : ( :IDENTIFIER ) -> () ;
584
<id_preserve_all> : () -> () ;
585
<id_susp> : ( :IDENTIFIER ) -> () ;
586
<lex_postpone> : () -> ( :LEX ) ;
587
<lex_unpostpone> : () -> ( :LEX ) ;
588
 
589
conversion-list : () -> () = {
590
	id = any-identifier ;
591
	<id_conv> ( id ) ;
592
	conversion-list ;
593
    ||
594
	$ ;
595
} ;
596
 
597
postpone-list : ( a : LEX ) -> () = {
598
	id = any-identifier ;
599
	<id_postpone> ( id, a ) ;
600
	postpone-list ( a ) ;
601
    ||
602
	$ ;
603
} ;
604
 
605
preserve-list : () -> () = {
606
	id = any-identifier ;
607
	<id_preserve> ( id ) ;
608
	preserve-list ;
609
    ||
610
	$ ;
611
} ;
612
 
613
suspend-list : () -> () = {
614
	id = any-identifier ;
615
	<id_susp> ( id ) ;
616
	suspend-list ;
617
    ||
618
	$ ;
619
} ;
620
 
621
identifier-rule : () -> () = {
622
	accept ; conversion ; <rescan_line> ; conversion-list ;
623
    ||
624
	conversion ; <rescan_allow_line> ; conversion-list ; allow ;
625
    ||
626
	initialization ; <rescan_id> ; id = any-identifier ; allow ;
627
	<id_init> ( id ) ;
628
    ||
629
	postpone ; <rescan_line> ;
630
	a = <lex_postpone> ; postpone-list ( a ) ;
631
    ||
632
	preserve ; <rescan_line> ; preserve-list ;
633
    ||
634
	preserve ; star ;
635
	<id_preserve_all> ;
636
    ||
637
	suspend ; static ; <rescan_line> ; suspend-list ;
638
    ||
639
	unpostpone ; <rescan_line> ;
640
	a = <lex_unpostpone> ; postpone-list ( a ) ;
641
} ;
642
 
643
 
644
/*
645
    ERROR STATES
646
 
647
    These give the various error states which may be associated with an
648
    option.
649
*/
650
 
651
<error_on> : () -> ( :STATE ) ;
652
<error_off> : () -> ( :STATE ) ;
653
<error_warning> : () -> ( :STATE ) ;
654
<opt_on> : () -> ( :NUMBER ) ;
655
<opt_off> : () -> ( :NUMBER ) ;
656
<opt_warning> : () -> ( :NUMBER ) ;
657
 
658
error-state : () -> ( e : STATE ) = {
659
	on ; e = <error_on> ;
660
    ||	off ; e = <error_off> ;
661
    ||	warning ; e = <error_warning> ;
662
} ;
663
 
664
allow-state : () -> ( e : STATE ) = {
665
	allow ; e = <error_off> ;
666
    ||	disallow ; e = <error_on> ;
667
    ||	warning ; e = <error_warning> ;
668
} ;
669
 
670
option-state : () -> ( e : STATE ) = {
671
	on ; e = <error_on> ;
672
    ||	off ; e = <error_off> ;
673
    ||	allow ; e = <error_off> ;
674
    ||	disallow ; e = <error_on> ;
675
    ||	warning ; e = <error_warning> ;
676
} ;
677
 
678
warning-opt : () -> ( e : STATE ) = {
679
	warning ; e = <error_warning> ;
680
    ||	e = <error_on> ;
681
} ;
682
 
683
error-severity : () -> ( e : NUMBER ) = {
684
	on ; e = <opt_on> ;
685
    ||	off ; e = <opt_off> ;
686
    ||	allow ; e = <opt_off> ;
687
    ||	disallow ; e = <opt_on> ;
688
    ||	warning ; e = <opt_warning> ;
689
} ;
690
 
691
 
692
/*
693
    INTEGER LITERAL PRAGMAS
694
 
695
    These rules are concerned with those '#pragma' statements which are
696
    used to specify integer literal types.
697
*/
698
 
699
<base_octal> : () -> ( :NUMBER ) ;
700
<base_decimal> : () -> ( :NUMBER ) ;
701
<base_hexadecimal> : () -> ( :NUMBER ) ;
702
<suffix_none> : () -> ( :NUMBER ) ;
703
<suffix_u> : () -> ( :NUMBER ) ;
704
<suffix_l> : () -> ( :NUMBER ) ;
705
<suffix_ul> : () -> ( :NUMBER ) ;
706
<suffix_ll> : () -> ( :NUMBER ) ;
707
<suffix_ull> : () -> ( :NUMBER ) ;
708
<literal_set> : () -> () ;
709
<literal_begin> : ( :NUMBER, :NUMBER ) -> () ;
710
<literal_type> : ( :TYPE ) -> () ;
711
<literal_token> : ( :IDENTIFIER, :STATE ) -> () ;
712
<literal_star> : ( :STATE ) -> () ;
713
<literal_infinity> : () -> () ;
714
<literal_integer> : ( :EXP ) -> () ;
715
<literal_range> : () -> () ;
716
 
717
literal-base : () -> ( b : NUMBER ) = {
718
	octal ; b = <base_octal> ;
719
    ||	decimal ; b = <base_decimal> ;
720
    ||	hexadecimal ; b = <base_hexadecimal> ;
721
} ;
722
 
723
literal-suffix : () -> ( s : NUMBER ) = {
724
	s = <suffix_none> ;
725
    ||	unsigned ; s = <suffix_u> ;
726
    ||	long ; s = <suffix_l> ;
727
    ||	unsigned ; long ; s = <suffix_ul> ;
728
    ||	long ; long ; s = <suffix_ll> ;
729
    ||	unsigned ; long ; long ; s = <suffix_ull> ;
730
} ;
731
 
732
literal-item : () -> () = {
733
	colon ; t = <parse_type> ;
734
	<literal_type> ( t ) ;
735
    ||
736
	star ; <rescan_keyword> ;
737
	{
738
		a = allow-state ;
739
	    ||	a = <error_off> ;
740
	} ;
741
	colon ; <rescan_id> ; id = any-identifier ;
742
	<literal_token> ( id, a ) ;
743
    ||
744
	star ; star ; <rescan_keyword> ;
745
	{
746
		a = allow-state ;
747
	    ||	a = <error_on> ;
748
	} ;
749
	colon ;
750
	<literal_star> ( a ) ;
751
} ;
752
 
753
literal-item-list : () -> () = {
754
	e = integer-literal ; <literal_integer> ( e ) ;
755
	literal-item ; or ; literal-item-list ;
756
    ||
757
	question ; <literal_range> ;
758
	literal-item ; or ; literal-item-list ;
759
    ||
760
	star ; <literal_infinity> ;
761
	literal-item ;
762
} ;
763
 
764
literal-rule : () -> () = {
765
	integer ; lit ;
766
	<literal_set> ;
767
	b = literal-base ; s = literal-suffix ;
768
	<literal_begin> ( b, s ) ;
769
	<rescan_line> ;
770
	literal-item-list ;
771
} ;
772
 
773
 
774
/*
775
    KEYWORD PRAGMAS
776
 
777
    These rules are concerned with those '#pragma' statements which are
778
    used to introduce new keywords.
779
*/
780
 
781
<lex_asm> : () -> ( :LEX ) ;
782
<lex_discard> : () -> ( :LEX ) ;
783
<lex_exhaustive> : () -> ( :LEX ) ;
784
<lex_fall> : () -> ( :LEX ) ;
785
<lex_inline> : () -> ( :LEX ) ;
786
<lex_reachable> : () -> ( :LEX ) ;
787
<lex_representation> : () -> ( :LEX ) ;
788
<lex_set> : () -> ( :LEX ) ;
789
<lex_unreachable> : () -> ( :LEX ) ;
790
<lex_unused> : () -> ( :LEX ) ;
791
<lex_weak> : () -> ( :LEX ) ;
792
<lex_symbol> : () -> ( :LEX ) ;
793
<keyword_spec> : ( :IDENTIFIER ) -> ( :LEX ) ;
794
<keyword_define> : ( :IDENTIFIER, :LEX ) -> () ;
795
<keyword_undef> : ( :IDENTIFIER ) -> () ;
796
 
797
keyword-id : () -> ( id : IDENTIFIER ) = {
798
	keyword ; <rescan_id> ; id = any-identifier ;
799
} ;
800
 
801
keyword-spec : () -> ( t : LEX ) = {
802
	asm ; t = <lex_asm> ;
803
    ||	discard ; value ; t = <lex_discard> ;
804
    ||	discard ; variable ; t = <lex_unused> ;
805
    ||	exhaustive ; t = <lex_exhaustive> ;
806
    ||	fall ; into ; case ; t = <lex_fall> ;
807
    ||	inline ; t = <lex_inline> ;
808
    ||	set ; t = <lex_set> ;
809
    ||	set ; reachable ; t = <lex_reachable> ;
810
    ||	set ; unreachable ; t = <lex_unreachable> ;
811
    ||	type ; representation ; t = <lex_representation> ;
812
    ||	weak ; t = <lex_weak> ;
813
    ||	id = keyword-id ; t = <keyword_spec> ( id ) ;
814
    ||	operator ; t = <lex_symbol> ; plus ;
815
} ;
816
 
817
keyword-rule : () -> () = {
818
	id = keyword-id ; for ; t = keyword-spec ;
819
	<keyword_define> ( id, t ) ;
820
    ||
821
	undef ; id = keyword-id ;
822
	<keyword_undef> ( id ) ;
823
} ;
824
 
825
 
826
/*
827
    TYPE PRAGMAS
828
 
829
    These rules are concerned with those '#pragma' statements which are
830
    used to introduce special types.
831
*/
832
 
833
<type_argument> : ( :TYPE, :TYPE ) -> () ;
834
<type_ellipsis> : ( :TYPE ) -> () ;
835
<type_char_sign> : ( :BTYPE ) -> () ;
836
<type_char_lit> : ( :TYPE ) -> () ;
837
<type_long_long> : ( :BOOL ) -> () ;
838
<type_string_lit> : ( :CV ) -> () ;
839
<type_compatible> : ( :TYPE, :TYPE, :STATE ) -> () ;
840
<type_compute> : ( :IDENTIFIER ) -> () ;
841
<type_promote> : ( :TYPE, :TYPE ) -> () ;
842
<type_builtin> : ( :BTYPE, :TYPE ) -> () ;
843
<type_special> : ( :IDENTIFIER, :TYPE ) -> () ;
844
<type_bottom> : () -> ( :TYPE ) ;
845
<type_printf> : () -> ( :TYPE ) ;
846
<type_scanf> : () -> ( :TYPE ) ;
847
<type_wprintf> : () -> ( :TYPE ) ;
848
<type_wscanf> : () -> ( :TYPE ) ;
849
<type_ptrdiff_t> : () -> ( :TYPE ) ;
850
<type_size_t> : () -> ( :TYPE ) ;
851
<type_wchar_t> : () -> ( :TYPE ) ;
852
<nspace_std> : ( :IDENTIFIER ) -> () ;
853
 
854
<id_none> : () -> ( :IDENTIFIER ) ;
855
<declarator_start> : () -> () ;
856
 
857
<btype_none> : () -> ( :BTYPE ) ;
858
<btype_signed> : () -> ( :BTYPE ) ;
859
<btype_unsigned> : () -> ( :BTYPE ) ;
860
<btype_ptrdiff_t> : () -> ( :BTYPE ) ;
861
<btype_size_t> : () -> ( :BTYPE ) ;
862
<btype_wchar_t> : () -> ( :BTYPE ) ;
863
 
864
<cv_none> : () -> ( :CV ) ;
865
<cv_const> : () -> ( :CV ) ;
866
 
867
type-spec : () -> () = {
868
	argument ; <rescan_as_line> ;
869
	t = <parse_type> ; as ; s = <parse_type> ;
870
	<type_argument> ( t, s ) ;
871
    ||
872
	argument ; <rescan_as_line> ;
873
	t = <parse_type> ; as ; ellipsis-aux ;
874
	<type_ellipsis> ( t ) ;
875
    ||
876
	bottom ; <rescan_id> ;
877
	<declarator_start> ;
878
	id = any-identifier ;
879
	t = <type_bottom> ;
880
	<type_special> ( id, t ) ;
881
    ||
882
	character ;
883
	{
884
		signed ; bt = <btype_signed> ;
885
	    ||	unsigned ; bt = <btype_unsigned> ;
886
	    ||	either ; bt = <btype_none> ;
887
	} ;
888
	<type_char_sign> ( bt ) ;
889
    ||
890
	compatible ; type ; colon ; <rescan_line> ;
891
	t = <parse_type> ; eq ; s = <parse_type> ; colon ;
892
	<rescan_keyword> ; e = allow-state ;
893
	<type_compatible> ( t, s, e ) ;
894
    ||
895
	compute ; promote ; <rescan_id> ;
896
	id = any-identifier ;
897
	<type_compute> ( id ) ;
898
    ||
899
	promoted ; <rescan_line> ;
900
	t = <parse_type> ; colon ; s = <parse_type> ;
901
	<type_promote> ( t, s ) ;
902
    ||
903
	set ;
904
	{
905
		ptrdiff-t ; bt = <btype_ptrdiff_t> ;
906
	    ||	size-t ; bt = <btype_size_t> ;
907
	    ||	wchar-t ; bt = <btype_wchar_t> ;
908
	} ;
909
	colon ; <rescan_line> ; t = <parse_type> ;
910
	<type_builtin> ( bt, t ) ;
911
    ||
912
	set ; character ; lit ;
913
	colon ; <rescan_line> ; t = <parse_type> ;
914
	<type_char_lit> ( t ) ;
915
    ||
916
	set ; longlong ; type ; colon ; long ;
917
	{
918
		long ; b = <bool_true> ;
919
	    ||	b = <bool_false> ;
920
	} ;
921
	<type_long_long> ( b ) ;
922
    ||
923
	set ; string ; lit ; colon ;
924
	{
925
		cv = <cv_const> ;
926
	    ||	no ; cv = <cv_none> ;
927
	} ;
928
	const ;
929
	<type_string_lit> ( cv ) ;
930
    ||
931
	set ; std ; namespace ; colon ; <rescan_id> ;
932
	{
933
		id = any-identifier ;
934
	    ||	colon-colon ; id = <id_none> ;
935
	} ;
936
	<nspace_std> ( id ) ;
937
    ||
938
	type ; <rescan_id> ;
939
	<declarator_start> ;
940
	id = any-identifier ; for ;
941
	{
942
		bottom ; t = <type_bottom> ;
943
	    ||	ellipsis-aux ; printf ; t = <type_printf> ;
944
	    ||	ellipsis-aux ; scanf ; t = <type_scanf> ;
945
	    ||	ellipsis-aux ; wchar-t ; printf ; t = <type_wprintf> ;
946
	    ||	ellipsis-aux ; wchar-t ; scanf ; t = <type_wscanf> ;
947
	    ||	ptrdiff-t ; t = <type_ptrdiff_t> ;
948
	    ||	size-t ; t = <type_size_t> ;
949
	    ||	wchar-t ; t = <type_wchar_t> ;
950
	} ;
951
	<type_special> ( id, t ) ;
952
} ;
953
 
954
 
955
/*
956
    OPTION DECLARATIONS
957
 
958
    Each option is associated with a numerical value.  These actions
959
    gives this mapping.
960
*/
961
 
962
<opt_bitf_overflow> : () -> ( :NUMBER ) ;
963
<opt_bitf_type> : () -> ( :NUMBER ) ;
964
<opt_bool_assign> : () -> ( :NUMBER ) ;
965
<opt_case_fall> : () -> ( :NUMBER ) ;
966
<opt_cast_explicit> : () -> ( :NUMBER ) ;
967
<opt_comma_extra> : () -> ( :NUMBER ) ;
968
<opt_complete_struct> : () -> ( :NUMBER ) ;
969
<opt_concat_string> : () -> ( :NUMBER ) ;
970
<opt_cond_lvalue> : () -> ( :NUMBER ) ;
971
<opt_const_cond> : () -> ( :NUMBER ) ;
972
<opt_const_internal> : () -> ( :NUMBER ) ;
973
<opt_const_string> : () -> ( :NUMBER ) ;
974
<opt_conv> : () -> ( :NUMBER ) ;
975
<opt_conv_int_enum> : () -> ( :NUMBER ) ;
976
<opt_conv_int_int> : () -> ( :NUMBER ) ;
977
<opt_conv_int_int_expl> : () -> ( :NUMBER ) ;
978
<opt_conv_int_int_impl> : () -> ( :NUMBER ) ;
979
<opt_conv_int_ptr> : () -> ( :NUMBER ) ;
980
<opt_conv_int_ptr_expl> : () -> ( :NUMBER ) ;
981
<opt_conv_int_ptr_impl> : () -> ( :NUMBER ) ;
982
<opt_conv_ptr_func> : () -> ( :NUMBER ) ;
983
<opt_conv_ptr_ptr> : () -> ( :NUMBER ) ;
984
<opt_conv_ptr_ptr_expl> : () -> ( :NUMBER ) ;
985
<opt_conv_ptr_ptr_impl> : () -> ( :NUMBER ) ;
986
<opt_conv_ptr_ptr_void> : () -> ( :NUMBER ) ;
987
<opt_conv_ptr_void_ptr> : () -> ( :NUMBER ) ;
988
<opt_decl_cond> : () -> ( :NUMBER ) ;
989
<opt_decl_hide> : () -> ( :NUMBER ) ;
990
<opt_decl_none> : () -> ( :NUMBER ) ;
991
<opt_decl_struct_anon> : () -> ( :NUMBER ) ;
992
<opt_decl_unify> : () -> ( :NUMBER ) ;
993
<opt_decl_volatile> : () -> ( :NUMBER ) ;
994
<opt_discard> : () -> ( :NUMBER ) ;
995
<opt_discard_func> : () -> ( :NUMBER ) ;
996
<opt_discard_static> : () -> ( :NUMBER ) ;
997
<opt_discard_value> : () -> ( :NUMBER ) ;
998
<opt_dollar_ident> : () -> ( :NUMBER ) ;
999
<opt_dspec_none> : () -> ( :NUMBER ) ;
1000
<opt_dspec_none_func> : () -> ( :NUMBER ) ;
1001
<opt_ellipsis_extra> : () -> ( :NUMBER ) ;
1002
<opt_ellipsis_ident> : () -> ( :NUMBER ) ;
1003
<opt_empty_body> : () -> ( :NUMBER ) ;
1004
<opt_enum_decl> : () -> ( :NUMBER ) ;
1005
<opt_enum_switch> : () -> ( :NUMBER ) ;
1006
<opt_eof_nline> : () -> ( :NUMBER ) ;
1007
<opt_escape_overflow> : () -> ( :NUMBER ) ;
1008
<opt_escape_unknown> : () -> ( :NUMBER ) ;
1009
<opt_for_scope> : () -> ( :NUMBER ) ;
1010
<opt_func_block> : () -> ( :NUMBER ) ;
1011
<opt_func_impl> : () -> ( :NUMBER ) ;
1012
<opt_func_incompat> : () -> ( :NUMBER ) ;
1013
<opt_func_linkage> : () -> ( :NUMBER ) ;
1014
<opt_func_proto> : () -> ( :NUMBER ) ;
1015
<opt_func_ret_void> : () -> ( :NUMBER ) ;
1016
<opt_func_token_undef> : () -> ( :NUMBER ) ;
1017
<opt_func_weak> : () -> ( :NUMBER ) ;
1018
<opt_hash_ident> : () -> ( :NUMBER ) ;
1019
<opt_include_full> : () -> ( :NUMBER ) ;
1020
<opt_infer_int> : () -> ( :NUMBER ) ;
1021
<opt_infer_int_cv> : () -> ( :NUMBER ) ;
1022
<opt_init_aggregate> : () -> ( :NUMBER ) ;
1023
<opt_init_dynamic> : () -> ( :NUMBER ) ;
1024
<opt_init_struct> : () -> ( :NUMBER ) ;
1025
<opt_inline_internal> : () -> ( :NUMBER ) ;
1026
<opt_interf_incompat> : () -> ( :NUMBER ) ;
1027
<opt_int_operator> : () -> ( :NUMBER ) ;
1028
<opt_int_overflow> : () -> ( :NUMBER ) ;
1029
<opt_link_incompat> : () -> ( :NUMBER ) ;
1030
<opt_link_internal> : () -> ( :NUMBER ) ;
1031
<opt_link_resolve> : () -> ( :NUMBER ) ;
1032
<opt_longlong> : () -> ( :NUMBER ) ;
1033
<opt_macro_arg_dir> : () -> ( :NUMBER ) ;
1034
<opt_macro_redef> : () -> ( :NUMBER ) ;
1035
<opt_macro_weak> : () -> ( :NUMBER ) ;
1036
<opt_member_incompat> : () -> ( :NUMBER ) ;
1037
<opt_name_limit> : () -> ( :NUMBER ) ;
1038
<opt_nest_comment> : () -> ( :NUMBER ) ;
1039
<opt_overload_ambig> : () -> ( :NUMBER ) ;
1040
<opt_overload_dep> : () -> ( :NUMBER ) ;
1041
<opt_overload_res> : () -> ( :NUMBER ) ;
1042
<opt_overload_strict> : () -> ( :NUMBER ) ;
1043
<opt_param_impl> : () -> ( :NUMBER ) ;
1044
<opt_paren> : () -> ( :NUMBER ) ;
1045
<opt_ppdir_assert> : () -> ( :NUMBER, :NUMBER ) ;
1046
<opt_ppdir_file> : () -> ( :NUMBER, :NUMBER ) ;
1047
<opt_ppdir_id> : () -> ( :NUMBER ) ;
1048
<opt_ppdir_ident> : () -> ( :NUMBER, :NUMBER ) ;
1049
<opt_ppdir_import> : () -> ( :NUMBER, :NUMBER ) ;
1050
<opt_ppdir_indent> : () -> ( :NUMBER ) ;
1051
<opt_ppdir_indent_dir> : () -> ( :NUMBER ) ;
1052
<opt_ppdir_text> : () -> ( :NUMBER ) ;
1053
<opt_ppdir_unassert> : () -> ( :NUMBER, :NUMBER ) ;
1054
<opt_ppdir_unknown> : () -> ( :NUMBER ) ;
1055
<opt_ppdir_warning> : () -> ( :NUMBER, :NUMBER ) ;
1056
<opt_ppdir_weak> : () -> ( :NUMBER, :NUMBER ) ;
1057
<opt_pragma_unknown> : () -> ( :NUMBER ) ;
1058
<opt_ptr_operator> : () -> ( :NUMBER ) ;
1059
<opt_reached> : () -> ( :NUMBER ) ;
1060
<opt_semicolon_extra> : () -> ( :NUMBER ) ;
1061
<opt_templ_export> : () -> ( :NUMBER ) ;
1062
<opt_this_lvalue> : () -> ( :NUMBER ) ;
1063
<opt_throw_bad> : () -> ( :NUMBER ) ;
1064
<opt_token_const> : () -> ( :NUMBER ) ;
1065
<opt_token_redef> : () -> ( :NUMBER ) ;
1066
<opt_token_undef> : () -> ( :NUMBER ) ;
1067
<opt_type_obj_incompl> : () -> ( :NUMBER ) ;
1068
<opt_type_qual_incompat> : () -> ( :NUMBER ) ;
1069
<opt_type_redef> : () -> ( :NUMBER ) ;
1070
<opt_type_tag_ignore> : () -> ( :NUMBER ) ;
1071
<opt_unmatched> : () -> ( :NUMBER ) ;
1072
<opt_variable> : () -> ( :NUMBER ) ;
1073
<opt_wall> : () -> ( :NUMBER ) ;
1074
<opt_weak> : () -> ( :NUMBER ) ;
1075
 
1076
<opt_val_cast_explicit> : () -> ( :NUMBER ) ;
1077
<opt_val_include_depth> : () -> ( :NUMBER ) ;
1078
<opt_val_maximum_error> : () -> ( :NUMBER ) ;
1079
<opt_val_name_limit> : () -> ( :NUMBER ) ;
1080
 
1081
 
1082
/*
1083
    ANALYSIS PRAGMAS
1084
 
1085
    These rules are concerned with those '#pragma' statements which are
1086
    used to set analysis options.
1087
*/
1088
 
1089
conversion-spec : () -> ( n : NUMBER ) = {
1090
	n = <opt_conv> ;
1091
    ||
1092
	open-round ; int ; minus ; int ; close-round ;
1093
	n = <opt_conv_int_int> ;
1094
    ||
1095
	open-round ; int ; minus ; int ; explicit ; close-round ;
1096
	n = <opt_conv_int_int_expl> ;
1097
    ||
1098
	open-round ; int ; minus ; int ; implicit ; close-round ;
1099
	n = <opt_conv_int_int_impl> ;
1100
    ||
1101
	open-round ; int ; minus ; enum ; implicit ; close-round ;
1102
	n = <opt_conv_int_enum> ;
1103
    ||
1104
	open-round ; int ; minus ; pointer ; close-round ;
1105
	n = <opt_conv_int_ptr> ;
1106
    ||
1107
	open-round ; int ; minus ; pointer ; explicit ; close-round ;
1108
	n = <opt_conv_int_ptr_expl> ;
1109
    ||
1110
	open-round ; int ; minus ; pointer ; implicit ; close-round ;
1111
	n = <opt_conv_int_ptr_impl> ;
1112
    ||
1113
	open-round ; pointer ; minus ; int ; close-round ;
1114
	n = <opt_conv_int_ptr> ;
1115
    ||
1116
	open-round ; pointer ; minus ; int ; explicit ; close-round ;
1117
	n = <opt_conv_int_ptr_expl> ;
1118
    ||
1119
	open-round ; pointer ; minus ; int ; implicit ; close-round ;
1120
	n = <opt_conv_int_ptr_impl> ;
1121
    ||
1122
	open-round ; pointer ; minus ; pointer ; close-round ;
1123
	n = <opt_conv_ptr_ptr> ;
1124
    ||
1125
	open-round ; pointer ; minus ; pointer ; explicit ; close-round ;
1126
	n = <opt_conv_ptr_ptr_expl> ;
1127
    ||
1128
	open-round ; pointer ; minus ; pointer ; implicit ; close-round ;
1129
	n = <opt_conv_ptr_ptr_impl> ;
1130
    ||
1131
	open-round ; void ; star ; minus ; pointer ; implicit ; close-round ;
1132
	n = <opt_conv_ptr_void_ptr> ;
1133
    ||
1134
	open-round ; pointer ; minus ; void ; star ; implicit ; close-round ;
1135
	n = <opt_conv_ptr_ptr_void> ;
1136
} ;
1137
 
1138
discard-spec : () -> ( n : NUMBER ) = {
1139
	n = <opt_discard> ;
1140
    ||
1141
	open-round ; function ; return ; close-round ;
1142
	n = <opt_discard_func> ;
1143
    ||
1144
	open-round ; static ; close-round ;
1145
	n = <opt_discard_static> ;
1146
    ||
1147
	open-round ; value ; close-round ;
1148
	n = <opt_discard_value> ;
1149
} ;
1150
 
1151
analysis-spec : () -> ( n : NUMBER ) = {
1152
	complete ; initialization ; analysis ;
1153
	n = <opt_init_aggregate> ;
1154
    ||
1155
	complete ; struct ; div ; union ; analysis ;
1156
	n = <opt_complete_struct> ;
1157
    ||
1158
	conversion ; analysis ;
1159
	n = conversion-spec ;
1160
    ||
1161
	discard ; analysis ;
1162
	n = discard-spec ;
1163
    ||
1164
	enum ; switch ; analysis ;
1165
	n = <opt_enum_switch> ;
1166
    ||
1167
	external ; function ; linkage ;
1168
	n = <opt_func_linkage> ;
1169
    ||
1170
	for ; initialization ; block ;
1171
	n = <opt_for_scope> ;
1172
    ||
1173
	ignore ; struct ; div ; union ; div ; enum ; tag ;
1174
	n = <opt_type_tag_ignore> ;
1175
    ||
1176
	implicit ; export ; template ;
1177
	n = <opt_templ_export> ;
1178
    ||
1179
	implicit ; function ; decl ;
1180
	n = <opt_func_impl> ;
1181
    ||
1182
	integer ; operator ; analysis ;
1183
	n = <opt_int_operator> ;
1184
    ||
1185
	integer ; overflow ; analysis ;
1186
	n = <opt_int_overflow> ;
1187
    ||
1188
	nested ; comment ; analysis ;
1189
	n = <opt_nest_comment> ;
1190
    ||
1191
	operator ; precedence ; analysis ;
1192
	n = <opt_paren> ;
1193
    ||
1194
	pointer ; operator ; analysis ;
1195
	n = <opt_ptr_operator> ;
1196
    ||
1197
	throw ; analysis ;
1198
	n = <opt_throw_bad> ;
1199
    ||
1200
	unify ; external ; linkage ;
1201
	n = <opt_decl_unify> ;
1202
    ||
1203
	variable ; analysis ;
1204
	n = <opt_variable> ;
1205
    ||
1206
	variable ; hiding ; analysis ;
1207
	n = <opt_decl_hide> ;
1208
    ||
1209
	weak ; prototype ; analysis ;
1210
	n = <opt_weak> ;
1211
} ;
1212
 
1213
 
1214
/*
1215
    IMPLICIT INT PRAGMAS
1216
 
1217
    This rule is concerned with those '#pragma' statements which are
1218
    used to set the treatment of implicit integral types.
1219
*/
1220
 
1221
implicit-spec : () -> ( n : NUMBER ) = {
1222
	for ; external ; decl ;
1223
	n = <opt_dspec_none> ;
1224
    ||
1225
	for ; function ; argument ;
1226
	n = <opt_param_impl> ;
1227
    ||
1228
	for ; function ; return ;
1229
	n = <opt_dspec_none_func> ;
1230
    ||
1231
	for ; const ; div ; volatile ;
1232
	n = <opt_infer_int_cv> ;
1233
    ||
1234
	n = <opt_infer_int> ;
1235
} ;
1236
 
1237
 
1238
/*
1239
    CHECKING PRAGMAS
1240
 
1241
    These rules are concerned with those '#pragma' statements which are
1242
    used to set checking options.
1243
*/
1244
 
1245
check-spec : () -> ( n : NUMBER ) = {
1246
	ambiguous ; overload ; resolution ;
1247
	n = <opt_overload_ambig> ;
1248
    ||
1249
	assignment ; as ; bool ;
1250
	n = <opt_bool_assign> ;
1251
    ||
1252
	bitfield ; overflow ;
1253
	n = <opt_bitf_overflow> ;
1254
    ||
1255
	block ; function ; static ;
1256
	n = <opt_func_block> ;
1257
    ||
1258
	catch ; all ;
1259
	n = <opt_wall> ;
1260
    ||
1261
	character ; escape ; overflow ;
1262
	n = <opt_escape_overflow> ;
1263
    ||
1264
	compatible ; token ;
1265
	n = <opt_token_redef> ;
1266
    ||
1267
	complete ; file ; includes ;
1268
	n = <opt_include_full> ;
1269
    ||
1270
	conditional ; decl ;
1271
	n = <opt_decl_cond> ;
1272
    ||
1273
	conditional ; lvalue ;
1274
	n = <opt_cond_lvalue> ;
1275
    ||
1276
	const ; conditional ;
1277
	n = <opt_const_cond> ;
1278
    ||
1279
	directive ; as ; macro ; argument ;
1280
	n = <opt_macro_arg_dir> ;
1281
    ||
1282
	dollar ; as ; ident ;
1283
	n = <opt_dollar_ident> ;
1284
    ||
1285
	extra ; comma ;
1286
	n = <opt_comma_extra> ;
1287
    ||
1288
	extra ; ellipsis-aux ;
1289
	n = <opt_ellipsis_extra> ;
1290
    ||
1291
	extra ; semicolon ;
1292
	n = <opt_semicolon_extra> ;
1293
    ||
1294
	extra ; semicolon ; after ; conditional ;
1295
	n = <opt_empty_body> ;
1296
    ||
1297
	extra ; bitfield ; int ; type ;
1298
	n = <opt_bitf_type> ;
1299
    ||
1300
	extra ; macro ; definition ;
1301
	n = <opt_macro_redef> ;
1302
    ||
1303
	extra ; type ; definition ;
1304
	n = <opt_type_redef> ;
1305
    ||
1306
	fall ; into ; case ;
1307
	n = <opt_case_fall> ;
1308
    ||
1309
	forward ; enum ; decl ;
1310
	n = <opt_enum_decl> ;
1311
    ||
1312
	function ; pointer ; as ; pointer ;
1313
	n = <opt_conv_ptr_func> ;
1314
    ||
1315
	ident ; ellipsis-aux ;
1316
	n = <opt_ellipsis_ident> ;
1317
    ||
1318
	ident ; as ; ellipsis-aux ;
1319
	n = <opt_ellipsis_ident> ;
1320
    ||
1321
	implicit ; int ; type ;
1322
	n = implicit-spec ;
1323
    ||
1324
	implicit ; token ; definition ;
1325
	n = <opt_func_token_undef> ;
1326
    ||
1327
	incompatible ; interface ; decl ;
1328
	n = <opt_interf_incompat> ;
1329
    ||
1330
	incompatible ; linkage ;
1331
	n = <opt_link_incompat> ;
1332
    ||
1333
	incompatible ; member ; decl ;
1334
	n = <opt_member_incompat> ;
1335
    ||
1336
	incompatible ; promoted ; function ; argument ;
1337
	n = <opt_func_incompat> ;
1338
    ||
1339
	incompatible ; type ; qualifier ;
1340
	n = <opt_type_qual_incompat> ;
1341
    ||
1342
	incompatible ; void ; return ;
1343
	n = <opt_func_ret_void> ;
1344
    ||
1345
	incomplete ; type ; as ; object ; type ;
1346
	n = <opt_type_obj_incompl> ;
1347
    ||
1348
	indented ; hash ; directive ;
1349
	n = <opt_ppdir_indent> ;
1350
    ||
1351
	indented ; directive ; after ; hash ;
1352
	n = <opt_ppdir_indent_dir> ;
1353
    ||
1354
	initialization ; of ; struct ; div ; union ;
1355
	open-round ; auto ; close-round ;
1356
	n = <opt_init_struct> ;
1357
    ||
1358
	longlong ; type ;
1359
	n = <opt_longlong> ;
1360
    ||
1361
	no ; directive ; div ; nline ; after ; ident ;
1362
	n = <opt_ppdir_id> ;
1363
    ||
1364
	no ; external ; decl ;
1365
	n = <opt_decl_none> ;
1366
    ||
1367
	no ; ident ; after ; hash ;
1368
	n = <opt_hash_ident> ;
1369
    ||
1370
	no ; nline ; after ; file ; end ;
1371
	n = <opt_eof_nline> ;
1372
    ||
1373
	no ; token ; definition ;
1374
	n = <opt_token_undef> ;
1375
    ||
1376
	overload ; resolution ;
1377
	n = <opt_overload_res> ;
1378
    ||
1379
	prototype ;
1380
	n = <opt_func_proto> ;
1381
    ||
1382
	prototype ; open-round ; weak ; close-round ;
1383
	n = <opt_func_weak> ;
1384
    ||
1385
	rvalue ; token ; as ; const ;
1386
	n = <opt_token_const> ;
1387
    ||
1388
	text ; after ; directive ;
1389
	n = <opt_ppdir_text> ;
1390
    ||
1391
	this ; lvalue ;
1392
	n = <opt_this_lvalue> ;
1393
    ||
1394
	unify ; incompatible ; string ; lit ;
1395
	n = <opt_concat_string> ;
1396
    ||
1397
	un-known ; directive ;
1398
	n = <opt_ppdir_unknown> ;
1399
    ||
1400
	un-known ; escape ;
1401
	n = <opt_escape_unknown> ;
1402
    ||
1403
	un-known ; pragma ;
1404
	n = <opt_pragma_unknown> ;
1405
    ||
1406
	un-known ; struct ; div ; union ;
1407
	n = <opt_decl_struct_anon> ;
1408
    ||
1409
	unmatched ; quote ;
1410
	n = <opt_unmatched> ;
1411
    ||
1412
	unreachable ; code ;
1413
	n = <opt_reached> ;
1414
    ||
1415
	variable ; initialization ;
1416
	n = <opt_init_dynamic> ;
1417
    ||
1418
	weak ; macro ; equality ;
1419
	n = <opt_macro_weak> ;
1420
    ||
1421
	writeable ; string ; lit ;
1422
	n = <opt_const_string> ;
1423
} ;
1424
 
1425
 
1426
/*
1427
    DIRECTIVE PRAGMAS
1428
 
1429
    These rules are concerned with those '#pragma' statements which are
1430
    used to switch preprocessing directives on and off.
1431
*/
1432
 
1433
directive-spec : () -> ( n : NUMBER, m : NUMBER ) = {
1434
	assert ; ( n, m ) = <opt_ppdir_assert> ;
1435
    ||	file ; ( n, m ) = <opt_ppdir_file> ;
1436
    ||	ident ; ( n, m ) = <opt_ppdir_ident> ;
1437
    ||	import ; ( n, m ) = <opt_ppdir_import> ;
1438
    ||	include-next ; ( n, m ) = <opt_ppdir_import> ;
1439
    ||	unassert ; ( n, m ) = <opt_ppdir_unassert> ;
1440
    ||	warning ; ( n, m ) = <opt_ppdir_warning> ;
1441
    ||	weak ; ( n, m ) = <opt_ppdir_weak> ;
1442
} ;
1443
 
1444
directive-state : () -> ( e : STATE, i : STATE ) = {
1445
	disallow ;
1446
	e = <error_on> ;
1447
	i = <error_on> ;
1448
    ||
1449
	{
1450
		open-round ; ignore ; close-round ; a = <error_on> ;
1451
	    ||	a = <error_off> ;
1452
	} ;
1453
	{
1454
		allow ; b = <error_off> ;
1455
	    ||	warning ; b = <error_warning> ;
1456
	} ;
1457
	e = b ;
1458
	i = a ;
1459
} ;
1460
 
1461
 
1462
/*
1463
    LINKAGE PRAGMAS
1464
 
1465
    This rule is concerned with the '#pragma' statement used to determine
1466
    the linkage resolution to be used.
1467
*/
1468
 
1469
linkage-descr : () -> ( i : STATE ) = {
1470
	internal ; i = <error_on> ;
1471
    ||	external ; i = <error_off> ;
1472
} ;
1473
 
1474
linkage-state : () -> ( e : STATE, i : STATE ) = {
1475
	off ;
1476
	e = <error_off> ;
1477
	i = <error_off> ;
1478
    ||
1479
	open-round ;
1480
	i = linkage-descr ;
1481
	close-round ;
1482
	{
1483
		on ; b = <error_off> ;
1484
	    ||	warning ; b = <error_warning> ;
1485
	} ;
1486
	e = b ;
1487
} ;
1488
 
1489
 
1490
/*
1491
    COMPLETE STATE PRAGMAS
1492
 
1493
    This rule is concerned with those '#pragma' statements which give
1494
    the option between complete and incomplete analysis.
1495
*/
1496
 
1497
complete-state : () -> ( i : STATE ) = {
1498
	i = <error_on> ;
1499
    ||	open-round ; complete ; close-round ; i = <error_on> ;
1500
    ||	open-round ; incomplete ; close-round ; i = <error_off> ;
1501
} ;
1502
 
1503
 
1504
/*
1505
    EXPLICIT CAST PRAGMAS
1506
 
1507
    These rules gives the various interpretations of explicit cast
1508
    expressions.
1509
*/
1510
 
1511
<cast_static> : () -> ( :VALUE ) ;
1512
<cast_reinterp> : () -> ( :VALUE ) ;
1513
<cast_const> : () -> ( :VALUE ) ;
1514
<cast_explicit> : () -> ( :VALUE ) ;
1515
<cast_join> : ( :VALUE, :VALUE ) -> ( :VALUE ) ;
1516
 
1517
cast-command : () -> ( c : VALUE ) = {
1518
	static-cast ; c = <cast_static> ;
1519
    ||	reinterpret-cast ; c = <cast_reinterp> ;
1520
    ||	const-cast ; c = <cast_const> ;
1521
} ;
1522
 
1523
cast-state : () -> ( c : VALUE ) = {
1524
	c = cast-command ;
1525
    ||
1526
	a = cast-command ; or ; b = cast-state ;
1527
	c = <cast_join> ( a, b ) ;
1528
} ;
1529
 
1530
 
1531
/*
1532
    OPTION PRAGMAS
1533
 
1534
    These rules are concerned with those '#pragma' statements which are
1535
    used to set option values.
1536
*/
1537
 
1538
<option_number> : ( :EXP ) -> ( :NUMBER ) ;
1539
<linkage_string> : ( :EXP ) -> ( :LINKAGE ) ;
1540
<analysis_exp> : ( :NUMBER, :EXP ) -> () ;
1541
<analysis_state> : ( :NUMBER, :STATE ) -> () ;
1542
<analysis_value> : ( :NUMBER, :VALUE ) -> () ;
1543
<analysis_linkage> : ( :LINKAGE ) -> () ;
1544
 
1545
option-number : () -> ( n : NUMBER ) = {
1546
	option ; s = string-literal ;
1547
	n = <option_number> ( s ) ;
1548
} ;
1549
 
1550
option-rule : () -> () = {
1551
	n = option-number ; e = option-state ;
1552
	<analysis_state> ( n, e ) ;
1553
    ||
1554
	n = analysis-spec ; e = error-state ;
1555
	<analysis_state> ( n, e ) ;
1556
    ||
1557
	n = check-spec ; e = allow-state ;
1558
	<analysis_state> ( n, e ) ;
1559
    ||
1560
	conditional ; overload ; resolution ;
1561
	i = complete-state ; e = allow-state ;
1562
	n = <opt_overload_dep> ;
1563
	m = <opt_overload_strict> ;
1564
	<analysis_state> ( n, e ) ;
1565
	<analysis_state> ( m, i ) ;
1566
    ||
1567
	directive ; ( n, m ) = directive-spec ; ( e, i ) = directive-state ;
1568
	<analysis_state> ( n, e ) ;
1569
	<analysis_state> ( m, i ) ;
1570
    ||
1571
	explicit ; cast ;
1572
	{
1573
		as ; c = cast-state ;
1574
	    ||	c = <cast_explicit> ;
1575
	} ;
1576
	e = allow-state ;
1577
	n = <opt_cast_explicit> ;
1578
	m = <opt_val_cast_explicit> ;
1579
	<analysis_state> ( n, e ) ;
1580
	<analysis_value> ( m, c ) ;
1581
    ||
1582
	set ; name ; limit ;
1583
	e = integer-literal ;
1584
	i = warning-opt ;
1585
	n = <opt_val_name_limit> ;
1586
	m = <opt_name_limit> ;
1587
	<analysis_exp> ( n, e ) ;
1588
	<analysis_state> ( m, i ) ;
1589
    ||
1590
	linkage ; resolution ; colon ; ( e, i ) = linkage-state ;
1591
	n = <opt_link_resolve> ;
1592
	m = <opt_link_internal> ;
1593
	<analysis_state> ( n, e ) ;
1594
	<analysis_state> ( m, i ) ;
1595
    ||
1596
	external ; linkage ; e = string-literal ;
1597
	a = <linkage_string> ( e ) ;
1598
	<analysis_linkage> ( a ) ;
1599
    ||
1600
	external ;
1601
	{
1602
		volatile ;
1603
	    ||	volatile-t ;
1604
	} ;
1605
	n = <opt_decl_volatile> ;
1606
	e = <error_on> ;
1607
	<analysis_state> ( n, e ) ;
1608
    ||
1609
	inline ; linkage ; e = linkage-descr ;
1610
	n = <opt_inline_internal> ;
1611
	<analysis_state> ( n, e ) ;
1612
    ||
1613
	const ; linkage ; e = linkage-descr ;
1614
	n = <opt_const_internal> ;
1615
	<analysis_state> ( n, e ) ;
1616
    ||
1617
	accept ; ellipsis-aux ; identif ;
1618
	n = <opt_ellipsis_ident> ;
1619
	e = <error_off> ;
1620
	<analysis_state> ( n, e ) ;
1621
} ;
1622
 
1623
 
1624
/*
1625
    VALUE PRAGMAS
1626
 
1627
    These rules are concerned with those '#pragma' statements which are
1628
    used to set compiler values.
1629
*/
1630
 
1631
<option_value_number> : ( :EXP ) -> ( :NUMBER ) ;
1632
 
1633
option-value-number : () -> ( n : NUMBER ) = {
1634
	option ; value ; s = string-literal ;
1635
	n = <option_value_number> ( s ) ;
1636
} ;
1637
 
1638
value-spec : () -> ( n : NUMBER ) = {
1639
	includes ; depth ;
1640
	n = <opt_val_include_depth> ;
1641
    ||
1642
	set ; error ; limit ;
1643
	n = <opt_val_maximum_error> ;
1644
} ;
1645
 
1646
value-rule : () -> () = {
1647
	n = option-value-number ; e = integer-literal ;
1648
	<analysis_exp> ( n, e ) ;
1649
    ||
1650
	n = value-spec ; e = integer-literal ;
1651
	<analysis_exp> ( n, e ) ;
1652
} ;
1653
 
1654
 
1655
/*
1656
    CHARACTER PRAGMAS
1657
 
1658
    These rules are concerned with those '#pragma' statements which are
1659
    used to define character set information.
1660
*/
1661
 
1662
<char_set> : ( :EXP, :EXP ) -> () ;
1663
<escape_set> : ( :EXP, :EXP ) -> () ;
1664
<exp_none> : () -> ( :EXP ) ;
1665
 
1666
character-rule : () -> () = {
1667
	character ;
1668
	{
1669
		a = character-literal ;
1670
	    ||	a = string-literal ;
1671
	} ;
1672
	{
1673
		as ; b = character-literal ;
1674
		<char_set> ( a, b ) ;
1675
		allow ;
1676
	    ||
1677
		disallow ; b = <exp_none> ;
1678
		<char_set> ( a, b ) ;
1679
	} ;
1680
    ||
1681
	escape ; a = character-literal ;
1682
	{
1683
		as ; b = character-literal ; allow ;
1684
	    ||	disallow ; b = <exp_none> ;
1685
	} ;
1686
	<escape_set> ( a, b ) ;
1687
} ;
1688
 
1689
 
1690
/*
1691
    ERROR PRAGMAS
1692
 
1693
    These rules are concerned with those '#pragma' statements which are
1694
    used to define error messages.
1695
*/
1696
 
1697
<error_number> : ( :EXP ) -> ( :NUMBER ) ;
1698
<error_state> : ( :NUMBER, :NUMBER ) -> () ;
1699
<error_use> : ( :NUMBER ) -> () ;
1700
 
1701
error-number : () -> ( n : NUMBER ) = {
1702
	error ; s = string-literal ;
1703
	n = <error_number> ( s ) ;
1704
} ;
1705
 
1706
error-rule : () -> () = {
1707
	n = error-number ; e = error-severity ;
1708
	<error_state> ( n, e ) ;
1709
    ||
1710
	n = error-number ; as ; e = option-number ;
1711
	<error_state> ( n, e ) ;
1712
    ||
1713
	use ; n = error-number ;
1714
	<error_use> ( n ) ;
1715
} ;
1716
 
1717
 
1718
 
1719
/*
1720
    SCOPE PRAGMAS
1721
 
1722
    These rules are concerned with those '#pragma' statements which are
1723
    used to define checking and declaration scopes.
1724
*/
1725
 
1726
<check_begin> : ( :IDENTIFIER ) -> () ;
1727
<check_end> : () -> () ;
1728
<check_directory> : ( :IDENTIFIER, :IDENTIFIER ) -> () ;
1729
<check_use> : ( :IDENTIFIER, :STATE ) -> () ;
1730
<decl_block_begin> : ( :IDENTIFIER ) -> () ;
1731
<decl_block_end> : () -> () ;
1732
 
1733
scope-rule : () -> () = {
1734
	begin ; id = <id_none> ;
1735
	<check_begin> ( id ) ;
1736
    ||
1737
	begin ; name ; environment ; <rescan_id> ; id = any-identifier ;
1738
	<check_begin> ( id ) ;
1739
    ||
1740
	directory ; <rescan_id> ; dir = any-identifier ;
1741
	use ; environment ; <rescan_id> ; id = any-identifier ;
1742
	<check_directory> ( dir, id ) ;
1743
    ||
1744
	use ; environment ; <rescan_id> ; id = any-identifier ;
1745
	{
1746
		reset ; e = allow-state ;
1747
	    ||	e = <error_on> ;
1748
	} ;
1749
	<check_use> ( id, e ) ;
1750
    ||
1751
	end ;
1752
	<check_end> ;
1753
    ||
1754
	decl ; block ; <rescan_id> ; id = any-identifier ; begin ;
1755
	<decl_block_begin> ( id ) ;
1756
    ||
1757
	decl ; block ; end ;
1758
	<decl_block_end> ;
1759
} ;
1760
 
1761
 
1762
/*
1763
    PRAGMA TENDRA DIRECTIVES
1764
 
1765
    These rules describe the '#pragma TenDRA' directives.
1766
*/
1767
 
1768
<lex_none> : () -> ( :LEX ) ;
1769
<lex_pragma> : () -> ( :LEX ) ;
1770
<error_syntax> : () -> () ;
1771
 
1772
pragma-rule : () -> () = {
1773
	scope-rule ;
1774
    ||	error-rule ;
1775
    ||	keyword-rule ;
1776
    ||	option-rule ;
1777
    ||	value-rule ;
1778
    ||	character-rule ;
1779
    ||	semicolon ;
1780
} ;
1781
 
1782
pragma-tendra-rule : () -> () = {
1783
	token-rule ;
1784
    ||	interface-rule ;
1785
    ||	tokdef-rule ;
1786
    ||	literal-rule ;
1787
    ||	identifier-rule ;
1788
    ||	pragma-rule ;
1789
    ||	type-spec ;
1790
} ;
1791
 
1792
pragma-tendra : () -> ( t : LEX ) = {
1793
	pragma-tendra-rule ;
1794
	t = <lex_pragma> ;
1795
    ||
1796
	exhaustive ;
1797
	t = <lex_exhaustive> ;
1798
    ||
1799
	discard ;
1800
	t = <lex_unused> ;
1801
    ||
1802
	set ;
1803
	t = <lex_set> ;
1804
    ##
1805
	<error_syntax> ;
1806
	t = <lex_pragma> ;
1807
} ;
1808
 
1809
pragma-preproc : () -> ( t : LEX ) = {
1810
	pragma-rule ;
1811
	t = <lex_none> ;
1812
    ##
1813
	t = <lex_pragma> ;
1814
} ;
1815
 
1816
 
1817
/*
1818
    ENTRY POINTS
1819
 
1820
    There are two entry points into the grammar, pragma-tendra, which is
1821
    the normal entry point, and pragma-preproc, which is used during
1822
    preprocessing.
1823
*/
1824
 
1825
%entry% pragma-tendra, pragma-preproc ;