1 %{
2 /*---------------------------------------------------------------------------*
3 Project: NitroSDK - tools - makelcf
4 File: tlcf.y
5
6 Copyright 2003-2008 Nintendo. All rights reserved.
7
8 These coded instructions, statements, and computer programs contain
9 proprietary information of Nintendo of America Inc. and/or Nintendo
10 Company Ltd., and are protected by Federal copyright law. They may
11 not be disclosed to third parties or copied or duplicated in any form,
12 in whole or in part, without the prior written consent of Nintendo.
13
14 $Log: tlcf.y,v $
15 Revision 1.23 2007/07/09 12:17:54 yasu
16 Support for TARGET_NAME
17
18 Revision 1.22 2007/07/09 07:02:00 yasu
19 Support for IF.EXIST
20
21 Revision 1.21 2007/04/12 03:29:45 yasu
22 Revised such that IF FIRST/LAST can also support FOREACH OBJECT/LIBRARY
23
24 Revision 1.20 2007/04/10 14:13:20 yasu
25 Support for multiple uses of SEARCH_SYMBOL
26
27 Revision 1.19 2006/05/11 12:55:30 yasu
28 Halted warnings
29
30 Revision 1.18 2006/05/10 03:14:01 yasu
31 Corrected an error in the IF-ELSE-ENDIF conditional determination
32
33 Revision 1.17 2006/05/10 02:06:00 yasu
34 Added support for CodeWarrior 2.x
35
36 Revision 1.16 2006/03/30 23:59:45 yasu
37 Updated copyright year
38
39 Revision 1.15 2006/03/29 13:13:22 yasu
40 IF-ELSE-ENDIF support
41
42 Revision 1.14 2005/09/01 04:30:58 yasu
43 Support for Overlay Group
44
45 Revision 1.13 2005/08/26 11:23:11 yasu
46 Overlay support for ITCM/DTCM
47
48 Revision 1.12 2005/06/22 00:50:06 yasu
49 Updated copyright year
50
51 Revision 1.11 2005/06/20 12:21:48 yasu
52 Changed Surffix to Suffix
53
54 Revision 1.10 2004/07/10 04:06:17 yasu
55 Added support for command 'Library'
56 Support for modifier ':x' in template
57 Fixed line continue '\' issue
58
59 Revision 1.9 2004/07/02 07:34:53 yasu
60 Added support for OBJECT( )
61
62 Revision 1.8 2004/06/24 07:18:54 yasu
63 Support for keyword "Autoload"
64
65 Revision 1.7 2004/06/14 11:28:45 yasu
66 Support for section filter "FOREACH.STATIC.OBJECTS=.sectionName"
67
68 Revision 1.6 2004/02/13 07:13:03 yasu
69 Support for SDK_IRQ_STACKSIZE
70
71 Revision 1.5 2004/02/05 07:09:03 yasu
72 Changed SDK prefix from iris to nitro
73
74 Revision 1.4 2004/01/15 10:47:56 yasu
75 Implementation of a static StackSize
76
77 Revision 1.3 2004/01/14 12:38:08 yasu
78 Changed OverlayName to OverlayDefs
79
80 Revision 1.2 2004/01/07 13:10:17 yasu
81 Fixed all warnings at compile -Wall
82
83 Revision 1.1 2004/01/05 02:32:59 yasu
84 Initial version
85
86 $NoKeywords: $
87 *---------------------------------------------------------------------------*/
88 #include <stdio.h>
89 #include <string.h>
90 #include "makelcf.h"
91 #include "defval.h"
92
93 // IF-ELSE-ENDIF
94 static tCondStack cond_stack[COND_STACK_MAX];
95 static int cond_stack_level = 0;
96 static BOOL cond_valid = TRUE;
97 static tCondBlock cond_block = COND_BLOCK_NOCOND;
98
GetCompResult(const char * id,const char * comp,const char * value,BOOL * pvalid)99 static BOOL GetCompResult(const char* id, const char* comp, const char* value, BOOL* pvalid)
100 {
101 int result;
102 BOOL valid;
103 const char* defval;
104
105 defval = SearchDefValCleaned(id);
106 result = strcmp(defval, value);
107 if ( strcmp( comp, ".EQ." ) == 0 || strcmp( comp, "==" ) == 0 ) valid = ( result == 0 );
108 else if ( strcmp( comp, ".NE." ) == 0 || strcmp( comp, "!=" ) == 0 ) valid = ( result != 0 );
109 else if ( strcmp( comp, ".GT." ) == 0 ) valid = ( result > 0 );
110 else if ( strcmp( comp, ".GE." ) == 0 ) valid = ( result >= 0 );
111 else if ( strcmp( comp, ".LT." ) == 0 ) valid = ( result < 0 );
112 else if ( strcmp( comp, ".LE." ) == 0 ) valid = ( result <= 0 );
113 else
114 {
115 tlcf_yyerror( "Illegal IF-condition" );
116 return FALSE;
117 }
118 debug_printf("id(%s)=[%s] comp=[%s] value=[%s] valid=%d\n", id, defval, comp, value, valid);
119
120 *pvalid = valid;
121 return TRUE;
122 }
123
CondIf(const char * id,const char * comp,const char * value)124 static BOOL CondIf(const char* id, const char* comp, const char* value)
125 {
126 if (cond_stack_level >= COND_STACK_MAX)
127 {
128 tlcf_yyerror( "Too deep if-else-endif block" );
129 return FALSE;
130 }
131 cond_stack[cond_stack_level].block = cond_block;
132 cond_stack[cond_stack_level].valid = cond_valid;
133 cond_stack_level ++;
134 cond_block = COND_BLOCK_IF;
135
136 // Update validation only if previous level validation is TRUE
137 if (cond_stack[cond_stack_level-1].valid)
138 {
139 if (!GetCompResult(id, comp, value, &cond_valid))
140 {
141 tlcf_yyerror( "Unresolved IF condition" );
142 return FALSE;
143 }
144 }
145 return TRUE;
146 }
147
CondElse(void)148 static BOOL CondElse(void)
149 {
150 if (cond_block != COND_BLOCK_IF || cond_stack_level <= 0)
151 {
152 tlcf_yyerror( "IF-ELSE-ENDIF unmatched" );
153 return FALSE;
154 }
155 cond_block = COND_BLOCK_ELSE;
156
157 // Update validation only if previous level validation is TRUE
158 if (cond_stack[cond_stack_level-1].valid)
159 {
160 cond_valid = cond_valid ? FALSE : TRUE; // Flip validation
161 }
162 return TRUE;
163 }
164
CondEndIf(void)165 static BOOL CondEndIf(void)
166 {
167 if ((cond_block != COND_BLOCK_IF && cond_block != COND_BLOCK_ELSE) || cond_stack_level <= 0)
168 {
169 tlcf_yyerror( "IF-ELSE-ENDIF unmatched" );
170 return FALSE;
171 }
172 cond_stack_level --;
173 cond_block = cond_stack[cond_stack_level].block;
174 cond_valid = cond_stack[cond_stack_level].valid;
175 return TRUE;
176 }
177
178
179 // TOKEN HANDLING
180 tTokenBuffer tokenBuffer[TOKEN_LEN];
181 int tokenBufferEnd = 0;
182 static tLoopStack loop_stack[LOOP_STACK_MAX];
183 static int loop_stack_level = 0;
184
StoreToken(int id,const char * str)185 static BOOL StoreToken( int id, const char *str )
186 {
187 // Validation check for IF-ELSE-ENDIF
188 if ( !cond_valid ) return TRUE;
189
190 if ( tokenBufferEnd >= TOKEN_LEN )
191 {
192 tlcf_yyerror( "Out of token buffer" );
193 return FALSE;
194 }
195 tokenBuffer[tokenBufferEnd].id = id;
196 tokenBuffer[tokenBufferEnd].string = str;
197 tokenBufferEnd ++;
198 return TRUE;
199 }
200
PushLoopStack(int id,const char * sectionName)201 static BOOL PushLoopStack( int id, const char* sectionName )
202 {
203 // Validation check for IF-ELSE-ENDIF
204 if ( !cond_valid ) return TRUE;
205
206 if ( loop_stack_level >= LOOP_STACK_MAX )
207 {
208 tlcf_yyerror( "Out of stack level" );
209 return FALSE;
210 }
211 loop_stack[loop_stack_level].id = id;
212 loop_stack[loop_stack_level].start = tokenBufferEnd;
213 loop_stack_level ++;
214 return StoreToken( id, sectionName );
215 }
216
PopLoopStack(int id)217 static BOOL PopLoopStack( int id )
218 {
219 int start;
220
221 // Validation check for IF-ELSE-ENDIF
222 if ( !cond_valid ) return TRUE;
223
224 loop_stack_level --;
225 if ( loop_stack_level < 0 || id != loop_stack[loop_stack_level].id )
226 {
227 tlcf_yyerror( "Unmatched foreach-end" );
228 return FALSE;
229 }
230 start = loop_stack[loop_stack_level].start;
231 tokenBuffer[start].loop_end = tokenBufferEnd-1;
232
233 // Don't store 'END' token to TokenBuffer
234 return TRUE;
235 }
236
GetLoopStackLevel(void)237 BOOL GetLoopStackLevel( void )
238 {
239 return loop_stack_level;
240 }
241
242 %}
243
244 %union
245 {
246 char *string;
247 };
248
249 %token <string> tSTRING
250
251 %token <string> tTARGET_NAME
252 %token tSTATIC_NAME
253 %token tSTATIC_ADDRESS
254 %token tSTATIC_STACKSIZE
255 %token tSTATIC_IRQSTACKSIZE
256 %token <string> tSTATIC_OBJECT
257 %token <string> tSTATIC_LIBRARY
258 %token <string> tSTATIC_SEARCHSYMBOL
259 %token <string> tSTATIC_FORCE
260
261 %token <string> tFOREACH_STATIC_OBJECTS
262 %token <string> tFOREACH_STATIC_LIBRARIES
263 %token <string> tFOREACH_STATIC_SEARCHSYMBOLS
264 %token <string> tFOREACH_STATIC_FORCES
265 %token tEND_STATIC_OBJECTS
266 %token tEND_STATIC_LIBRARIES
267 %token tEND_STATIC_SEARCHSYMBOLS
268 %token tEND_STATIC_FORCES
269
270 %token <string> tIF_STATIC_OBJECT_FIRST
271 %token <string> tIF_STATIC_OBJECT_LAST
272 %token <string> tIF_STATIC_LIBRARY_FIRST
273 %token <string> tIF_STATIC_LIBRARY_LAST
274 %token <string> tIF_STATIC_SEARCHSYMBOL_FIRST
275 %token <string> tIF_STATIC_SEARCHSYMBOL_LAST
276 %token <string> tIF_STATIC_FORCE_FIRST
277 %token <string> tIF_STATIC_FORCE_LAST
278
279 %token tNUMBER_AUTOLOADS
280 %token tAUTOLOAD_ID
281 %token tAUTOLOAD_NAME
282 %token tAUTOLOAD_ADDRESS
283 %token <string> tAUTOLOAD_OBJECT
284 %token <string> tAUTOLOAD_LIBRARY
285 %token <string> tAUTOLOAD_SEARCHSYMBOL
286 %token <string> tAUTOLOAD_FORCE
287
288 %token <string> tFOREACH_AUTOLOADS
289 %token <string> tFOREACH_AUTOLOAD_OBJECTS
290 %token <string> tFOREACH_AUTOLOAD_LIBRARIES
291 %token <string> tFOREACH_AUTOLOAD_SEARCHSYMBOLS
292 %token <string> tFOREACH_AUTOLOAD_FORCES
293 %token tEND_AUTOLOADS
294 %token tEND_AUTOLOAD_OBJECTS
295 %token tEND_AUTOLOAD_LIBRARIES
296 %token tEND_AUTOLOAD_SEARCHSYMBOLS
297 %token tEND_AUTOLOAD_FORCES
298
299 %token <string> tIF_AUTOLOAD_FIRST
300 %token <string> tIF_AUTOLOAD_LAST
301 %token <string> tIF_AUTOLOAD_OBJECT_FIRST
302 %token <string> tIF_AUTOLOAD_OBJECT_LAST
303 %token <string> tIF_AUTOLOAD_LIBRARY_FIRST
304 %token <string> tIF_AUTOLOAD_LIBRARY_LAST
305 %token <string> tIF_AUTOLOAD_SEARCHSYMBOL_FIRST
306 %token <string> tIF_AUTOLOAD_SEARCHSYMBOL_LAST
307 %token <string> tIF_AUTOLOAD_FORCE_FIRST
308 %token <string> tIF_AUTOLOAD_FORCE_LAST
309
310 %token tNUMBER_OVERLAYS
311 %token tOVERLAY_ID
312 %token tOVERLAY_NAME
313 %token tOVERLAY_GROUP
314 %token tOVERLAY_ADDRESS
315 %token tOVERLAY_COMPRESS
316 %token <string> tOVERLAY_OBJECT
317 %token <string> tOVERLAY_LIBRARY
318 %token <string> tOVERLAY_SEARCHSYMBOL
319 %token <string> tOVERLAY_FORCE
320
321 %token <string> tFOREACH_OVERLAYS
322 %token <string> tFOREACH_OVERLAY_OBJECTS
323 %token <string> tFOREACH_OVERLAY_LIBRARIES
324 %token <string> tFOREACH_OVERLAY_SEARCHSYMBOLS
325 %token <string> tFOREACH_OVERLAY_FORCES
326 %token tEND_OVERLAYS
327 %token tEND_OVERLAY_OBJECTS
328 %token tEND_OVERLAY_LIBRARIES
329 %token tEND_OVERLAY_SEARCHSYMBOLS
330 %token tEND_OVERLAY_FORCES
331
332 %token <string> tIF_OVERLAY_FIRST
333 %token <string> tIF_OVERLAY_LAST
334 %token <string> tIF_OVERLAY_OBJECT_FIRST
335 %token <string> tIF_OVERLAY_OBJECT_LAST
336 %token <string> tIF_OVERLAY_LIBRARY_FIRST
337 %token <string> tIF_OVERLAY_LIBRARY_LAST
338 %token <string> tIF_OVERLAY_SEARCHSYMBOL_FIRST
339 %token <string> tIF_OVERLAY_SEARCHSYMBOL_LAST
340 %token <string> tIF_OVERLAY_FORCE_FIRST
341 %token <string> tIF_OVERLAY_FORCE_LAST
342
343 %token <string> tIF_EXIST_SECTION
344 %token <string> tIF_EXIST_STATIC
345 %token <string> tIF_EXIST_AUTOLOAD
346 %token <string> tIF_EXIST_OVERLAY
347
348 %token tPROPERTY_OVERLAYDEFS
349 %token tPROPERTY_OVERLAYTABLE
350 %token tPROPERTY_SUFFIX
351
352 %token tIF_OPEN
353 %token tIF_CLOSE
354 %token <string> tIF_ID
355 %token <string> tIF_COMP
356 %token <string> tIF_VALUE
357 %token tIF_ELSE
358 %token tIF_ENDIF
359 %%
360
361 /*=========================================================================*
362 ConfigFile
363 *=========================================================================*/
364
365 tlcfFile : tokens
366 ;
367
368 tokens : /*NULL*/
369 | tokens token
370 ;
371
372 token : tSTRING { if (!StoreToken( tSTRING, $1 )) YYABORT; }
373 | tTARGET_NAME { if (!StoreToken( tTARGET_NAME, $1 )) YYABORT; }
374 | tSTATIC_NAME { if (!StoreToken( tSTATIC_NAME, NULL )) YYABORT; }
375 | tSTATIC_ADDRESS { if (!StoreToken( tSTATIC_ADDRESS, NULL )) YYABORT; }
376 | tSTATIC_OBJECT { if (!StoreToken( tSTATIC_OBJECT, $1 )) YYABORT; }
377 | tSTATIC_LIBRARY { if (!StoreToken( tSTATIC_LIBRARY, $1 )) YYABORT; }
378 | tSTATIC_SEARCHSYMBOL { if (!StoreToken( tSTATIC_SEARCHSYMBOL, $1 )) YYABORT; }
379 | tSTATIC_FORCE { if (!StoreToken( tSTATIC_FORCE, $1 )) YYABORT; }
380 | tSTATIC_STACKSIZE { if (!StoreToken( tSTATIC_STACKSIZE, NULL )) YYABORT; }
381 | tSTATIC_IRQSTACKSIZE { if (!StoreToken( tSTATIC_IRQSTACKSIZE, NULL )) YYABORT; }
382 | tFOREACH_STATIC_OBJECTS { if (!PushLoopStack( tFOREACH_STATIC_OBJECTS, $1 )) YYABORT; }
383 | tEND_STATIC_OBJECTS { if (!PopLoopStack ( tFOREACH_STATIC_OBJECTS )) YYABORT; }
384 | tFOREACH_STATIC_LIBRARIES { if (!PushLoopStack( tFOREACH_STATIC_LIBRARIES, $1 )) YYABORT; }
385 | tEND_STATIC_LIBRARIES { if (!PopLoopStack ( tFOREACH_STATIC_LIBRARIES )) YYABORT; }
386 | tFOREACH_STATIC_SEARCHSYMBOLS { if (!PushLoopStack( tFOREACH_STATIC_SEARCHSYMBOLS, $1 )) YYABORT; }
387 | tEND_STATIC_SEARCHSYMBOLS { if (!PopLoopStack ( tFOREACH_STATIC_SEARCHSYMBOLS )) YYABORT; }
388 | tFOREACH_STATIC_FORCES { if (!PushLoopStack( tFOREACH_STATIC_FORCES, $1 )) YYABORT; }
389 | tEND_STATIC_FORCES { if (!PopLoopStack ( tFOREACH_STATIC_FORCES )) YYABORT; }
390 | tIF_STATIC_OBJECT_FIRST { if (!StoreToken( tIF_STATIC_OBJECT_FIRST, $1 )) YYABORT; }
391 | tIF_STATIC_OBJECT_LAST { if (!StoreToken( tIF_STATIC_OBJECT_LAST, $1 )) YYABORT; }
392 | tIF_STATIC_LIBRARY_FIRST { if (!StoreToken( tIF_STATIC_LIBRARY_FIRST, $1 )) YYABORT; }
393 | tIF_STATIC_LIBRARY_LAST { if (!StoreToken( tIF_STATIC_LIBRARY_LAST, $1 )) YYABORT; }
394 | tIF_STATIC_SEARCHSYMBOL_FIRST { if (!StoreToken( tIF_STATIC_SEARCHSYMBOL_FIRST, $1 )) YYABORT; }
395 | tIF_STATIC_SEARCHSYMBOL_LAST { if (!StoreToken( tIF_STATIC_SEARCHSYMBOL_LAST, $1 )) YYABORT; }
396 | tIF_STATIC_FORCE_FIRST { if (!StoreToken( tIF_STATIC_FORCE_FIRST, $1 )) YYABORT; }
397 | tIF_STATIC_FORCE_LAST { if (!StoreToken( tIF_STATIC_FORCE_LAST, $1 )) YYABORT; }
398 | tAUTOLOAD_ID { if (!StoreToken( tAUTOLOAD_ID, NULL )) YYABORT; }
399 | tAUTOLOAD_NAME { if (!StoreToken( tAUTOLOAD_NAME, NULL )) YYABORT; }
400 | tAUTOLOAD_ADDRESS { if (!StoreToken( tAUTOLOAD_ADDRESS, NULL )) YYABORT; }
401 | tAUTOLOAD_OBJECT { if (!StoreToken( tAUTOLOAD_OBJECT, $1 )) YYABORT; }
402 | tAUTOLOAD_LIBRARY { if (!StoreToken( tAUTOLOAD_LIBRARY, $1 )) YYABORT; }
403 | tAUTOLOAD_SEARCHSYMBOL { if (!StoreToken( tAUTOLOAD_SEARCHSYMBOL, $1 )) YYABORT; }
404 | tAUTOLOAD_FORCE { if (!StoreToken( tAUTOLOAD_FORCE, $1 )) YYABORT; }
405 | tNUMBER_AUTOLOADS { if (!StoreToken( tNUMBER_AUTOLOADS, NULL )) YYABORT; }
406 | tFOREACH_AUTOLOADS { if (!PushLoopStack( tFOREACH_AUTOLOADS, $1 )) YYABORT; }
407 | tEND_AUTOLOADS { if (!PopLoopStack ( tFOREACH_AUTOLOADS )) YYABORT; }
408 | tFOREACH_AUTOLOAD_OBJECTS { if (!PushLoopStack( tFOREACH_AUTOLOAD_OBJECTS, $1 )) YYABORT; }
409 | tEND_AUTOLOAD_OBJECTS { if (!PopLoopStack ( tFOREACH_AUTOLOAD_OBJECTS )) YYABORT; }
410 | tFOREACH_AUTOLOAD_LIBRARIES { if (!PushLoopStack( tFOREACH_AUTOLOAD_LIBRARIES, $1 )) YYABORT; }
411 | tEND_AUTOLOAD_LIBRARIES { if (!PopLoopStack ( tFOREACH_AUTOLOAD_LIBRARIES )) YYABORT; }
412 | tFOREACH_AUTOLOAD_SEARCHSYMBOLS{ if (!PushLoopStack( tFOREACH_AUTOLOAD_SEARCHSYMBOLS, $1 )) YYABORT; }
413 | tEND_AUTOLOAD_SEARCHSYMBOLS { if (!PopLoopStack ( tFOREACH_AUTOLOAD_SEARCHSYMBOLS )) YYABORT; }
414 | tFOREACH_AUTOLOAD_FORCES { if (!PushLoopStack( tFOREACH_AUTOLOAD_FORCES, $1 )) YYABORT; }
415 | tEND_AUTOLOAD_FORCES { if (!PopLoopStack ( tFOREACH_AUTOLOAD_FORCES )) YYABORT; }
416 | tIF_AUTOLOAD_FIRST { if (!StoreToken( tIF_AUTOLOAD_FIRST, $1 )) YYABORT; }
417 | tIF_AUTOLOAD_LAST { if (!StoreToken( tIF_AUTOLOAD_LAST, $1 )) YYABORT; }
418 | tIF_AUTOLOAD_OBJECT_FIRST { if (!StoreToken( tIF_AUTOLOAD_OBJECT_FIRST, $1 )) YYABORT; }
419 | tIF_AUTOLOAD_OBJECT_LAST { if (!StoreToken( tIF_AUTOLOAD_OBJECT_LAST, $1 )) YYABORT; }
420 | tIF_AUTOLOAD_LIBRARY_FIRST { if (!StoreToken( tIF_AUTOLOAD_LIBRARY_FIRST, $1 )) YYABORT; }
421 | tIF_AUTOLOAD_LIBRARY_LAST { if (!StoreToken( tIF_AUTOLOAD_LIBRARY_LAST, $1 )) YYABORT; }
422 | tIF_AUTOLOAD_SEARCHSYMBOL_FIRST{ if (!StoreToken( tIF_AUTOLOAD_SEARCHSYMBOL_FIRST, $1 )) YYABORT; }
423 | tIF_AUTOLOAD_SEARCHSYMBOL_LAST { if (!StoreToken( tIF_AUTOLOAD_SEARCHSYMBOL_LAST, $1 )) YYABORT; }
424 | tIF_AUTOLOAD_FORCE_FIRST { if (!StoreToken( tIF_AUTOLOAD_FORCE_FIRST, $1 )) YYABORT; }
425 | tIF_AUTOLOAD_FORCE_LAST { if (!StoreToken( tIF_AUTOLOAD_FORCE_LAST, $1 )) YYABORT; }
426 | tOVERLAY_ID { if (!StoreToken( tOVERLAY_ID, NULL )) YYABORT; }
427 | tOVERLAY_NAME { if (!StoreToken( tOVERLAY_NAME, NULL )) YYABORT; }
428 | tOVERLAY_GROUP { if (!StoreToken( tOVERLAY_GROUP, NULL )) YYABORT; }
429 | tOVERLAY_ADDRESS { if (!StoreToken( tOVERLAY_ADDRESS, NULL )) YYABORT; }
430 | tOVERLAY_COMPRESS { if (!StoreToken( tOVERLAY_COMPRESS, NULL )) YYABORT; }
431 | tOVERLAY_OBJECT { if (!StoreToken( tOVERLAY_OBJECT, $1 )) YYABORT; }
432 | tOVERLAY_LIBRARY { if (!StoreToken( tOVERLAY_LIBRARY, $1 )) YYABORT; }
433 | tOVERLAY_SEARCHSYMBOL { if (!StoreToken( tOVERLAY_SEARCHSYMBOL, $1 )) YYABORT; }
434 | tOVERLAY_FORCE { if (!StoreToken( tOVERLAY_FORCE, $1 )) YYABORT; }
435 | tNUMBER_OVERLAYS { if (!StoreToken( tNUMBER_OVERLAYS, NULL )) YYABORT; }
436 | tFOREACH_OVERLAYS { if (!PushLoopStack( tFOREACH_OVERLAYS, $1 )) YYABORT; }
437 | tEND_OVERLAYS { if (!PopLoopStack ( tFOREACH_OVERLAYS )) YYABORT; }
438 | tFOREACH_OVERLAY_OBJECTS { if (!PushLoopStack( tFOREACH_OVERLAY_OBJECTS, $1 )) YYABORT; }
439 | tEND_OVERLAY_OBJECTS { if (!PopLoopStack ( tFOREACH_OVERLAY_OBJECTS )) YYABORT; }
440 | tFOREACH_OVERLAY_LIBRARIES { if (!PushLoopStack( tFOREACH_OVERLAY_LIBRARIES, $1 )) YYABORT; }
441 | tEND_OVERLAY_LIBRARIES { if (!PopLoopStack ( tFOREACH_OVERLAY_LIBRARIES )) YYABORT; }
442 | tFOREACH_OVERLAY_SEARCHSYMBOLS{ if (!PushLoopStack( tFOREACH_OVERLAY_SEARCHSYMBOLS, $1 )) YYABORT; }
443 | tEND_OVERLAY_SEARCHSYMBOLS { if (!PopLoopStack ( tFOREACH_OVERLAY_SEARCHSYMBOLS )) YYABORT; }
444 | tFOREACH_OVERLAY_FORCES { if (!PushLoopStack( tFOREACH_OVERLAY_FORCES, $1 )) YYABORT; }
445 | tEND_OVERLAY_FORCES { if (!PopLoopStack ( tFOREACH_OVERLAY_FORCES )) YYABORT; }
446 | tIF_OVERLAY_FIRST { if (!StoreToken( tIF_OVERLAY_FIRST, $1 )) YYABORT; }
447 | tIF_OVERLAY_LAST { if (!StoreToken( tIF_OVERLAY_LAST, $1 )) YYABORT; }
448 | tIF_OVERLAY_OBJECT_FIRST { if (!StoreToken( tIF_OVERLAY_OBJECT_FIRST, $1 )) YYABORT; }
449 | tIF_OVERLAY_OBJECT_LAST { if (!StoreToken( tIF_OVERLAY_OBJECT_LAST, $1 )) YYABORT; }
450 | tIF_OVERLAY_LIBRARY_FIRST { if (!StoreToken( tIF_OVERLAY_LIBRARY_FIRST, $1 )) YYABORT; }
451 | tIF_OVERLAY_LIBRARY_LAST { if (!StoreToken( tIF_OVERLAY_LIBRARY_LAST, $1 )) YYABORT; }
452 | tIF_OVERLAY_SEARCHSYMBOL_FIRST{ if (!StoreToken( tIF_OVERLAY_SEARCHSYMBOL_FIRST, $1 )) YYABORT; }
453 | tIF_OVERLAY_SEARCHSYMBOL_LAST { if (!StoreToken( tIF_OVERLAY_SEARCHSYMBOL_LAST, $1 )) YYABORT; }
454 | tIF_OVERLAY_FORCE_FIRST { if (!StoreToken( tIF_OVERLAY_FORCE_FIRST, $1 )) YYABORT; }
455 | tIF_OVERLAY_FORCE_LAST { if (!StoreToken( tIF_OVERLAY_FORCE_LAST, $1 )) YYABORT; }
456 | tPROPERTY_OVERLAYDEFS { if (!StoreToken( tPROPERTY_OVERLAYDEFS, NULL )) YYABORT; }
457 | tPROPERTY_OVERLAYTABLE { if (!StoreToken( tPROPERTY_OVERLAYTABLE, NULL )) YYABORT; }
458 | tPROPERTY_SUFFIX { if (!StoreToken( tPROPERTY_SUFFIX, NULL )) YYABORT; }
459 | tIF_EXIST_SECTION { if (!StoreToken( tIF_EXIST_SECTION, $1 )) YYABORT; }
460 | tIF_EXIST_STATIC { if (!StoreToken( tIF_EXIST_STATIC, $1 )) YYABORT; }
461 | tIF_EXIST_AUTOLOAD { if (!StoreToken( tIF_EXIST_AUTOLOAD, $1 )) YYABORT; }
462 | tIF_EXIST_OVERLAY { if (!StoreToken( tIF_EXIST_OVERLAY, $1 )) YYABORT; }
463 | cond_if | cond_else | cond_endif
464 ;
465
466 cond_if : tIF_OPEN tIF_ID tIF_COMP tIF_VALUE tIF_CLOSE { if (!CondIf( $2, $3, $4 )) YYABORT; }
467 | tIF_OPEN tIF_ID tIF_COMP tIF_CLOSE { if (!CondIf( $2, $3, "" )) YYABORT; }
468 ;
469
470 cond_else : tIF_ELSE { if (!CondElse()) YYABORT; }
471 ;
472
473 cond_endif : tIF_ENDIF { if (!CondEndIf()) YYABORT; }
474 ;
475
476 %%
477