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 
260 %token	<string>	tFOREACH_STATIC_OBJECTS
261 %token	<string>	tFOREACH_STATIC_LIBRARIES
262 %token	<string>	tFOREACH_STATIC_SEARCHSYMBOLS
263 %token			tEND_STATIC_OBJECTS
264 %token			tEND_STATIC_LIBRARIES
265 %token			tEND_STATIC_SEARCHSYMBOLS
266 
267 %token	<string>	tIF_STATIC_OBJECT_FIRST
268 %token	<string>	tIF_STATIC_OBJECT_LAST
269 %token	<string>	tIF_STATIC_LIBRARY_FIRST
270 %token	<string>	tIF_STATIC_LIBRARY_LAST
271 %token	<string>	tIF_STATIC_SEARCHSYMBOL_FIRST
272 %token	<string>	tIF_STATIC_SEARCHSYMBOL_LAST
273 
274 %token			tNUMBER_AUTOLOADS
275 %token			tAUTOLOAD_ID
276 %token			tAUTOLOAD_NAME
277 %token			tAUTOLOAD_ADDRESS
278 %token	<string>	tAUTOLOAD_OBJECT
279 %token	<string>	tAUTOLOAD_LIBRARY
280 %token	<string>	tAUTOLOAD_SEARCHSYMBOL
281 
282 %token	<string>	tFOREACH_AUTOLOADS
283 %token	<string>	tFOREACH_AUTOLOAD_OBJECTS
284 %token	<string>	tFOREACH_AUTOLOAD_LIBRARIES
285 %token	<string>	tFOREACH_AUTOLOAD_SEARCHSYMBOLS
286 %token			tEND_AUTOLOADS
287 %token			tEND_AUTOLOAD_OBJECTS
288 %token			tEND_AUTOLOAD_LIBRARIES
289 %token			tEND_AUTOLOAD_SEARCHSYMBOLS
290 
291 %token	<string>	tIF_AUTOLOAD_FIRST
292 %token	<string>	tIF_AUTOLOAD_LAST
293 %token	<string>	tIF_AUTOLOAD_OBJECT_FIRST
294 %token	<string>	tIF_AUTOLOAD_OBJECT_LAST
295 %token	<string>	tIF_AUTOLOAD_LIBRARY_FIRST
296 %token	<string>	tIF_AUTOLOAD_LIBRARY_LAST
297 %token	<string>	tIF_AUTOLOAD_SEARCHSYMBOL_FIRST
298 %token	<string>	tIF_AUTOLOAD_SEARCHSYMBOL_LAST
299 
300 %token			tNUMBER_OVERLAYS
301 %token			tOVERLAY_ID
302 %token			tOVERLAY_NAME
303 %token			tOVERLAY_GROUP
304 %token			tOVERLAY_ADDRESS
305 %token	<string>	tOVERLAY_OBJECT
306 %token	<string>	tOVERLAY_LIBRARY
307 %token	<string>	tOVERLAY_SEARCHSYMBOL
308 
309 %token	<string>	tFOREACH_OVERLAYS
310 %token	<string>	tFOREACH_OVERLAY_OBJECTS
311 %token	<string>	tFOREACH_OVERLAY_LIBRARIES
312 %token	<string>	tFOREACH_OVERLAY_SEARCHSYMBOLS
313 %token			tEND_OVERLAYS
314 %token			tEND_OVERLAY_OBJECTS
315 %token			tEND_OVERLAY_LIBRARIES
316 %token			tEND_OVERLAY_SEARCHSYMBOLS
317 
318 %token	<string>	tIF_OVERLAY_FIRST
319 %token	<string>	tIF_OVERLAY_LAST
320 %token	<string>	tIF_OVERLAY_OBJECT_FIRST
321 %token	<string>	tIF_OVERLAY_OBJECT_LAST
322 %token	<string>	tIF_OVERLAY_LIBRARY_FIRST
323 %token	<string>	tIF_OVERLAY_LIBRARY_LAST
324 %token	<string>	tIF_OVERLAY_SEARCHSYMBOL_FIRST
325 %token	<string>	tIF_OVERLAY_SEARCHSYMBOL_LAST
326 
327 %token	<string>	tIF_EXIST_SECTION
328 %token	<string>	tIF_EXIST_STATIC
329 %token	<string>	tIF_EXIST_AUTOLOAD
330 %token	<string>	tIF_EXIST_OVERLAY
331 
332 %token			tPROPERTY_OVERLAYDEFS
333 %token			tPROPERTY_OVERLAYTABLE
334 %token			tPROPERTY_SUFFIX
335 
336 %token			tIF_OPEN
337 %token			tIF_CLOSE
338 %token	<string>	tIF_ID
339 %token	<string>	tIF_COMP
340 %token	<string>	tIF_VALUE
341 %token			tIF_ELSE
342 %token			tIF_ENDIF
343 %%
344 
345 /*=========================================================================*
346       ConfigFile
347  *=========================================================================*/
348 
349 tlcfFile	: tokens
350 		;
351 
352 tokens		: /*NULL*/
353 		| tokens token
354 		;
355 
356 token		: tSTRING			{ if (!StoreToken( tSTRING,                $1   )) YYABORT; }
357 		| tTARGET_NAME			{ if (!StoreToken( tTARGET_NAME,           $1   )) YYABORT; }
358 		| tSTATIC_NAME			{ if (!StoreToken( tSTATIC_NAME,           NULL )) YYABORT; }
359 		| tSTATIC_ADDRESS		{ if (!StoreToken( tSTATIC_ADDRESS,        NULL )) YYABORT; }
360 		| tSTATIC_OBJECT		{ if (!StoreToken( tSTATIC_OBJECT,         $1   )) YYABORT; }
361 		| tSTATIC_LIBRARY		{ if (!StoreToken( tSTATIC_LIBRARY,        $1   )) YYABORT; }
362 		| tSTATIC_SEARCHSYMBOL		{ if (!StoreToken( tSTATIC_SEARCHSYMBOL,   $1   )) YYABORT; }
363 		| tSTATIC_STACKSIZE		{ if (!StoreToken( tSTATIC_STACKSIZE,      NULL )) YYABORT; }
364 		| tSTATIC_IRQSTACKSIZE		{ if (!StoreToken( tSTATIC_IRQSTACKSIZE,   NULL )) YYABORT; }
365 		| tFOREACH_STATIC_OBJECTS	{ if (!PushLoopStack( tFOREACH_STATIC_OBJECTS, $1   )) YYABORT; }
366 		| tEND_STATIC_OBJECTS    	{ if (!PopLoopStack ( tFOREACH_STATIC_OBJECTS       )) YYABORT; }
367 		| tFOREACH_STATIC_LIBRARIES	{ if (!PushLoopStack( tFOREACH_STATIC_LIBRARIES, $1 )) YYABORT; }
368 		| tEND_STATIC_LIBRARIES    	{ if (!PopLoopStack ( tFOREACH_STATIC_LIBRARIES     )) YYABORT; }
369 		| tFOREACH_STATIC_SEARCHSYMBOLS	{ if (!PushLoopStack( tFOREACH_STATIC_SEARCHSYMBOLS, $1 )) YYABORT; }
370 		| tEND_STATIC_SEARCHSYMBOLS	{ if (!PopLoopStack ( tFOREACH_STATIC_SEARCHSYMBOLS     )) YYABORT; }
371 		| tIF_STATIC_OBJECT_FIRST       { if (!StoreToken( tIF_STATIC_OBJECT_FIRST,       $1 )) YYABORT; }
372 		| tIF_STATIC_OBJECT_LAST        { if (!StoreToken( tIF_STATIC_OBJECT_LAST,        $1 )) YYABORT; }
373 		| tIF_STATIC_LIBRARY_FIRST      { if (!StoreToken( tIF_STATIC_LIBRARY_FIRST,      $1 )) YYABORT; }
374 		| tIF_STATIC_LIBRARY_LAST       { if (!StoreToken( tIF_STATIC_LIBRARY_LAST,       $1 )) YYABORT; }
375 		| tIF_STATIC_SEARCHSYMBOL_FIRST { if (!StoreToken( tIF_STATIC_SEARCHSYMBOL_FIRST, $1 )) YYABORT; }
376 		| tIF_STATIC_SEARCHSYMBOL_LAST  { if (!StoreToken( tIF_STATIC_SEARCHSYMBOL_LAST,  $1 )) YYABORT; }
377 		| tAUTOLOAD_ID			{ if (!StoreToken( tAUTOLOAD_ID,           NULL )) YYABORT; }
378 		| tAUTOLOAD_NAME		{ if (!StoreToken( tAUTOLOAD_NAME,         NULL )) YYABORT; }
379 		| tAUTOLOAD_ADDRESS		{ if (!StoreToken( tAUTOLOAD_ADDRESS,      NULL )) YYABORT; }
380 		| tAUTOLOAD_OBJECT		{ if (!StoreToken( tAUTOLOAD_OBJECT,       $1   )) YYABORT; }
381 		| tAUTOLOAD_LIBRARY		{ if (!StoreToken( tAUTOLOAD_LIBRARY,      $1   )) YYABORT; }
382 		| tAUTOLOAD_SEARCHSYMBOL	{ if (!StoreToken( tAUTOLOAD_SEARCHSYMBOL, $1   )) YYABORT; }
383 		| tNUMBER_AUTOLOADS		{ if (!StoreToken( tNUMBER_AUTOLOADS,      NULL )) YYABORT; }
384 		| tFOREACH_AUTOLOADS		{ if (!PushLoopStack( tFOREACH_AUTOLOADS,          $1 )) YYABORT; }
385 		| tEND_AUTOLOADS		{ if (!PopLoopStack ( tFOREACH_AUTOLOADS              )) YYABORT; }
386 		| tFOREACH_AUTOLOAD_OBJECTS	{ if (!PushLoopStack( tFOREACH_AUTOLOAD_OBJECTS,   $1 )) YYABORT; }
387 		| tEND_AUTOLOAD_OBJECTS		{ if (!PopLoopStack ( tFOREACH_AUTOLOAD_OBJECTS       )) YYABORT; }
388 		| tFOREACH_AUTOLOAD_LIBRARIES	{ if (!PushLoopStack( tFOREACH_AUTOLOAD_LIBRARIES, $1 )) YYABORT; }
389 		| tEND_AUTOLOAD_LIBRARIES	{ if (!PopLoopStack ( tFOREACH_AUTOLOAD_LIBRARIES     )) YYABORT; }
390 		| tFOREACH_AUTOLOAD_SEARCHSYMBOLS{ if (!PushLoopStack( tFOREACH_AUTOLOAD_SEARCHSYMBOLS, $1 )) YYABORT; }
391 		| tEND_AUTOLOAD_SEARCHSYMBOLS	 { if (!PopLoopStack ( tFOREACH_AUTOLOAD_SEARCHSYMBOLS     )) YYABORT; }		| tIF_AUTOLOAD_FIRST             { if (!StoreToken( tIF_AUTOLOAD_FIRST,              $1 )) YYABORT; }
392 		| tIF_AUTOLOAD_LAST              { if (!StoreToken( tIF_AUTOLOAD_LAST,               $1 )) YYABORT; }
393 		| tIF_AUTOLOAD_OBJECT_FIRST      { if (!StoreToken( tIF_AUTOLOAD_OBJECT_FIRST,       $1 )) YYABORT; }
394 		| tIF_AUTOLOAD_OBJECT_LAST       { if (!StoreToken( tIF_AUTOLOAD_OBJECT_LAST,        $1 )) YYABORT; }
395 		| tIF_AUTOLOAD_LIBRARY_FIRST     { if (!StoreToken( tIF_AUTOLOAD_LIBRARY_FIRST,      $1 )) YYABORT; }
396 		| tIF_AUTOLOAD_LIBRARY_LAST      { if (!StoreToken( tIF_AUTOLOAD_LIBRARY_LAST,       $1 )) YYABORT; }
397 		| tIF_AUTOLOAD_SEARCHSYMBOL_FIRST{ if (!StoreToken( tIF_AUTOLOAD_SEARCHSYMBOL_FIRST, $1 )) YYABORT; }
398 		| tIF_AUTOLOAD_SEARCHSYMBOL_LAST { if (!StoreToken( tIF_AUTOLOAD_SEARCHSYMBOL_LAST,  $1 )) YYABORT; }
399 		| tOVERLAY_ID			{ if (!StoreToken( tOVERLAY_ID,            NULL )) YYABORT; }
400 		| tOVERLAY_NAME			{ if (!StoreToken( tOVERLAY_NAME,          NULL )) YYABORT; }
401 		| tOVERLAY_GROUP		{ if (!StoreToken( tOVERLAY_GROUP,         NULL )) YYABORT; }
402 		| tOVERLAY_ADDRESS		{ if (!StoreToken( tOVERLAY_ADDRESS,       NULL )) YYABORT; }
403 		| tOVERLAY_OBJECT		{ if (!StoreToken( tOVERLAY_OBJECT,        $1   )) YYABORT; }
404 		| tOVERLAY_LIBRARY		{ if (!StoreToken( tOVERLAY_LIBRARY,       $1   )) YYABORT; }
405 		| tOVERLAY_SEARCHSYMBOL		{ if (!StoreToken( tOVERLAY_SEARCHSYMBOL,  $1   )) YYABORT; }
406 		| tNUMBER_OVERLAYS		{ if (!StoreToken( tNUMBER_OVERLAYS,       NULL )) YYABORT; }
407 		| tFOREACH_OVERLAYS		{ if (!PushLoopStack( tFOREACH_OVERLAYS,          $1 )) YYABORT; }
408 		| tEND_OVERLAYS			{ if (!PopLoopStack ( tFOREACH_OVERLAYS              )) YYABORT; }
409 		| tFOREACH_OVERLAY_OBJECTS	{ if (!PushLoopStack( tFOREACH_OVERLAY_OBJECTS,   $1 )) YYABORT; }
410 		| tEND_OVERLAY_OBJECTS		{ if (!PopLoopStack ( tFOREACH_OVERLAY_OBJECTS       )) YYABORT; }
411 		| tFOREACH_OVERLAY_LIBRARIES	{ if (!PushLoopStack( tFOREACH_OVERLAY_LIBRARIES, $1 )) YYABORT; }
412 		| tEND_OVERLAY_LIBRARIES	{ if (!PopLoopStack ( tFOREACH_OVERLAY_LIBRARIES     )) YYABORT; }
413 		| tFOREACH_OVERLAY_SEARCHSYMBOLS{ if (!PushLoopStack( tFOREACH_OVERLAY_SEARCHSYMBOLS, $1 )) YYABORT; }
414 		| tEND_OVERLAY_SEARCHSYMBOLS	{ if (!PopLoopStack ( tFOREACH_OVERLAY_SEARCHSYMBOLS     )) YYABORT; }
415 		| tIF_OVERLAY_FIRST             { if (!StoreToken( tIF_OVERLAY_FIRST,              $1 )) YYABORT; }
416 		| tIF_OVERLAY_LAST              { if (!StoreToken( tIF_OVERLAY_LAST,               $1 )) YYABORT; }
417 		| tIF_OVERLAY_OBJECT_FIRST      { if (!StoreToken( tIF_OVERLAY_OBJECT_FIRST,       $1 )) YYABORT; }
418 		| tIF_OVERLAY_OBJECT_LAST       { if (!StoreToken( tIF_OVERLAY_OBJECT_LAST,        $1 )) YYABORT; }
419 		| tIF_OVERLAY_LIBRARY_FIRST     { if (!StoreToken( tIF_OVERLAY_LIBRARY_FIRST,      $1 )) YYABORT; }
420 		| tIF_OVERLAY_LIBRARY_LAST      { if (!StoreToken( tIF_OVERLAY_LIBRARY_LAST,       $1 )) YYABORT; }
421 		| tIF_OVERLAY_SEARCHSYMBOL_FIRST{ if (!StoreToken( tIF_OVERLAY_SEARCHSYMBOL_FIRST, $1 )) YYABORT; }
422 		| tIF_OVERLAY_SEARCHSYMBOL_LAST { if (!StoreToken( tIF_OVERLAY_SEARCHSYMBOL_LAST,  $1 )) YYABORT; }
423 		| tPROPERTY_OVERLAYDEFS		{ if (!StoreToken( tPROPERTY_OVERLAYDEFS,  NULL )) YYABORT; }
424 		| tPROPERTY_OVERLAYTABLE	{ if (!StoreToken( tPROPERTY_OVERLAYTABLE, NULL )) YYABORT; }
425 		| tPROPERTY_SUFFIX		{ if (!StoreToken( tPROPERTY_SUFFIX,       NULL )) YYABORT; }
426 		| tIF_EXIST_SECTION             { if (!StoreToken( tIF_EXIST_SECTION,  $1 )) YYABORT; }
427 		| tIF_EXIST_STATIC              { if (!StoreToken( tIF_EXIST_STATIC,   $1 )) YYABORT; }
428 		| tIF_EXIST_AUTOLOAD            { if (!StoreToken( tIF_EXIST_AUTOLOAD, $1 )) YYABORT; }
429 		| tIF_EXIST_OVERLAY             { if (!StoreToken( tIF_EXIST_OVERLAY,  $1 )) YYABORT; }
430 		| cond_if | cond_else | cond_endif
431 		;
432 
433 cond_if		: tIF_OPEN tIF_ID tIF_COMP tIF_VALUE tIF_CLOSE { if (!CondIf( $2, $3, $4 )) YYABORT; }
434 		| tIF_OPEN tIF_ID tIF_COMP           tIF_CLOSE { if (!CondIf( $2, $3, "" )) YYABORT; }
435 		;
436 
437 cond_else	: tIF_ELSE  { if (!CondElse()) YYABORT; }
438 		;
439 
440 cond_endif	: tIF_ENDIF { if (!CondEndIf()) YYABORT; }
441 		;
442 
443 %%
444