2 |
7u83 |
1 |
%prefixes%
|
|
|
2 |
|
|
|
3 |
|
|
|
4 |
/*
|
|
|
5 |
TERMINAL PREFIX
|
|
|
6 |
|
|
|
7 |
This prefix is used to identify lexical token numbers in syntax.h
|
|
|
8 |
(see also symbols.h).
|
|
|
9 |
*/
|
|
|
10 |
|
|
|
11 |
terminal = lex_ ;
|
|
|
12 |
type = XT ;
|
|
|
13 |
function = XR ;
|
|
|
14 |
input = XI ;
|
|
|
15 |
output = XO ;
|
|
|
16 |
label = XL ;
|
|
|
17 |
|
|
|
18 |
|
|
|
19 |
%maps%
|
|
|
20 |
|
|
|
21 |
|
|
|
22 |
/*
|
|
|
23 |
PARSER ENTRY POINTS
|
|
|
24 |
|
|
|
25 |
There are a number of entry points into the parser. The main ones
|
|
|
26 |
are translation-unit which is used to parse an entire translation
|
|
|
27 |
unit and hash-if-expression which is used to parse expressions in
|
|
|
28 |
#if preprocessing directives.
|
|
|
29 |
*/
|
|
|
30 |
|
|
|
31 |
pragma-tendra -> parse_tendra ;
|
|
|
32 |
pragma-preproc -> parse_preproc ;
|
|
|
33 |
|
|
|
34 |
|
|
|
35 |
/*
|
|
|
36 |
BASIC TYPES
|
|
|
37 |
|
|
|
38 |
The type BOOL is used to hold the predicate values, true and false.
|
|
|
39 |
The type COUNT is used to hold the various counters maintained (see
|
|
|
40 |
predict.c). The type LEX is used to hold a lexical token number
|
|
|
41 |
(i.e. one of the values defined in syntax.h). The other types used
|
|
|
42 |
in the parser map in a simple fashion to the main program types.
|
|
|
43 |
Note that it is necessary to use aliases for compound types because
|
|
|
44 |
of the restrictions imposed by sid.
|
|
|
45 |
*/
|
|
|
46 |
|
|
|
47 |
ACCESS -> DECL_SPEC ;
|
|
|
48 |
BOOL -> int ;
|
|
|
49 |
BTYPE -> BASE_TYPE ;
|
|
|
50 |
CV -> CV_SPEC ;
|
|
|
51 |
EXP -> EXP ;
|
|
|
52 |
IDENTIFIER -> IDENTIFIER ;
|
|
|
53 |
LEX -> int ;
|
|
|
54 |
LINKAGE -> DECL_SPEC ;
|
|
|
55 |
LIST-ID -> SID_LIST_ID ;
|
|
|
56 |
NAMESPACE -> NAMESPACE ;
|
|
|
57 |
NUMBER -> int ;
|
|
|
58 |
STATE -> unsigned ;
|
|
|
59 |
TOKEN -> TOKEN ;
|
|
|
60 |
TYPE -> TYPE ;
|
|
|
61 |
VALUE -> unsigned ;
|
|
|
62 |
|
|
|
63 |
|
|
|
64 |
/*
|
|
|
65 |
FILE HEADERS
|
|
|
66 |
|
|
|
67 |
These headers are prepended to the parser definition and declaration
|
|
|
68 |
output files. Because of the simple file splitting algorithm applied
|
|
|
69 |
to the output this should contain only declarations and not definitions.
|
|
|
70 |
*/
|
|
|
71 |
|
|
|
72 |
%header% @{
|
|
|
73 |
/*
|
|
|
74 |
Crown Copyright (c) 1997, 1998
|
|
|
75 |
|
|
|
76 |
This TenDRA(r) Computer Program is subject to Copyright
|
|
|
77 |
owned by the United Kingdom Secretary of State for Defence
|
|
|
78 |
acting through the Defence Evaluation and Research Agency
|
|
|
79 |
(DERA). It is made available to Recipients with a
|
|
|
80 |
royalty-free licence for its use, reproduction, transfer
|
|
|
81 |
to other parties and amendment for any purpose not excluding
|
|
|
82 |
product development provided that any such use et cetera
|
|
|
83 |
shall be deemed to be acceptance of the following conditions:-
|
|
|
84 |
|
|
|
85 |
(1) Its Recipients shall ensure that this Notice is
|
|
|
86 |
reproduced upon any copies or amended versions of it;
|
|
|
87 |
|
|
|
88 |
(2) Any amended version of it shall be clearly marked to
|
|
|
89 |
show both the nature of and the organisation responsible
|
|
|
90 |
for the relevant amendment or amendments;
|
|
|
91 |
|
|
|
92 |
(3) Its onward transfer from a recipient to another
|
|
|
93 |
party shall be deemed to be that party's acceptance of
|
|
|
94 |
these conditions;
|
|
|
95 |
|
|
|
96 |
(4) DERA gives no warranty or assurance as to its
|
|
|
97 |
quality or suitability for any purpose and DERA accepts
|
|
|
98 |
no liability whatsoever in relation to any use to which
|
|
|
99 |
it may be put.
|
|
|
100 |
*/
|
|
|
101 |
|
|
|
102 |
|
|
|
103 |
#include "config.h"
|
|
|
104 |
#include "c_types.h"
|
|
|
105 |
#include "exp_ops.h"
|
|
|
106 |
#include "hashid_ops.h"
|
|
|
107 |
#include "id_ops.h"
|
|
|
108 |
#include "tok_ops.h"
|
|
|
109 |
#include "type_ops.h"
|
|
|
110 |
#include "error.h"
|
|
|
111 |
#include "catalog.h"
|
|
|
112 |
#include "option.h"
|
|
|
113 |
#include "access.h"
|
|
|
114 |
#include "allocate.h"
|
|
|
115 |
#include "assign.h"
|
|
|
116 |
#include "basetype.h"
|
|
|
117 |
#include "cast.h"
|
|
|
118 |
#include "chktype.h"
|
|
|
119 |
#include "class.h"
|
|
|
120 |
#include "constant.h"
|
|
|
121 |
#include "construct.h"
|
|
|
122 |
#include "convert.h"
|
|
|
123 |
#include "declare.h"
|
|
|
124 |
#include "derive.h"
|
|
|
125 |
#include "exception.h"
|
|
|
126 |
#include "expression.h"
|
|
|
127 |
#include "function.h"
|
|
|
128 |
#include "hash.h"
|
|
|
129 |
#include "identifier.h"
|
|
|
130 |
#include "initialise.h"
|
|
|
131 |
#include "inttype.h"
|
|
|
132 |
#include "label.h"
|
|
|
133 |
#include "lex.h"
|
|
|
134 |
#include "literal.h"
|
|
|
135 |
#include "member.h"
|
|
|
136 |
#include "namespace.h"
|
|
|
137 |
#include "parse.h"
|
|
|
138 |
#include "pragma.h"
|
|
|
139 |
#include "predict.h"
|
|
|
140 |
#include "preproc.h"
|
|
|
141 |
#include "printf.h"
|
|
|
142 |
#include "redeclare.h"
|
|
|
143 |
#include "rewrite.h"
|
|
|
144 |
#include "statement.h"
|
|
|
145 |
#include "symbols.h"
|
|
|
146 |
#include "template.h"
|
|
|
147 |
#include "tokdef.h"
|
|
|
148 |
#include "token.h"
|
|
|
149 |
#include "typeid.h"
|
|
|
150 |
#include "variable.h"
|
|
|
151 |
|
|
|
152 |
|
|
|
153 |
/*
|
|
|
154 |
COMPOUND TYPE ALIASES
|
|
|
155 |
|
|
|
156 |
These are the aliases for the compound types used in the parser.
|
|
|
157 |
*/
|
|
|
158 |
|
7 |
7u83 |
159 |
typedef LIST(IDENTIFIER) SID_LIST_ID;
|
2 |
7u83 |
160 |
|
|
|
161 |
|
|
|
162 |
/*
|
|
|
163 |
DECLARE FUNCTIONS
|
|
|
164 |
|
|
|
165 |
The function declarations are included at this point so that the
|
|
|
166 |
type definitions are in scope.
|
|
|
167 |
*/
|
|
|
168 |
|
|
|
169 |
#include "psyntax.h"
|
7 |
7u83 |
170 |
extern void parse_tok_type(TYPE *);
|
|
|
171 |
extern void parse_mem_type(TYPE *);
|
|
|
172 |
extern void parse_operator(IDENTIFIER *);
|
2 |
7u83 |
173 |
|
|
|
174 |
|
|
|
175 |
/*
|
|
|
176 |
COMPILATION MODE
|
|
|
177 |
|
|
|
178 |
The output of sid is automatically generated. Hence it is not
|
|
|
179 |
necessarily appropriate to apply the same level of checking to this
|
|
|
180 |
as to the rest of the program. These pragmas describe the relaxations
|
|
|
181 |
allowed for the sid output.
|
|
|
182 |
*/
|
|
|
183 |
|
|
|
184 |
#if FS_TENDRA
|
|
|
185 |
#pragma TenDRA begin
|
|
|
186 |
#pragma TenDRA variable analysis off
|
|
|
187 |
#ifndef OLD_PRODUCER
|
|
|
188 |
#pragma TenDRA unreachable code allow
|
|
|
189 |
#endif
|
|
|
190 |
#endif
|
|
|
191 |
|
|
|
192 |
|
|
|
193 |
@}, @{
|
|
|
194 |
/*
|
|
|
195 |
Crown Copyright (c) 1997, 1998
|
|
|
196 |
|
|
|
197 |
This TenDRA(r) Computer Program is subject to Copyright
|
|
|
198 |
owned by the United Kingdom Secretary of State for Defence
|
|
|
199 |
acting through the Defence Evaluation and Research Agency
|
|
|
200 |
(DERA). It is made available to Recipients with a
|
|
|
201 |
royalty-free licence for its use, reproduction, transfer
|
|
|
202 |
to other parties and amendment for any purpose not excluding
|
|
|
203 |
product development provided that any such use et cetera
|
|
|
204 |
shall be deemed to be acceptance of the following conditions:-
|
|
|
205 |
|
|
|
206 |
(1) Its Recipients shall ensure that this Notice is
|
|
|
207 |
reproduced upon any copies or amended versions of it;
|
|
|
208 |
|
|
|
209 |
(2) Any amended version of it shall be clearly marked to
|
|
|
210 |
show both the nature of and the organisation responsible
|
|
|
211 |
for the relevant amendment or amendments;
|
|
|
212 |
|
|
|
213 |
(3) Its onward transfer from a recipient to another
|
|
|
214 |
party shall be deemed to be that party's acceptance of
|
|
|
215 |
these conditions;
|
|
|
216 |
|
|
|
217 |
(4) DERA gives no warranty or assurance as to its
|
|
|
218 |
quality or suitability for any purpose and DERA accepts
|
|
|
219 |
no liability whatsoever in relation to any use to which
|
|
|
220 |
it may be put.
|
|
|
221 |
*/
|
|
|
222 |
|
|
|
223 |
|
|
|
224 |
#ifndef PSYNTAX_INCLUDED
|
|
|
225 |
#define PSYNTAX_INCLUDED
|
|
|
226 |
|
|
|
227 |
@} ;
|
|
|
228 |
|
|
|
229 |
|
|
|
230 |
%terminals%
|
|
|
231 |
|
|
|
232 |
|
|
|
233 |
/*
|
|
|
234 |
IDENTIFIER TERMINALS
|
|
|
235 |
|
|
|
236 |
Identifiers and related terminals (type names, namespace names and
|
|
|
237 |
destructor names) are identified by means of an identifier stored in
|
|
|
238 |
crt_token by expand_token.
|
|
|
239 |
*/
|
|
|
240 |
|
|
|
241 |
identifier : () -> ( id ) = @{
|
|
|
242 |
@id = crt_token->pp_data.id.use ;
|
|
|
243 |
@} ;
|
|
|
244 |
|
|
|
245 |
type-name : () -> ( id ) = @{
|
|
|
246 |
@id = crt_token->pp_data.id.use ;
|
|
|
247 |
@} ;
|
|
|
248 |
|
|
|
249 |
namespace-name : () -> ( id ) = @{
|
|
|
250 |
@id = crt_token->pp_data.id.use ;
|
|
|
251 |
@} ;
|
|
|
252 |
|
|
|
253 |
statement-name : () -> ( id ) = @{
|
|
|
254 |
@id = crt_token->pp_data.id.use ;
|
|
|
255 |
@} ;
|
|
|
256 |
|
|
|
257 |
destructor-name : () -> ( id ) = @{
|
|
|
258 |
@id = crt_token->pp_data.id.use ;
|
|
|
259 |
@} ;
|
|
|
260 |
|
|
|
261 |
template-id : () -> ( id ) = @{
|
|
|
262 |
IDENTIFIER id = crt_token->pp_data.tok.id ;
|
|
|
263 |
PPTOKEN *args = crt_token->pp_data.tok.args ;
|
|
|
264 |
@id = parse_id_template ( id, args, 0 ) ;
|
|
|
265 |
crt_templ_qualifier = 1 ;
|
|
|
266 |
RESCAN_LEXER ;
|
|
|
267 |
@} ;
|
|
|
268 |
|
|
|
269 |
template-type : () -> ( id ) = @{
|
|
|
270 |
IDENTIFIER id = crt_token->pp_data.tok.id ;
|
|
|
271 |
PPTOKEN *args = crt_token->pp_data.tok.args ;
|
|
|
272 |
@id = parse_type_template ( id, args, 0 ) ;
|
|
|
273 |
crt_templ_qualifier = 1 ;
|
|
|
274 |
RESCAN_LEXER ;
|
|
|
275 |
@} ;
|
|
|
276 |
|
|
|
277 |
|
|
|
278 |
/*
|
|
|
279 |
NAMESPACE SPECIFIER TERMINALS
|
|
|
280 |
|
|
|
281 |
Namespace specifiers (i.e. sequences of namespace or class names
|
|
|
282 |
separated using '::') are identified by expand_token. The full nested
|
|
|
283 |
names are those which begin with the global namespace.
|
|
|
284 |
*/
|
|
|
285 |
|
|
|
286 |
nested-name : () -> ( ns ) = @{
|
|
|
287 |
@ns = crt_token->pp_data.ns ;
|
|
|
288 |
@} ;
|
|
|
289 |
|
|
|
290 |
full-name : () -> ( ns ) = @{
|
|
|
291 |
@ns = crt_token->pp_data.ns ;
|
|
|
292 |
@} ;
|
|
|
293 |
|
|
|
294 |
|
|
|
295 |
/*
|
|
|
296 |
POINTER TO MEMBER TERMINALS
|
|
|
297 |
|
|
|
298 |
Pointer to member specifiers (such as 'C::*') are identified by
|
|
|
299 |
expand_token. The identifier corresponding to the given class is
|
|
|
300 |
stored in crt_token.
|
|
|
301 |
*/
|
|
|
302 |
|
|
|
303 |
nested-name-star : () -> ( id ) = @{
|
|
|
304 |
@id = crt_token->pp_data.id.use ;
|
|
|
305 |
@} ;
|
|
|
306 |
|
|
|
307 |
full-name-star : () -> ( id ) = @{
|
|
|
308 |
@id = crt_token->pp_data.id.use ;
|
|
|
309 |
@} ;
|
|
|
310 |
|
|
|
311 |
|
|
|
312 |
/*
|
|
|
313 |
INTEGER AND FLOATING-POINT LITERAL TERMINALS
|
|
|
314 |
|
|
|
315 |
Integer and floating-point literal tokens have already been transformed
|
|
|
316 |
into their corresponding expressions by expand_token, which stores this
|
|
|
317 |
information in crt_token.
|
|
|
318 |
*/
|
|
|
319 |
|
|
|
320 |
integer-exp : () -> ( e ) = @{
|
|
|
321 |
@e = crt_token->pp_data.exp ;
|
|
|
322 |
@} ;
|
|
|
323 |
|
|
|
324 |
floating-exp : () -> ( e ) = @{
|
|
|
325 |
@e = crt_token->pp_data.exp ;
|
|
|
326 |
@} ;
|
|
|
327 |
|
|
|
328 |
|
|
|
329 |
/*
|
|
|
330 |
STRING AND CHARACTER LITERAL TERMINALS
|
|
|
331 |
|
|
|
332 |
String and character literal tokens have already been transformed
|
|
|
333 |
into their corresponding expressions by expand_token, which stores this
|
|
|
334 |
information in crt_token.
|
|
|
335 |
*/
|
|
|
336 |
|
|
|
337 |
char-exp : () -> ( e ) = @{
|
|
|
338 |
@e = crt_token->pp_data.exp ;
|
|
|
339 |
@} ;
|
|
|
340 |
|
|
|
341 |
wchar-exp : () -> ( e ) = @{
|
|
|
342 |
@e = crt_token->pp_data.exp ;
|
|
|
343 |
@} ;
|
|
|
344 |
|
|
|
345 |
string-exp : () -> ( e ) = @{
|
|
|
346 |
@e = crt_token->pp_data.exp ;
|
|
|
347 |
@} ;
|
|
|
348 |
|
|
|
349 |
wstring-exp : () -> ( e ) = @{
|
|
|
350 |
@e = crt_token->pp_data.exp ;
|
|
|
351 |
@} ;
|
|
|
352 |
|
|
|
353 |
|
|
|
354 |
/*
|
|
|
355 |
CONDITIONAL COMPILATION TERMINALS
|
|
|
356 |
|
|
|
357 |
Any target dependent conditional compilation expressions are stored
|
|
|
358 |
in crt_token by the preprocessing routines.
|
|
|
359 |
*/
|
|
|
360 |
|
|
|
361 |
hash-if : () -> ( e ) = @{
|
|
|
362 |
@e = crt_token->pp_data.exp ;
|
|
|
363 |
@} ;
|
|
|
364 |
|
|
|
365 |
hash-elif : () -> ( e ) = @{
|
|
|
366 |
@e = crt_token->pp_data.exp ;
|
|
|
367 |
@} ;
|
|
|
368 |
|
|
|
369 |
|
|
|
370 |
/*
|
|
|
371 |
COMPLEX EXPRESSION AND TYPE TERMINALS
|
|
|
372 |
|
|
|
373 |
These terminals are used to handle complex expressions and types
|
|
|
374 |
such as token applications.
|
|
|
375 |
*/
|
|
|
376 |
|
|
|
377 |
complex-exp : () -> ( e ) = @{
|
|
|
378 |
IDENTIFIER id = crt_token->pp_data.tok.id ;
|
|
|
379 |
PPTOKEN *args = crt_token->pp_data.tok.args ;
|
|
|
380 |
@e = parse_exp_token ( id, args ) ;
|
|
|
381 |
RESCAN_LEXER ;
|
|
|
382 |
@} ;
|
|
|
383 |
|
|
|
384 |
complex-stmt : () -> ( e ) = @{
|
|
|
385 |
IDENTIFIER id = crt_token->pp_data.tok.id ;
|
|
|
386 |
PPTOKEN *args = crt_token->pp_data.tok.args ;
|
|
|
387 |
@e = parse_exp_token ( id, args ) ;
|
|
|
388 |
RESCAN_LEXER ;
|
|
|
389 |
@} ;
|
|
|
390 |
|
|
|
391 |
complex-type : () -> ( t ) = @{
|
|
|
392 |
IDENTIFIER id = crt_token->pp_data.tok.id ;
|
|
|
393 |
PPTOKEN *args = crt_token->pp_data.tok.args ;
|
|
|
394 |
@t = parse_type_token ( id, args ) ;
|
|
|
395 |
have_type_declaration = TYPE_DECL_NONE ;
|
|
|
396 |
have_type_specifier = 1 ;
|
|
|
397 |
RESCAN_LEXER ;
|
|
|
398 |
@} ;
|
|
|
399 |
|
|
|
400 |
|
|
|
401 |
%actions%
|
|
|
402 |
|
|
|
403 |
|
|
|
404 |
/*
|
|
|
405 |
LINKS TO MAIN SYNTAX
|
|
|
406 |
|
|
|
407 |
These actions give links into the main syntax. Note that none of the
|
|
|
408 |
used rules in the main syntax has an associated exception handler,
|
|
|
409 |
allowing syntax errors to be handled in the pragma syntax.
|
|
|
410 |
*/
|
|
|
411 |
|
|
|
412 |
<parse_type> : () -> ( t ) = @{
|
|
|
413 |
@t = type_error ;
|
|
|
414 |
parse_tok_type ( &@t ) ;
|
|
|
415 |
object_type ( @t, null_tag ) ;
|
|
|
416 |
@} ;
|
|
|
417 |
|
|
|
418 |
<parse_func_type> : () -> ( t ) = @{
|
|
|
419 |
@t = type_error ;
|
|
|
420 |
parse_tok_type ( &@t ) ;
|
|
|
421 |
object_type ( @t, id_function_tag ) ;
|
|
|
422 |
@} ;
|
|
|
423 |
|
|
|
424 |
<parse_mem_type> : () -> ( t ) = @{
|
|
|
425 |
@t = type_error ;
|
|
|
426 |
parse_mem_type ( &@t ) ;
|
|
|
427 |
object_type ( @t, null_tag ) ;
|
|
|
428 |
@} ;
|
|
|
429 |
|
|
|
430 |
<parse_operator> : () -> ( id ) = @{
|
|
|
431 |
@id = DEREF_id ( hashid_id ( KEYWORD ( lex_zzzz ) ) ) ;
|
|
|
432 |
parse_operator ( &@id ) ;
|
|
|
433 |
@} ;
|
|
|
434 |
|
|
|
435 |
<is_operator> : () -> ( b ) = @{
|
|
|
436 |
@b = predict_operator () ;
|
|
|
437 |
@} ;
|
|
|
438 |
|
|
|
439 |
|
|
|
440 |
/*
|
|
|
441 |
LEXICAL TOKENS
|
|
|
442 |
|
|
|
443 |
These actions give the basic values for the type LEX. They are used
|
|
|
444 |
primarily in overloaded operator function names, but they are also used
|
|
|
445 |
to distinguish closely related groups of expressions, such as relational
|
|
|
446 |
expressions. Note that the primary form of the token has been given
|
|
|
447 |
whenever there is a choice, otherwise the actions are very dull.
|
|
|
448 |
*/
|
|
|
449 |
|
|
|
450 |
<lex_asm> : () -> ( t ) = @{ @t = lex_asm ; @} ;
|
|
|
451 |
<lex_discard> : () -> ( t ) = @{ @t = lex_discard ; @} ;
|
|
|
452 |
<lex_exhaustive> : () -> ( t ) = @{ @t = lex_exhaustive ; @} ;
|
|
|
453 |
<lex_fall> : () -> ( t ) = @{ @t = lex_fall ; @} ;
|
|
|
454 |
<lex_inline> : () -> ( t ) = @{ @t = lex_inline ; @} ;
|
|
|
455 |
<lex_none> : () -> ( t ) = @{ @t = lex_ignore_token ; @} ;
|
|
|
456 |
<lex_postpone> : () -> ( t ) = @{ @t = lex_postpone ; @} ;
|
|
|
457 |
<lex_pragma> : () -> ( t ) = @{ @t = lex_hash_Hpragma ; @} ;
|
|
|
458 |
<lex_reachable> : () -> ( t ) = @{ @t = lex_reachable ; @} ;
|
|
|
459 |
<lex_representation> : () -> ( t ) = @{ @t = lex_representation ; @} ;
|
|
|
460 |
<lex_set> : () -> ( t ) = @{ @t = lex_set ; @} ;
|
|
|
461 |
<lex_unpostpone> : () -> ( t ) = @{ @t = lex_unpostpone ; @} ;
|
|
|
462 |
<lex_unreachable> : () -> ( t ) = @{ @t = lex_unreachable ; @} ;
|
|
|
463 |
<lex_unused> : () -> ( t ) = @{ @t = lex_unused ; @} ;
|
|
|
464 |
<lex_weak> : () -> ( t ) = @{ @t = lex_weak ; @} ;
|
|
|
465 |
|
|
|
466 |
<lex_symbol> : () -> ( t ) = @{
|
|
|
467 |
@t = crt_lex_token ;
|
|
|
468 |
if ( @t >= FIRST_SYMBOL && @t <= LAST_SYMBOL ) crt_lex_token = lex_plus ;
|
|
|
469 |
@} ;
|
|
|
470 |
|
|
|
471 |
|
|
|
472 |
/*
|
|
|
473 |
SPECIAL IDENTIFIERS
|
|
|
474 |
|
|
|
475 |
id_none gives the null identifier and id_anon generates a unique
|
|
|
476 |
anonymous identifier.
|
|
|
477 |
*/
|
|
|
478 |
|
|
|
479 |
<id_none> : () -> ( id ) = @{
|
|
|
480 |
@id = NULL_id ;
|
|
|
481 |
crt_id_qualifier = qual_none ;
|
|
|
482 |
qual_namespace = NULL_nspace ;
|
|
|
483 |
@} ;
|
|
|
484 |
|
|
|
485 |
<id_anon> : () -> ( id ) = @{
|
|
|
486 |
HASHID nm = lookup_anon () ;
|
|
|
487 |
@id = DEREF_id ( hashid_id ( nm ) ) ;
|
|
|
488 |
crt_id_qualifier = qual_none ;
|
|
|
489 |
qual_namespace = NULL_nspace ;
|
|
|
490 |
@} ;
|
|
|
491 |
|
|
|
492 |
<exp_none> : () -> ( e ) = @{
|
|
|
493 |
@e = NULL_exp ;
|
|
|
494 |
@} ;
|
|
|
495 |
|
|
|
496 |
|
|
|
497 |
/*
|
|
|
498 |
CONST-VOLATILE QUALIFIERS
|
|
|
499 |
|
|
|
500 |
These actions describe how to construct and combine the const and
|
|
|
501 |
volatile type qualifiers.
|
|
|
502 |
*/
|
|
|
503 |
|
|
|
504 |
<cv_none> : () -> ( cv ) = @{ @cv = cv_none ; @} ;
|
|
|
505 |
<cv_const> : () -> ( cv ) = @{ @cv = cv_const ; @} ;
|
|
|
506 |
|
|
|
507 |
|
|
|
508 |
/*
|
|
|
509 |
BASIC TYPES
|
|
|
510 |
|
|
|
511 |
These actions describe the basic type specifiers, char, short, int,
|
|
|
512 |
and so on. This is a simple map onto the calculus type BTYPE.
|
|
|
513 |
*/
|
|
|
514 |
|
|
|
515 |
<btype_signed> : () -> ( bt ) = @{ @bt = btype_signed ; @} ;
|
|
|
516 |
<btype_unsigned> : () -> ( bt ) = @{ @bt = btype_unsigned ; @} ;
|
|
|
517 |
<btype_wchar_t> : () -> ( bt ) = @{ @bt = btype_wchar_t ; @} ;
|
|
|
518 |
<btype_size_t> : () -> ( bt ) = @{ @bt = btype_size_t ; @} ;
|
|
|
519 |
<btype_ptrdiff_t> : () -> ( bt ) = @{ @bt = btype_ptrdiff_t ; @} ;
|
|
|
520 |
<btype_none> : () -> ( bt ) = @{ @bt = btype_none ; @} ;
|
|
|
521 |
|
|
|
522 |
|
|
|
523 |
/*
|
|
|
524 |
ACCESS SPECIFIERS
|
|
|
525 |
|
|
|
526 |
These actions describe the access specifiers, private, protected and
|
|
|
527 |
public.
|
|
|
528 |
*/
|
|
|
529 |
|
|
|
530 |
<access_private> : () -> ( a ) = @{ @a = dspec_private ; @} ;
|
|
|
531 |
<access_protected> : () -> ( a ) = @{ @a = dspec_protected ; @} ;
|
|
|
532 |
<access_public> : () -> ( a ) = @{ @a = dspec_public ; @} ;
|
|
|
533 |
|
|
|
534 |
|
|
|
535 |
/*
|
|
|
536 |
LINKAGE SPECIFIERS
|
|
|
537 |
|
|
|
538 |
These actions describe the linkage specifiers. These are implemented
|
|
|
539 |
by a simple global variable, crt_linkage. The action linkage_string
|
|
|
540 |
translates a string literal expression into a linkage specifier.
|
|
|
541 |
*/
|
|
|
542 |
|
|
|
543 |
<linkage_string> : ( s ) -> ( a ) = @{
|
|
|
544 |
@a = find_linkage ( @s ) ;
|
|
|
545 |
@} ;
|
|
|
546 |
|
|
|
547 |
|
|
|
548 |
/*
|
|
|
549 |
OBJECT DECLARATIONS
|
|
|
550 |
|
|
|
551 |
These actions describe how to construct an object declaration.
|
|
|
552 |
*/
|
|
|
553 |
|
|
|
554 |
<declarator_start> : () -> () = @{
|
|
|
555 |
crt_templ_qualifier = 0 ;
|
|
|
556 |
@} ;
|
|
|
557 |
|
|
|
558 |
|
|
|
559 |
/*
|
|
|
560 |
LISTS OF IDENTIFIERS
|
|
|
561 |
|
|
|
562 |
These actions give the basic constructs for building up lists of
|
|
|
563 |
identifiers. They map directly to the calculus list operations.
|
|
|
564 |
*/
|
|
|
565 |
|
|
|
566 |
<list_id_null> : () -> ( p ) = @{
|
|
|
567 |
@p = NULL_list ( IDENTIFIER ) ;
|
|
|
568 |
@} ;
|
|
|
569 |
|
|
|
570 |
<list_id_cons> : ( id, q ) -> ( p ) = @{
|
|
|
571 |
CONS_id ( @id, @q, @p ) ;
|
|
|
572 |
@} ;
|
|
|
573 |
|
|
|
574 |
|
|
|
575 |
/*
|
|
|
576 |
TOKEN ACTIONS
|
|
|
577 |
|
|
|
578 |
The following rules are concerned with the construction and definition
|
|
|
579 |
of TDF tokens.
|
|
|
580 |
*/
|
|
|
581 |
|
|
|
582 |
<token_nat> : () -> ( t ) = @{
|
|
|
583 |
MAKE_tok_nat ( NULL_nat, @t ) ;
|
|
|
584 |
@} ;
|
|
|
585 |
|
|
|
586 |
<token_snat> : () -> ( t ) = @{
|
|
|
587 |
MAKE_tok_snat ( NULL_nat, @t ) ;
|
|
|
588 |
@} ;
|
|
|
589 |
|
|
|
590 |
<token_stmt> : () -> ( t ) = @{
|
|
|
591 |
MAKE_tok_stmt ( NULL_exp, @t ) ;
|
|
|
592 |
@} ;
|
|
|
593 |
|
|
|
594 |
<token_type> : () -> ( t ) = @{
|
|
|
595 |
@t = make_type_token ( btype_none ) ;
|
|
|
596 |
@} ;
|
|
|
597 |
|
|
|
598 |
<token_variety> : () -> ( t ) = @{
|
|
|
599 |
@t = make_type_token ( btype_int ) ;
|
|
|
600 |
@} ;
|
|
|
601 |
|
|
|
602 |
<token_signed> : () -> ( t ) = @{
|
|
|
603 |
@t = make_type_token ( btype_signed | btype_int ) ;
|
|
|
604 |
@} ;
|
|
|
605 |
|
|
|
606 |
<token_unsigned> : () -> ( t ) = @{
|
|
|
607 |
@t = make_type_token ( btype_unsigned | btype_int ) ;
|
|
|
608 |
@} ;
|
|
|
609 |
|
|
|
610 |
<token_float> : () -> ( t ) = @{
|
|
|
611 |
@t = make_type_token ( btype_float ) ;
|
|
|
612 |
@} ;
|
|
|
613 |
|
|
|
614 |
<token_arith> : () -> ( t ) = @{
|
|
|
615 |
@t = make_type_token ( btype_arith ) ;
|
|
|
616 |
@} ;
|
|
|
617 |
|
|
|
618 |
<token_class> : () -> ( t ) = @{
|
|
|
619 |
@t = make_type_token ( btype_lang ) ;
|
|
|
620 |
@} ;
|
|
|
621 |
|
|
|
622 |
<token_scalar> : () -> ( t ) = @{
|
|
|
623 |
@t = make_type_token ( btype_scalar ) ;
|
|
|
624 |
@} ;
|
|
|
625 |
|
|
|
626 |
<token_struct> : () -> ( t ) = @{
|
|
|
627 |
@t = make_type_token ( btype_struct ) ;
|
|
|
628 |
@} ;
|
|
|
629 |
|
|
|
630 |
<token_union> : () -> ( t ) = @{
|
|
|
631 |
@t = make_type_token ( btype_union ) ;
|
|
|
632 |
@} ;
|
|
|
633 |
|
|
|
634 |
<token_exp> : ( a, c, b ) -> ( t ) = @{
|
|
|
635 |
@t = make_exp_token ( @b, @a, @c ) ;
|
|
|
636 |
@} ;
|
|
|
637 |
|
|
|
638 |
<token_member> : ( p, a, b ) -> ( t ) = @{
|
|
|
639 |
@t = make_member_token ( @a, @b, @p ) ;
|
|
|
640 |
@} ;
|
|
|
641 |
|
|
|
642 |
<token_func> : ( a ) -> ( t ) = @{
|
|
|
643 |
@t = make_func_token ( @a ) ;
|
|
|
644 |
@} ;
|
|
|
645 |
|
|
|
646 |
<token_param> : ( t, b, tid ) -> ( id ) = @{
|
|
|
647 |
@id = make_tok_param ( @t, @b, @tid ) ;
|
|
|
648 |
@} ;
|
|
|
649 |
|
|
|
650 |
<token_exp_par> : ( tid, r ) -> ( id ) = @{
|
|
|
651 |
@id = prog_tok_param ( @tid, NULL_type, tok_exp_tag, @r ) ;
|
|
|
652 |
@} ;
|
|
|
653 |
|
|
|
654 |
<token_stmt_par> : ( tid, r ) -> ( id ) = @{
|
|
|
655 |
@id = prog_tok_param ( @tid, NULL_type, tok_stmt_tag, @r ) ;
|
|
|
656 |
@} ;
|
|
|
657 |
|
|
|
658 |
<token_type_par> : ( t, r ) -> ( id ) = @{
|
|
|
659 |
IDENTIFIER tid = DEREF_id ( type_name ( @t ) ) ;
|
|
|
660 |
@id = prog_tok_param ( tid, @t, tok_type_tag, @r ) ;
|
|
|
661 |
@} ;
|
|
|
662 |
|
|
|
663 |
<token_member_par> : ( t, tid, r ) -> ( id ) = @{
|
|
|
664 |
@id = prog_tok_param ( @tid, @t, tok_member_tag, @r ) ;
|
|
|
665 |
@} ;
|
|
|
666 |
|
|
|
667 |
<token_proc_par> : ( tid, r ) -> ( id ) = @{
|
|
|
668 |
@id = prog_tok_param ( @tid, NULL_type, tok_proc_tag, @r ) ;
|
|
|
669 |
@} ;
|
|
|
670 |
|
|
|
671 |
<token_proc_begin> : () -> ( t ) = @{
|
|
|
672 |
@t = begin_proc_token () ;
|
|
|
673 |
@} ;
|
|
|
674 |
|
|
|
675 |
<token_proc_simple> : ( a, p ) -> ( t ) = @{
|
|
|
676 |
@t = cont_proc_token ( @a, @p, @p ) ;
|
|
|
677 |
@} ;
|
|
|
678 |
|
|
|
679 |
<token_proc_complex> : ( a, p, q ) -> ( t ) = @{
|
|
|
680 |
@t = cont_proc_token ( @a, @p, @q ) ;
|
|
|
681 |
@} ;
|
|
|
682 |
|
|
|
683 |
<token_proc_end> : ( a, b ) -> ( t ) = @{
|
|
|
684 |
@t = end_proc_token ( @a, @b ) ;
|
|
|
685 |
@} ;
|
|
|
686 |
|
|
|
687 |
<token_decl> : ( t, c, a, b ) -> () = @{
|
|
|
688 |
IGNORE make_token_decl ( @t, @c, @a, @b ) ;
|
|
|
689 |
@} ;
|
|
|
690 |
|
|
|
691 |
<token_name> : ( a ) -> ( id ) = @{
|
|
|
692 |
@id = check_id ( crt_namespace, @a, 0 ) ;
|
|
|
693 |
@} ;
|
|
|
694 |
|
|
|
695 |
<token_tag> : ( a ) -> ( id ) = @{
|
|
|
696 |
@id = find_tag_token ( @a ) ;
|
|
|
697 |
@} ;
|
|
|
698 |
|
|
|
699 |
<token_selector> : ( a, b ) -> ( id ) = @{
|
|
|
700 |
@id = find_mem_token ( @a, @b ) ;
|
|
|
701 |
@} ;
|
|
|
702 |
|
|
|
703 |
<token_extern> : ( a ) -> ( id ) = @{
|
|
|
704 |
@id = find_ext_token ( @a ) ;
|
|
|
705 |
@} ;
|
|
|
706 |
|
|
|
707 |
<token_interface> : ( id, i ) -> () = @{
|
|
|
708 |
token_interface ( @id, @i ) ;
|
|
|
709 |
@} ;
|
|
|
710 |
|
|
|
711 |
<token_member_def> : ( t, id ) -> () = @{
|
|
|
712 |
if ( define_mem_macro ( @id, @t ) ) no_declarations++ ;
|
|
|
713 |
@} ;
|
|
|
714 |
|
|
|
715 |
<tokdef_start> : () -> () = @{
|
|
|
716 |
in_token_decl = 1 ;
|
|
|
717 |
@} ;
|
|
|
718 |
|
|
|
719 |
<tokdef_end> : () -> () = @{
|
|
|
720 |
in_token_decl = 0 ;
|
|
|
721 |
@} ;
|
|
|
722 |
|
|
|
723 |
<id_conv> : ( id ) -> () = @{
|
|
|
724 |
allow_conversion ( @id ) ;
|
|
|
725 |
@} ;
|
|
|
726 |
|
|
|
727 |
<id_init> : ( id ) -> () = @{
|
|
|
728 |
allow_initialiser ( @id ) ;
|
|
|
729 |
@} ;
|
|
|
730 |
|
|
|
731 |
<id_postpone> : ( id, a ) -> () = @{
|
|
|
732 |
preserve_id ( @id, @a ) ;
|
|
|
733 |
@} ;
|
|
|
734 |
|
|
|
735 |
<id_preserve> : ( id ) -> () = @{
|
|
|
736 |
preserve_id ( @id, lex_preserve ) ;
|
|
|
737 |
@} ;
|
|
|
738 |
|
|
|
739 |
<id_preserve_all> : () -> () = @{
|
|
|
740 |
preserve_all = 1 ;
|
|
|
741 |
@} ;
|
|
|
742 |
|
|
|
743 |
<id_susp> : ( id ) -> () = @{
|
|
|
744 |
preserve_id ( @id, lex_suspend ) ;
|
|
|
745 |
@} ;
|
|
|
746 |
|
|
|
747 |
<interface_define> : () -> ( i ) = @{ @i = lex_define ; @} ;
|
|
|
748 |
<interface_no_def> : () -> ( i ) = @{ @i = lex_no_Hdef ; @} ;
|
|
|
749 |
<interface_ignore> : () -> ( i ) = @{ @i = lex_ignore ; @} ;
|
|
|
750 |
<interface_crt> : () -> ( i ) = @{ @i = crt_interface ; @} ;
|
|
|
751 |
<interface_undef> : () -> ( i ) = @{ @i = lex_undef ; @} ;
|
|
|
752 |
|
|
|
753 |
|
|
|
754 |
/*
|
|
|
755 |
INTEGER LITERAL PRAGMA DIRECTIVES
|
|
|
756 |
|
|
|
757 |
The following rules are concerned with processing those '#pragma'
|
|
|
758 |
directives concerned with defining integer literal types.
|
|
|
759 |
*/
|
|
|
760 |
|
|
|
761 |
<base_octal> : () -> ( b ) = @{ @b = BASE_OCTAL ; @} ;
|
|
|
762 |
<base_decimal> : () -> ( b ) = @{ @b = BASE_DECIMAL ; @} ;
|
|
|
763 |
<base_hexadecimal> : () -> ( b ) = @{ @b = BASE_HEXADECIMAL ; @} ;
|
|
|
764 |
|
|
|
765 |
<suffix_none> : () -> ( s ) = @{ @s = SUFFIX_NONE ; @} ;
|
|
|
766 |
<suffix_u> : () -> ( s ) = @{ @s = SUFFIX_U ; @} ;
|
|
|
767 |
<suffix_l> : () -> ( s ) = @{ @s = SUFFIX_L ; @} ;
|
|
|
768 |
<suffix_ul> : () -> ( s ) = @{ @s = SUFFIX_UL ; @} ;
|
|
|
769 |
<suffix_ll> : () -> ( s ) = @{ @s = SUFFIX_LL ; @} ;
|
|
|
770 |
<suffix_ull> : () -> ( s ) = @{ @s = SUFFIX_ULL ; @} ;
|
|
|
771 |
|
|
|
772 |
<literal_set> : () -> () = @{
|
|
|
773 |
pragma_number = 1 ;
|
|
|
774 |
@} ;
|
|
|
775 |
|
|
|
776 |
<literal_begin> : ( b, s ) -> () = @{
|
|
|
777 |
begin_literal ( @b, @s ) ;
|
|
|
778 |
@} ;
|
|
|
779 |
|
|
|
780 |
<literal_infinity> : () -> () = @{
|
|
|
781 |
add_range_literal ( NULL_exp, 0 ) ;
|
|
|
782 |
@} ;
|
|
|
783 |
|
|
|
784 |
<literal_integer> : ( e ) -> () = @{
|
|
|
785 |
add_range_literal ( @e, 2 ) ;
|
|
|
786 |
@} ;
|
|
|
787 |
|
|
|
788 |
<literal_range> : () -> () = @{
|
|
|
789 |
add_range_literal ( NULL_exp, 1 ) ;
|
|
|
790 |
@} ;
|
|
|
791 |
|
|
|
792 |
<literal_type> : ( t ) -> () = @{
|
|
|
793 |
add_type_literal ( @t ) ;
|
|
|
794 |
@} ;
|
|
|
795 |
|
|
|
796 |
<literal_token> : ( id, a ) -> () = @{
|
|
|
797 |
add_token_literal ( @id, @a ) ;
|
|
|
798 |
@} ;
|
|
|
799 |
|
|
|
800 |
<literal_star> : ( a ) -> () = @{
|
|
|
801 |
add_token_literal ( NULL_id, @a ) ;
|
|
|
802 |
@} ;
|
|
|
803 |
|
|
|
804 |
|
|
|
805 |
/*
|
|
|
806 |
CHECKING SCOPE PRAGMA DIRECTIVES
|
|
|
807 |
|
|
|
808 |
The following rules are concerned with processing those '#pragma'
|
|
|
809 |
directives concerned with defining error checking scopes.
|
|
|
810 |
*/
|
|
|
811 |
|
|
|
812 |
<check_begin> : ( id ) -> () = @{
|
|
|
813 |
begin_option ( @id ) ;
|
|
|
814 |
@} ;
|
|
|
815 |
|
|
|
816 |
<check_end> : () -> () = @{
|
|
|
817 |
end_option ( 1 ) ;
|
|
|
818 |
@} ;
|
|
|
819 |
|
|
|
820 |
<check_directory> : ( dir, id ) -> () = @{
|
|
|
821 |
directory_option ( @dir, @id ) ;
|
|
|
822 |
@} ;
|
|
|
823 |
|
|
|
824 |
<check_use> : ( id, e ) -> () = @{
|
|
|
825 |
use_option ( @id, @e ) ;
|
|
|
826 |
@} ;
|
|
|
827 |
|
|
|
828 |
<decl_block_begin> : ( id ) -> () = @{
|
|
|
829 |
begin_decl_block ( @id ) ;
|
|
|
830 |
@} ;
|
|
|
831 |
|
|
|
832 |
<decl_block_end> : () -> () = @{
|
|
|
833 |
IGNORE end_decl_block ( NULL_id, 1 ) ;
|
|
|
834 |
@} ;
|
|
|
835 |
|
|
|
836 |
|
|
|
837 |
/*
|
|
|
838 |
ERROR PRAGMA DIRECTIVES
|
|
|
839 |
|
|
|
840 |
The following rules are concerned with processing those '#pragma'
|
|
|
841 |
directives concerned with error messages.
|
|
|
842 |
*/
|
|
|
843 |
|
|
|
844 |
<error_number> : ( e ) -> ( n ) = @{
|
|
|
845 |
STRING s = DEREF_str ( exp_string_lit_str ( @e ) ) ;
|
|
|
846 |
@n = find_error_no ( s, 0 ) ;
|
|
|
847 |
if ( @n == -1 ) {
|
|
|
848 |
report ( preproc_loc, ERR_pragma_error_bad ( s ) ) ;
|
|
|
849 |
}
|
|
|
850 |
@} ;
|
|
|
851 |
|
|
|
852 |
<option_number> : ( e ) -> ( n ) = @{
|
|
|
853 |
STRING s = DEREF_str ( exp_string_lit_str ( @e ) ) ;
|
|
|
854 |
@n = find_option_no ( s, 0 ) ;
|
|
|
855 |
if ( @n == -1 ) {
|
|
|
856 |
report ( preproc_loc, ERR_pragma_option_bad ( s ) ) ;
|
|
|
857 |
}
|
|
|
858 |
@} ;
|
|
|
859 |
|
|
|
860 |
<option_value_number> : ( e ) -> ( n ) = @{
|
|
|
861 |
STRING s = DEREF_str ( exp_string_lit_str ( @e ) ) ;
|
|
|
862 |
@n = find_value_no ( s, 0 ) ;
|
|
|
863 |
if ( @n == -1 ) {
|
|
|
864 |
report ( preproc_loc, ERR_pragma_option_bad ( s ) ) ;
|
|
|
865 |
}
|
|
|
866 |
@} ;
|
|
|
867 |
|
|
|
868 |
<error_on> : () -> ( e ) = @{ @e = ( unsigned ) OPTION_ON ; @} ;
|
|
|
869 |
<error_off> : () -> ( e ) = @{ @e = ( unsigned ) OPTION_OFF ; @} ;
|
|
|
870 |
<error_warning> : () -> ( e ) = @{ @e = ( unsigned ) OPTION_WARN ; @} ;
|
|
|
871 |
|
|
|
872 |
<error_state> : ( n, e ) -> () = @{
|
|
|
873 |
set_error_sev ( @n, @e ) ;
|
|
|
874 |
@} ;
|
|
|
875 |
|
|
|
876 |
<error_use> : ( n ) -> () = @{
|
|
|
877 |
if ( @n >= 0 ) {
|
|
|
878 |
no_error_args = 1 ;
|
|
|
879 |
report ( crt_loc, make_error ( @n ) ) ;
|
|
|
880 |
no_error_args = 0 ;
|
|
|
881 |
}
|
|
|
882 |
@} ;
|
|
|
883 |
|
|
|
884 |
|
|
|
885 |
/*
|
|
|
886 |
TYPE PRAGMA DIRECTIVES
|
|
|
887 |
|
|
|
888 |
The following rules are concerned with processing those '#pragma'
|
|
|
889 |
directives concerned with types.
|
|
|
890 |
*/
|
|
|
891 |
|
|
|
892 |
<type_argument> : ( s, t ) -> () = @{
|
|
|
893 |
accept_argument ( @s, @t ) ;
|
|
|
894 |
@} ;
|
|
|
895 |
|
|
|
896 |
<type_ellipsis> : ( t ) -> () = @{
|
|
|
897 |
accept_ellipsis ( @t ) ;
|
|
|
898 |
@} ;
|
|
|
899 |
|
|
|
900 |
<type_char_lit> : ( t ) -> () = @{
|
|
|
901 |
set_char_lit ( @t ) ;
|
|
|
902 |
@} ;
|
|
|
903 |
|
|
|
904 |
<type_char_sign> : ( bt ) -> () = @{
|
|
|
905 |
set_char_sign ( @bt ) ;
|
|
|
906 |
@} ;
|
|
|
907 |
|
|
|
908 |
<type_string_lit> : ( cv ) -> () = @{
|
|
|
909 |
set_string_qual ( @cv ) ;
|
|
|
910 |
@} ;
|
|
|
911 |
|
|
|
912 |
<type_long_long> : ( b ) -> () = @{
|
|
|
913 |
set_long_long_type ( @b ) ;
|
|
|
914 |
@} ;
|
|
|
915 |
|
|
|
916 |
<type_compatible> : ( s, t, e ) -> () = @{
|
|
|
917 |
set_compatible_type ( @s, @t, @e ) ;
|
|
|
918 |
@} ;
|
|
|
919 |
|
|
|
920 |
<type_compute> : ( id ) -> () = @{
|
|
|
921 |
compute_promote_type ( @id ) ;
|
|
|
922 |
@} ;
|
|
|
923 |
|
|
|
924 |
<type_promote> : ( s, t ) -> () = @{
|
|
|
925 |
set_promote_type ( @s, @t, ntype_ellipsis ) ;
|
|
|
926 |
@} ;
|
|
|
927 |
|
|
|
928 |
<type_builtin> : ( bt, t ) -> () = @{
|
|
|
929 |
set_builtin_type ( @bt, @t ) ;
|
|
|
930 |
@} ;
|
|
|
931 |
|
|
|
932 |
<type_special> : ( id, t ) -> () = @{
|
|
|
933 |
typedef_special ( @id, @t ) ;
|
|
|
934 |
@} ;
|
|
|
935 |
|
|
|
936 |
<nspace_std> : ( id ) -> () = @{
|
|
|
937 |
set_std_namespace ( @id ) ;
|
|
|
938 |
@} ;
|
|
|
939 |
|
|
|
940 |
<type_bottom> : () -> ( t ) = @{ @t = type_bottom ; @} ;
|
|
|
941 |
<type_printf> : () -> ( t ) = @{ @t = type_printf ; @} ;
|
|
|
942 |
<type_scanf> : () -> ( t ) = @{ @t = type_scanf ; @} ;
|
|
|
943 |
<type_wprintf> : () -> ( t ) = @{ @t = type_wprintf ; @} ;
|
|
|
944 |
<type_wscanf> : () -> ( t ) = @{ @t = type_wscanf ; @} ;
|
|
|
945 |
<type_ptrdiff_t> : () -> ( t ) = @{ @t = type_ptrdiff_t ; @} ;
|
|
|
946 |
<type_size_t> : () -> ( t ) = @{ @t = type_size_t ; @} ;
|
|
|
947 |
<type_wchar_t> : () -> ( t ) = @{ @t = type_wchar_t ; @} ;
|
|
|
948 |
|
|
|
949 |
|
|
|
950 |
/*
|
|
|
951 |
KEYWORD PRAGMA DIRECTIVES
|
|
|
952 |
|
|
|
953 |
The following rules are concerned with processing those '#pragma'
|
|
|
954 |
directives concerned with keywords.
|
|
|
955 |
*/
|
|
|
956 |
|
|
|
957 |
<keyword_spec> : ( id ) -> ( t ) = @{
|
|
|
958 |
@t = find_keyword ( @id ) ;
|
|
|
959 |
@} ;
|
|
|
960 |
|
|
|
961 |
<keyword_define> : ( id, t ) -> () = @{
|
|
|
962 |
define_keyword ( @id, @t ) ;
|
|
|
963 |
@} ;
|
|
|
964 |
|
|
|
965 |
<keyword_undef> : ( id ) -> () = @{
|
|
|
966 |
undef_keyword ( @id ) ;
|
|
|
967 |
@} ;
|
|
|
968 |
|
|
|
969 |
|
|
|
970 |
/*
|
|
|
971 |
CHARACTER PRAGMA DIRECTIVES
|
|
|
972 |
|
|
|
973 |
The following rules are concerned with processing those '#pragma'
|
|
|
974 |
directives concerned with characters.
|
|
|
975 |
*/
|
|
|
976 |
|
|
|
977 |
<char_set> : ( a, b ) -> () = @{
|
|
|
978 |
set_character ( @a, @b ) ;
|
|
|
979 |
@} ;
|
|
|
980 |
|
|
|
981 |
<escape_set> : ( a, b ) -> () = @{
|
|
|
982 |
set_escape ( @a, @b ) ;
|
|
|
983 |
@} ;
|
|
|
984 |
|
|
|
985 |
|
|
|
986 |
/*
|
|
|
987 |
CAST PRAGMA DIRECTIVES
|
|
|
988 |
|
|
|
989 |
The following rules are concerned with processing those '#pragma'
|
|
|
990 |
directives concerned with explicit casts.
|
|
|
991 |
*/
|
|
|
992 |
|
|
|
993 |
<cast_static> : () -> ( c ) = @{ @c = CAST_STATIC ; @} ;
|
|
|
994 |
<cast_reinterp> : () -> ( c ) = @{ @c = CAST_REINTERP ; @} ;
|
|
|
995 |
<cast_const> : () -> ( c ) = @{ @c = CAST_CONST ; @} ;
|
|
|
996 |
<cast_explicit> : () -> ( c ) = @{ @c = CAST_EXPLICIT ; @} ;
|
|
|
997 |
<cast_join> : ( a, b ) -> ( c ) = @{ @c = ( @a | @b ) ; @} ;
|
|
|
998 |
|
|
|
999 |
|
|
|
1000 |
/*
|
|
|
1001 |
OPTION PRAGMA DIRECTIVES
|
|
|
1002 |
|
|
|
1003 |
The following rules are concerned with processing those '#pragma'
|
|
|
1004 |
directives concerned with setting options.
|
|
|
1005 |
*/
|
|
|
1006 |
|
|
|
1007 |
<analysis_state> : ( n, e ) -> () = @{
|
|
|
1008 |
set_option ( @n, @e ) ;
|
|
|
1009 |
@} ;
|
|
|
1010 |
|
|
|
1011 |
<analysis_value> : ( n, v ) -> () = @{
|
|
|
1012 |
set_value ( @n, NULL_exp, ( unsigned long ) @v ) ;
|
|
|
1013 |
@} ;
|
|
|
1014 |
|
|
|
1015 |
<analysis_exp> : ( n, e ) -> () = @{
|
|
|
1016 |
set_value ( @n, @e, ( unsigned long ) 0 ) ;
|
|
|
1017 |
@} ;
|
|
|
1018 |
|
|
|
1019 |
<analysis_linkage> : ( a ) -> () = @{
|
|
|
1020 |
set_link_opt ( @a ) ;
|
|
|
1021 |
@} ;
|
|
|
1022 |
|
|
|
1023 |
<opt_on> : () -> ( n ) = @{ @n = OPT_error ; @} ;
|
|
|
1024 |
<opt_off> : () -> ( n ) = @{ @n = OPT_none ; @} ;
|
|
|
1025 |
<opt_warning> : () -> ( n ) = @{ @n = OPT_warning ; @} ;
|
|
|
1026 |
<opt_bitf_overflow> : () -> ( n ) = @{ @n = OPT_bitf_overflow ; @} ;
|
|
|
1027 |
<opt_bitf_type> : () -> ( n ) = @{ @n = OPT_bitf_type ; @} ;
|
|
|
1028 |
<opt_bool_assign> : () -> ( n ) = @{ @n = OPT_bool_assign ; @} ;
|
|
|
1029 |
<opt_case_fall> : () -> ( n ) = @{ @n = OPT_case_fall ; @} ;
|
|
|
1030 |
<opt_cast_explicit> : () -> ( n ) = @{ @n = OPT_cast_explicit ; @} ;
|
|
|
1031 |
<opt_comma_extra> : () -> ( n ) = @{ @n = OPT_comma_extra ; @} ;
|
|
|
1032 |
<opt_complete_struct> : () -> ( n ) = @{ @n = OPT_complete_struct ; @} ;
|
|
|
1033 |
<opt_concat_string> : () -> ( n ) = @{ @n = OPT_concat_string ; @} ;
|
|
|
1034 |
<opt_cond_lvalue> : () -> ( n ) = @{ @n = OPT_cond_lvalue ; @} ;
|
|
|
1035 |
<opt_const_cond> : () -> ( n ) = @{ @n = OPT_const_cond ; @} ;
|
|
|
1036 |
<opt_const_internal> : () -> ( n ) = @{ @n = OPT_const_internal ; @} ;
|
|
|
1037 |
<opt_const_string> : () -> ( n ) = @{ @n = OPT_const_string ; @} ;
|
|
|
1038 |
<opt_conv> : () -> ( n ) = @{ @n = OPT_conv ; @} ;
|
|
|
1039 |
<opt_conv_int_enum> : () -> ( n ) = @{ @n = OPT_conv_int_enum ; @} ;
|
|
|
1040 |
<opt_conv_int_int> : () -> ( n ) = @{ @n = OPT_conv_int_int ; @} ;
|
|
|
1041 |
<opt_conv_int_int_expl> : () -> ( n ) = @{ @n = OPT_conv_int_int_expl ; @} ;
|
|
|
1042 |
<opt_conv_int_int_impl> : () -> ( n ) = @{ @n = OPT_conv_int_int_impl ; @} ;
|
|
|
1043 |
<opt_conv_int_ptr> : () -> ( n ) = @{ @n = OPT_conv_int_ptr ; @} ;
|
|
|
1044 |
<opt_conv_int_ptr_expl> : () -> ( n ) = @{ @n = OPT_conv_int_ptr_expl ; @} ;
|
|
|
1045 |
<opt_conv_int_ptr_impl> : () -> ( n ) = @{ @n = OPT_conv_int_ptr_impl ; @} ;
|
|
|
1046 |
<opt_conv_ptr_func> : () -> ( n ) = @{ @n = OPT_conv_ptr_func ; @} ;
|
|
|
1047 |
<opt_conv_ptr_ptr> : () -> ( n ) = @{ @n = OPT_conv_ptr_ptr ; @} ;
|
|
|
1048 |
<opt_conv_ptr_ptr_expl> : () -> ( n ) = @{ @n = OPT_conv_ptr_ptr_expl ; @} ;
|
|
|
1049 |
<opt_conv_ptr_ptr_impl> : () -> ( n ) = @{ @n = OPT_conv_ptr_ptr_impl ; @} ;
|
|
|
1050 |
<opt_conv_ptr_ptr_void> : () -> ( n ) = @{ @n = OPT_conv_ptr_ptr_void ; @} ;
|
|
|
1051 |
<opt_conv_ptr_void_ptr> : () -> ( n ) = @{ @n = OPT_conv_ptr_void_ptr ; @} ;
|
|
|
1052 |
<opt_decl_cond> : () -> ( n ) = @{ @n = OPT_decl_cond ; @} ;
|
|
|
1053 |
<opt_decl_hide> : () -> ( n ) = @{ @n = OPT_decl_hide ; @} ;
|
|
|
1054 |
<opt_decl_none> : () -> ( n ) = @{ @n = OPT_decl_none ; @} ;
|
|
|
1055 |
<opt_decl_struct_anon> : () -> ( n ) = @{ @n = OPT_decl_struct_anon ; @} ;
|
|
|
1056 |
<opt_decl_unify> : () -> ( n ) = @{ @n = OPT_decl_unify ; @} ;
|
|
|
1057 |
<opt_decl_volatile> : () -> ( n ) = @{ @n = OPT_decl_volatile ; @} ;
|
|
|
1058 |
<opt_discard> : () -> ( n ) = @{ @n = OPT_discard ; @} ;
|
|
|
1059 |
<opt_discard_func> : () -> ( n ) = @{ @n = OPT_discard_func ; @} ;
|
|
|
1060 |
<opt_discard_static> : () -> ( n ) = @{ @n = OPT_discard_static ; @} ;
|
|
|
1061 |
<opt_discard_value> : () -> ( n ) = @{ @n = OPT_discard_value ; @} ;
|
|
|
1062 |
<opt_dollar_ident> : () -> ( n ) = @{ @n = OPT_dollar_ident ; @} ;
|
|
|
1063 |
<opt_dspec_none> : () -> ( n ) = @{ @n = OPT_dspec_none ; @} ;
|
|
|
1064 |
<opt_dspec_none_func> : () -> ( n ) = @{ @n = OPT_dspec_none_func ; @} ;
|
|
|
1065 |
<opt_ellipsis_extra> : () -> ( n ) = @{ @n = OPT_ellipsis_extra ; @} ;
|
|
|
1066 |
<opt_ellipsis_ident> : () -> ( n ) = @{ @n = OPT_ellipsis_ident ; @} ;
|
|
|
1067 |
<opt_empty_body> : () -> ( n ) = @{ @n = OPT_empty_body ; @} ;
|
|
|
1068 |
<opt_enum_decl> : () -> ( n ) = @{ @n = OPT_enum_decl ; @} ;
|
|
|
1069 |
<opt_enum_switch> : () -> ( n ) = @{ @n = OPT_enum_switch ; @} ;
|
|
|
1070 |
<opt_eof_nline> : () -> ( n ) = @{ @n = OPT_eof_nline ; @} ;
|
|
|
1071 |
<opt_escape_overflow> : () -> ( n ) = @{ @n = OPT_escape_overflow ; @} ;
|
|
|
1072 |
<opt_escape_unknown> : () -> ( n ) = @{ @n = OPT_escape_unknown ; @} ;
|
|
|
1073 |
<opt_for_scope> : () -> ( n ) = @{ @n = OPT_for_scope ; @} ;
|
|
|
1074 |
<opt_func_block> : () -> ( n ) = @{ @n = OPT_func_block ; @} ;
|
|
|
1075 |
<opt_func_impl> : () -> ( n ) = @{ @n = OPT_func_impl ; @} ;
|
|
|
1076 |
<opt_func_incompat> : () -> ( n ) = @{ @n = OPT_func_incompat ; @} ;
|
|
|
1077 |
<opt_func_linkage> : () -> ( n ) = @{ @n = OPT_func_linkage ; @} ;
|
|
|
1078 |
<opt_func_proto> : () -> ( n ) = @{ @n = OPT_func_proto ; @} ;
|
|
|
1079 |
<opt_func_ret_void> : () -> ( n ) = @{ @n = OPT_func_ret_void ; @} ;
|
|
|
1080 |
<opt_func_token_undef> : () -> ( n ) = @{ @n = OPT_func_token_undef ; @} ;
|
|
|
1081 |
<opt_func_weak> : () -> ( n ) = @{ @n = OPT_func_weak ; @} ;
|
|
|
1082 |
<opt_hash_ident> : () -> ( n ) = @{ @n = OPT_hash_ident ; @} ;
|
|
|
1083 |
<opt_infer_int> : () -> ( n ) = @{ @n = OPT_infer_int ; @} ;
|
|
|
1084 |
<opt_infer_int_cv> : () -> ( n ) = @{ @n = OPT_infer_int_cv ; @} ;
|
|
|
1085 |
<opt_include_full> : () -> ( n ) = @{ @n = OPT_include_full ; @} ;
|
|
|
1086 |
<opt_init_aggregate> : () -> ( n ) = @{ @n = OPT_init_aggregate ; @} ;
|
|
|
1087 |
<opt_init_dynamic> : () -> ( n ) = @{ @n = OPT_init_dynamic ; @} ;
|
|
|
1088 |
<opt_init_struct> : () -> ( n ) = @{ @n = OPT_init_struct ; @} ;
|
|
|
1089 |
<opt_inline_internal> : () -> ( n ) = @{ @n = OPT_inline_internal ; @} ;
|
|
|
1090 |
<opt_interf_incompat> : () -> ( n ) = @{ @n = OPT_interf_incompat ; @} ;
|
|
|
1091 |
<opt_int_operator> : () -> ( n ) = @{ @n = OPT_int_operator ; @} ;
|
|
|
1092 |
<opt_int_overflow> : () -> ( n ) = @{ @n = OPT_int_overflow ; @} ;
|
|
|
1093 |
<opt_link_incompat> : () -> ( n ) = @{ @n = OPT_link_incompat ; @} ;
|
|
|
1094 |
<opt_link_internal> : () -> ( n ) = @{ @n = OPT_link_internal ; @} ;
|
|
|
1095 |
<opt_link_resolve> : () -> ( n ) = @{ @n = OPT_link_resolve ; @} ;
|
|
|
1096 |
<opt_longlong> : () -> ( n ) = @{ @n = OPT_longlong ; @} ;
|
|
|
1097 |
<opt_macro_arg_dir> : () -> ( n ) = @{ @n = OPT_macro_arg_dir ; @} ;
|
|
|
1098 |
<opt_macro_redef> : () -> ( n ) = @{ @n = OPT_macro_redef ; @} ;
|
|
|
1099 |
<opt_macro_weak> : () -> ( n ) = @{ @n = OPT_macro_weak ; @} ;
|
|
|
1100 |
<opt_member_incompat> : () -> ( n ) = @{ @n = OPT_member_incompat ; @} ;
|
|
|
1101 |
<opt_name_limit> : () -> ( n ) = @{ @n = OPT_name_limit ; @} ;
|
|
|
1102 |
<opt_nest_comment> : () -> ( n ) = @{ @n = OPT_nest_comment ; @} ;
|
|
|
1103 |
<opt_overload_ambig> : () -> ( n ) = @{ @n = OPT_overload_ambig ; @} ;
|
|
|
1104 |
<opt_overload_dep> : () -> ( n ) = @{ @n = OPT_overload_dep ; @} ;
|
|
|
1105 |
<opt_overload_res> : () -> ( n ) = @{ @n = OPT_overload_res ; @} ;
|
|
|
1106 |
<opt_overload_strict> : () -> ( n ) = @{ @n = OPT_overload_strict ; @} ;
|
|
|
1107 |
<opt_param_impl> : () -> ( n ) = @{ @n = OPT_param_impl ; @} ;
|
|
|
1108 |
<opt_paren> : () -> ( n ) = @{ @n = OPT_paren ; @} ;
|
|
|
1109 |
<opt_ppdir_id> : () -> ( n ) = @{ @n = OPT_ppdir_id ; @} ;
|
|
|
1110 |
<opt_ppdir_indent> : () -> ( n ) = @{ @n = OPT_ppdir_indent ; @} ;
|
|
|
1111 |
<opt_ppdir_indent_dir> : () -> ( n ) = @{ @n = OPT_ppdir_indent_dir ; @} ;
|
|
|
1112 |
<opt_ppdir_text> : () -> ( n ) = @{ @n = OPT_ppdir_text ; @} ;
|
|
|
1113 |
<opt_ppdir_unknown> : () -> ( n ) = @{ @n = OPT_ppdir_unknown ; @} ;
|
|
|
1114 |
<opt_pragma_unknown> : () -> ( n ) = @{ @n = OPT_pragma_unknown ; @} ;
|
|
|
1115 |
<opt_ptr_operator> : () -> ( n ) = @{ @n = OPT_ptr_operator ; @} ;
|
|
|
1116 |
<opt_reached> : () -> ( n ) = @{ @n = OPT_reached ; @} ;
|
|
|
1117 |
<opt_semicolon_extra> : () -> ( n ) = @{ @n = OPT_semicolon_extra ; @} ;
|
|
|
1118 |
<opt_templ_export> : () -> ( n ) = @{ @n = OPT_templ_export ; @} ;
|
|
|
1119 |
<opt_this_lvalue> : () -> ( n ) = @{ @n = OPT_this_lvalue ; @} ;
|
|
|
1120 |
<opt_throw_bad> : () -> ( n ) = @{ @n = OPT_throw_bad ; @} ;
|
|
|
1121 |
<opt_token_const> : () -> ( n ) = @{ @n = OPT_token_const ; @} ;
|
|
|
1122 |
<opt_token_redef> : () -> ( n ) = @{ @n = OPT_token_redef ; @} ;
|
|
|
1123 |
<opt_token_undef> : () -> ( n ) = @{ @n = OPT_token_undef ; @} ;
|
|
|
1124 |
<opt_type_obj_incompl> : () -> ( n ) = @{ @n = OPT_type_obj_incompl ; @} ;
|
|
|
1125 |
<opt_type_qual_incompat> : () -> ( n ) = @{ @n = OPT_type_qual_incompat ; @} ;
|
|
|
1126 |
<opt_type_redef> : () -> ( n ) = @{ @n = OPT_type_redef ; @} ;
|
|
|
1127 |
<opt_type_tag_ignore> : () -> ( n ) = @{ @n = OPT_type_tag_ignore ; @} ;
|
|
|
1128 |
<opt_unmatched> : () -> ( n ) = @{ @n = OPT_unmatched ; @} ;
|
|
|
1129 |
<opt_variable> : () -> ( n ) = @{ @n = OPT_variable ; @} ;
|
|
|
1130 |
<opt_wall> : () -> ( n ) = @{ @n = OPT_wall ; @} ;
|
|
|
1131 |
<opt_weak> : () -> ( n ) = @{ @n = OPT_weak ; @} ;
|
|
|
1132 |
|
|
|
1133 |
<opt_val_cast_explicit> : () -> ( n ) = @{ @n = OPT_VAL_cast_explicit ; @} ;
|
|
|
1134 |
<opt_val_include_depth> : () -> ( n ) = @{ @n = OPT_VAL_include_depth ; @} ;
|
|
|
1135 |
<opt_val_maximum_error> : () -> ( n ) = @{ @n = OPT_VAL_maximum_error ; @} ;
|
|
|
1136 |
<opt_val_name_limit> : () -> ( n ) = @{ @n = OPT_VAL_name_limit ; @} ;
|
|
|
1137 |
|
|
|
1138 |
<opt_ppdir_assert> : () -> ( n, m ) = @{
|
|
|
1139 |
@n = OPT_ppdir_assert ;
|
|
|
1140 |
@m = OPT_ppdir_assert_ignore ;
|
|
|
1141 |
@} ;
|
|
|
1142 |
|
|
|
1143 |
<opt_ppdir_file> : () -> ( n, m ) = @{
|
|
|
1144 |
@n = OPT_ppdir_file ;
|
|
|
1145 |
@m = OPT_ppdir_file_ignore ;
|
|
|
1146 |
@} ;
|
|
|
1147 |
|
|
|
1148 |
<opt_ppdir_ident> : () -> ( n, m ) = @{
|
|
|
1149 |
@n = OPT_ppdir_ident ;
|
|
|
1150 |
@m = OPT_ppdir_ident_ignore ;
|
|
|
1151 |
@} ;
|
|
|
1152 |
|
|
|
1153 |
<opt_ppdir_import> : () -> ( n, m ) = @{
|
|
|
1154 |
@n = OPT_ppdir_import ;
|
|
|
1155 |
@m = OPT_ppdir_import_ignore ;
|
|
|
1156 |
@} ;
|
|
|
1157 |
|
|
|
1158 |
<opt_ppdir_unassert> : () -> ( n, m ) = @{
|
|
|
1159 |
@n = OPT_ppdir_unassert ;
|
|
|
1160 |
@m = OPT_ppdir_unassert_ignore ;
|
|
|
1161 |
@} ;
|
|
|
1162 |
|
|
|
1163 |
<opt_ppdir_warning> : () -> ( n, m ) = @{
|
|
|
1164 |
@n = OPT_ppdir_warning ;
|
|
|
1165 |
@m = OPT_ppdir_warning_ignore ;
|
|
|
1166 |
@} ;
|
|
|
1167 |
|
|
|
1168 |
<opt_ppdir_weak> : () -> ( n, m ) = @{
|
|
|
1169 |
@n = OPT_ppdir_weak ;
|
|
|
1170 |
@m = OPT_ppdir_weak_ignore ;
|
|
|
1171 |
@} ;
|
|
|
1172 |
|
|
|
1173 |
|
|
|
1174 |
/*
|
|
|
1175 |
ERROR REPORTING
|
|
|
1176 |
|
|
|
1177 |
These actions describe the error reporting functions for syntax errors
|
|
|
1178 |
and for weeding out extra constructs which have been allowed in the
|
|
|
1179 |
grammar to permit for better error reporting.
|
|
|
1180 |
*/
|
|
|
1181 |
|
|
|
1182 |
<error_syntax> : () -> () = @{
|
|
|
1183 |
/* Syntax errors */
|
|
|
1184 |
ERROR err = ERR_lex_parse ( crt_token ) ;
|
|
|
1185 |
report ( crt_loc, err ) ;
|
|
|
1186 |
have_syntax_error = 1 ;
|
|
|
1187 |
@} ;
|
|
|
1188 |
|
|
|
1189 |
<error_comma> : () -> () = @{
|
|
|
1190 |
/* Extra comma at the end of a list */
|
|
|
1191 |
report ( crt_loc, ERR_lex_extra_comma () ) ;
|
|
|
1192 |
@} ;
|
|
|
1193 |
|
|
|
1194 |
|
|
|
1195 |
/*
|
|
|
1196 |
PREDICATE LITERALS
|
|
|
1197 |
|
|
|
1198 |
These actions give the basic values, true and false, for the type
|
|
|
1199 |
BOOL.
|
|
|
1200 |
*/
|
|
|
1201 |
|
|
|
1202 |
<bool_false> : () -> ( b ) = @{ @b = 0 ; @} ;
|
|
|
1203 |
<bool_true> : () -> ( b ) = @{ @b = 1 ; @} ;
|
|
|
1204 |
|
|
|
1205 |
|
|
|
1206 |
/*
|
|
|
1207 |
PARSER HACKS AND PATCHES
|
|
|
1208 |
|
|
|
1209 |
In a couple of places it is necessary to fool the parser by changing
|
|
|
1210 |
the next token (or even inserting an extra token) depending on the
|
|
|
1211 |
current state.
|
|
|
1212 |
*/
|
|
|
1213 |
|
|
|
1214 |
<rescan_id> : () -> () = @{
|
|
|
1215 |
int t = crt_lex_token ;
|
|
|
1216 |
if ( t >= FIRST_KEYWORD && t <= LAST_KEYWORD ) {
|
|
|
1217 |
crt_lex_token = lex_identifier ;
|
|
|
1218 |
}
|
|
|
1219 |
@} ;
|
|
|
1220 |
|
|
|
1221 |
<rescan_keyword> : () -> () = @{
|
|
|
1222 |
int t = crt_lex_token ;
|
|
|
1223 |
if ( t == lex_identifier || t == lex_type_Hname ||
|
|
|
1224 |
t == lex_namespace_Hname || t == lex_statement_Hname ) {
|
|
|
1225 |
t = find_hashid ( crt_token->pp_data.id.hash ) ;
|
|
|
1226 |
crt_lex_token = t ;
|
|
|
1227 |
}
|
|
|
1228 |
@} ;
|
|
|
1229 |
|
|
|
1230 |
<rescan_line> : () -> () = @{
|
|
|
1231 |
rescan_pragma ( lex_unknown ) ;
|
|
|
1232 |
RESCAN_LEXER ;
|
|
|
1233 |
@} ;
|
|
|
1234 |
|
|
|
1235 |
<rescan_allow_line> : () -> () = @{
|
|
|
1236 |
rescan_pragma ( lex_allow ) ;
|
|
|
1237 |
RESCAN_LEXER ;
|
|
|
1238 |
@} ;
|
|
|
1239 |
|
|
|
1240 |
<rescan_as_line> : () -> () = @{
|
|
|
1241 |
rescan_pragma ( lex_as ) ;
|
|
|
1242 |
RESCAN_LEXER ;
|
|
|
1243 |
@} ;
|
|
|
1244 |
|
|
|
1245 |
<rescan_tag_line> : () -> () = @{
|
|
|
1246 |
int t = crt_lex_token ;
|
|
|
1247 |
if ( t >= FIRST_KEYWORD && t <= LAST_KEYWORD ) {
|
|
|
1248 |
if ( t != lex_tag_Hcap && !predict_operator () ) {
|
|
|
1249 |
crt_lex_token = lex_identifier ;
|
|
|
1250 |
}
|
|
|
1251 |
}
|
|
|
1252 |
@} ;
|
|
|
1253 |
|
|
|
1254 |
|
|
|
1255 |
/*
|
|
|
1256 |
FILE TRAILERS
|
|
|
1257 |
|
|
|
1258 |
These trailers are appended to the parser definition and declaration
|
|
|
1259 |
output files.
|
|
|
1260 |
*/
|
|
|
1261 |
|
|
|
1262 |
%trailer% @{
|
|
|
1263 |
@}, @{
|
|
|
1264 |
|
|
|
1265 |
|
|
|
1266 |
/*
|
|
|
1267 |
DUMMY LEXICAL TOKEN VALUES
|
|
|
1268 |
|
|
|
1269 |
These values are used as lexical token values in certain circumstances
|
|
|
1270 |
but do not represent actual tokens. Note that they are all negative.
|
|
|
1271 |
*/
|
|
|
1272 |
|
|
|
1273 |
#define lex_ignore_token -1
|
|
|
1274 |
#define lex_end_condition -2
|
|
|
1275 |
#define lex_included -3
|
|
|
1276 |
|
|
|
1277 |
|
|
|
1278 |
#endif
|
|
|
1279 |
@} ;
|