1 
2 # line 2 "../libfru/nameSyntaxYacc.y"
3 /*
4  * CDDL HEADER START
5  *
6  * The contents of this file are subject to the terms of the
7  * Common Development and Distribution License, Version 1.0 only
8  * (the "License").  You may not use this file except in compliance
9  * with the License.
10  *
11  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
12  * or http://www.opensolaris.org/os/licensing.
13  * See the License for the specific language governing permissions
14  * and limitations under the License.
15  *
16  * When distributing Covered Code, include this CDDL HEADER in each
17  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
18  * If applicable, add the following below this CDDL HEADER, with the
19  * fields enclosed by brackets "[]" replaced with your own identifying
20  * information: Portions Copyright [yyyy] [name of copyright owner]
21  *
22  * CDDL HEADER END
23  *
24  * Copyright (c) 2000-2001 by Sun Microsystems, Inc.
25  * All rights reserved.
26  */
27 
28 #pragma ident	"%Z%%M%	%I%	%E% SMI"
29 
30 /* This is the yacc grammar for the libfru NamingSyntax */
31 #include <assert.h>
32 #include <stdio.h>
33 
34 #include "Parser.h"
35 
36 //#define YYDEBUG 1
37 
38 // Parser Globals.
39 extern fru_errno_t gParserErrno;
40 extern char *gParserString;
41 extern Ancestor *gParserAnts;
42 extern PathDef *gParserHead;
43 extern int *gParserAbs;
44 
45 extern void fruerror (const char *msg);
46 extern int  frulex   (void);
47 
48 
49 # line 49 "../libfru/nameSyntaxYacc.y"
50 typedef union
51 #ifdef __cplusplus
52 	YYSTYPE
53 #endif
54  {
55    int      num;
56    char    *name;
57    PathDef *pathDef;
58 } YYSTYPE;
59 # define SEPIDENT 257
60 # define ITERBEGIN 258
61 # define ITEREND 259
62 # define LAST 260
63 # define ADD 261
64 # define NUMBER 262
65 # define NAME 263
66 
67 #include <inttypes.h>
68 
69 #ifdef __STDC__
70 #include <stdlib.h>
71 #include <string.h>
72 #define	YYCONST	const
73 #else
74 #include <malloc.h>
75 #include <memory.h>
76 #define	YYCONST
77 #endif
78 
79 #include <values.h>
80 
81 #if defined(__cplusplus) || defined(__STDC__)
82 
83 #if defined(__cplusplus) && defined(__EXTERN_C__)
84 extern "C" {
85 #endif
86 #ifndef fruerror
87 #if defined(__cplusplus)
88 	void fruerror(YYCONST char *);
89 #endif
90 #endif
91 #ifndef frulex
92 	int frulex(void);
93 #endif
94 	int fruparse(void);
95 #if defined(__cplusplus) && defined(__EXTERN_C__)
96 }
97 #endif
98 
99 #endif
100 
101 #define yyclearin fruchar = -1
102 #define yyerrok fruerrflag = 0
103 extern int fruchar;
104 extern int fruerrflag;
105 YYSTYPE frulval;
106 YYSTYPE fruval;
107 typedef int yytabelem;
108 #ifndef YYMAXDEPTH
109 #define YYMAXDEPTH 150
110 #endif
111 #if YYMAXDEPTH > 0
112 int yy_frus[YYMAXDEPTH], *frus = yy_frus;
113 YYSTYPE yy_fruv[YYMAXDEPTH], *fruv = yy_fruv;
114 #else	/* user does initial allocation */
115 int *frus;
116 YYSTYPE *fruv;
117 #endif
118 static int yymaxdepth = YYMAXDEPTH;
119 # define YYERRCODE 256
120 
121 # line 174 "../libfru/nameSyntaxYacc.y"
122 
123 
124 void
125 fruerror (const char *msg)
126 {
127    gParserErrno = FRU_INVALPATH;
128 }
129 
130 // just to override what the library should have done.
131 int fruwrap (void) { return 1; }
132 
133 static YYCONST yytabelem fruexca[] ={
134 -1, 1,
135 	0, -1,
136 	-2, 0,
137 	};
138 # define YYNPROD 10
139 # define YYLAST 15
140 static YYCONST yytabelem fruact[]={
141 
142     12,    13,    11,     4,    14,     8,     6,     2,     1,     5,
143     10,     3,     7,     0,     9 };
144 static YYCONST yytabelem frupact[]={
145 
146   -254,-10000000,-10000000,  -251,  -254,  -253,  -254,-10000000,  -260,-10000000,
147   -255,-10000000,-10000000,-10000000,-10000000 };
148 static YYCONST yytabelem frupgo[]={
149 
150      0,     7,    11,    10,     8 };
151 static YYCONST yytabelem frur1[]={
152 
153      0,     4,     1,     1,     1,     2,     2,     3,     3,     3 };
154 static YYCONST yytabelem frur2[]={
155 
156      0,     3,     3,     7,     5,     3,     9,     3,     3,     3 };
157 static YYCONST yytabelem fruchk[]={
158 
159 -10000000,    -4,    -1,    -2,   257,   263,   257,    -1,   258,    -1,
160     -3,   262,   260,   261,   259 };
161 static YYCONST yytabelem frudef[]={
162 
163      0,    -2,     1,     2,     0,     5,     0,     4,     0,     3,
164      0,     7,     8,     9,     6 };
165 typedef struct
166 #ifdef __cplusplus
167 	yytoktype
168 #endif
169 {
170 #ifdef __cplusplus
171 const
172 #endif
173 char *t_name; int t_val; } yytoktype;
174 #ifndef YYDEBUG
175 #	define YYDEBUG	0	/* don't allow debugging */
176 #endif
177 
178 #if YYDEBUG
179 
180 yytoktype frutoks[] =
181 {
182 	"SEPIDENT",	257,
183 	"ITERBEGIN",	258,
184 	"ITEREND",	259,
185 	"LAST",	260,
186 	"ADD",	261,
187 	"NUMBER",	262,
188 	"NAME",	263,
189 	"-unknown-",	-1	/* ends search */
190 };
191 
192 #ifdef __cplusplus
193 const
194 #endif
195 char * frureds[] =
196 {
197 	"-no such reduction-",
198 	"fullpath : recordpath",
199 	"recordpath : element",
200 	"recordpath : element SEPIDENT recordpath",
201 	"recordpath : SEPIDENT recordpath",
202 	"element : NAME",
203 	"element : NAME ITERBEGIN itercount ITEREND",
204 	"itercount : NUMBER",
205 	"itercount : LAST",
206 	"itercount : ADD",
207 };
208 #endif /* YYDEBUG */
209 # line	1 "/usr/share/lib/ccs/yaccpar"
210 /*
211  * CDDL HEADER START
212  *
213  * The contents of this file are subject to the terms of the
214  * Common Development and Distribution License, Version 1.0 only
215  * (the "License").  You may not use this file except in compliance
216  * with the License.
217  *
218  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
219  * or http://www.opensolaris.org/os/licensing.
220  * See the License for the specific language governing permissions
221  * and limitations under the License.
222  *
223  * When distributing Covered Code, include this CDDL HEADER in each
224  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
225  * If applicable, add the following below this CDDL HEADER, with the
226  * fields enclosed by brackets "[]" replaced with your own identifying
227  * information: Portions Copyright [yyyy] [name of copyright owner]
228  *
229  * CDDL HEADER END
230  */
231 /*
232  * Copyright 1993 Sun Microsystems, Inc.  All rights reserved.
233  * Use is subject to license terms.
234  */
235 
236 /* Copyright (c) 1988 AT&T */
237 /* All Rights Reserved */
238 
239 #pragma ident	"%Z%%M%	%I%	%E% SMI"
240 
241 /*
242 ** Skeleton parser driver for yacc output
243 */
244 
245 /*
246 ** yacc user known macros and defines
247 */
248 #define YYERROR		goto yyerrlab
249 #define YYACCEPT	return(0)
250 #define YYABORT		return(1)
251 #define YYBACKUP( newtoken, newvalue )\
252 {\
253 	if ( fruchar >= 0 || ( frur2[ frutmp ] >> 1 ) != 1 )\
254 	{\
255 		fruerror( "syntax error - cannot backup" );\
256 		goto yyerrlab;\
257 	}\
258 	fruchar = newtoken;\
259 	frustate = *frups;\
260 	frulval = newvalue;\
261 	goto yynewstate;\
262 }
263 #define YYRECOVERING()	(!!fruerrflag)
264 #define YYNEW(type)	malloc(sizeof(type) * yynewmax)
265 #define YYCOPY(to, from, type) \
266 	(type *) memcpy(to, (char *) from, yymaxdepth * sizeof (type))
267 #define YYENLARGE( from, type) \
268 	(type *) realloc((char *) from, yynewmax * sizeof(type))
269 #ifndef YYDEBUG
270 #	define YYDEBUG	1	/* make debugging available */
271 #endif
272 
273 /*
274 ** user known globals
275 */
276 int frudebug;			/* set to 1 to get debugging */
277 
278 /*
279 ** driver internal defines
280 */
281 #define YYFLAG		(-10000000)
282 
283 /*
284 ** global variables used by the parser
285 */
286 YYSTYPE *frupv;			/* top of value stack */
287 int *frups;			/* top of state stack */
288 
289 int frustate;			/* current state */
290 int frutmp;			/* extra var (lasts between blocks) */
291 
292 int frunerrs;			/* number of errors */
293 int fruerrflag;			/* error recovery flag */
294 int fruchar;			/* current input token number */
295 
296 
297 
298 #ifdef YYNMBCHARS
299 #define YYLEX()		yycvtok(frulex())
300 /*
301 ** yycvtok - return a token if i is a wchar_t value that exceeds 255.
302 **	If i<255, i itself is the token.  If i>255 but the neither
303 **	of the 30th or 31st bit is on, i is already a token.
304 */
305 #if defined(__STDC__) || defined(__cplusplus)
306 int yycvtok(int i)
307 #else
308 int yycvtok(i) int i;
309 #endif
310 {
311 	int first = 0;
312 	int last = YYNMBCHARS - 1;
313 	int mid;
314 	wchar_t j;
315 
316 	if(i&0x60000000){/*Must convert to a token. */
317 		if( yymbchars[last].character < i ){
318 			return i;/*Giving up*/
319 		}
320 		while ((last>=first)&&(first>=0)) {/*Binary search loop*/
321 			mid = (first+last)/2;
322 			j = yymbchars[mid].character;
323 			if( j==i ){/*Found*/
324 				return yymbchars[mid].tvalue;
325 			}else if( j<i ){
326 				first = mid + 1;
327 			}else{
328 				last = mid -1;
329 			}
330 		}
331 		/*No entry in the table.*/
332 		return i;/* Giving up.*/
333 	}else{/* i is already a token. */
334 		return i;
335 	}
336 }
337 #else/*!YYNMBCHARS*/
338 #define YYLEX()		frulex()
339 #endif/*!YYNMBCHARS*/
340 
341 /*
342 ** fruparse - return 0 if worked, 1 if syntax error not recovered from
343 */
344 #if defined(__STDC__) || defined(__cplusplus)
345 int fruparse(void)
346 #else
347 int fruparse()
348 #endif
349 {
350 	register YYSTYPE *frupvt = 0;	/* top of value stack for $vars */
351 
352 #if defined(__cplusplus) || defined(lint)
353 /*
354 	hacks to please C++ and lint - goto's inside
355 	switch should never be executed
356 */
357 	static int __yaccpar_lint_hack__ = 0;
358 	switch (__yaccpar_lint_hack__)
359 	{
360 		case 1: goto yyerrlab;
361 		case 2: goto yynewstate;
362 	}
363 #endif
364 
365 	/*
366 	** Initialize externals - fruparse may be called more than once
367 	*/
368 	frupv = &fruv[-1];
369 	frups = &frus[-1];
370 	frustate = 0;
371 	frutmp = 0;
372 	frunerrs = 0;
373 	fruerrflag = 0;
374 	fruchar = -1;
375 
376 #if YYMAXDEPTH <= 0
377 	if (yymaxdepth <= 0)
378 	{
379 		if ((yymaxdepth = YYEXPAND(0)) <= 0)
380 		{
381 			fruerror("yacc initialization error");
382 			YYABORT;
383 		}
384 	}
385 #endif
386 
387 	{
388 		register YYSTYPE *yy_pv;	/* top of value stack */
389 		register int *yy_ps;		/* top of state stack */
390 		register int yy_state;		/* current state */
391 		register int  yy_n;		/* internal state number info */
392 	goto frustack;	/* moved from 6 lines above to here to please C++ */
393 
394 		/*
395 		** get globals into registers.
396 		** branch to here only if YYBACKUP was called.
397 		*/
398 	yynewstate:
399 		yy_pv = frupv;
400 		yy_ps = frups;
401 		yy_state = frustate;
402 		goto yy_newstate;
403 
404 		/*
405 		** get globals into registers.
406 		** either we just started, or we just finished a reduction
407 		*/
408 	frustack:
409 		yy_pv = frupv;
410 		yy_ps = frups;
411 		yy_state = frustate;
412 
413 		/*
414 		** top of for (;;) loop while no reductions done
415 		*/
416 	yy_stack:
417 		/*
418 		** put a state and value onto the stacks
419 		*/
420 #if YYDEBUG
421 		/*
422 		** if debugging, look up token value in list of value vs.
423 		** name pairs.  0 and negative (-1) are special values.
424 		** Note: linear search is used since time is not a real
425 		** consideration while debugging.
426 		*/
427 		if ( frudebug )
428 		{
429 			register int yy_i;
430 
431 			printf( "State %d, token ", yy_state );
432 			if ( fruchar == 0 )
433 				printf( "end-of-file\n" );
434 			else if ( fruchar < 0 )
435 				printf( "-none-\n" );
436 			else
437 			{
438 				for ( yy_i = 0; frutoks[yy_i].t_val >= 0;
439 					yy_i++ )
440 				{
441 					if ( frutoks[yy_i].t_val == fruchar )
442 						break;
443 				}
444 				printf( "%s\n", frutoks[yy_i].t_name );
445 			}
446 		}
447 #endif /* YYDEBUG */
448 		if ( ++yy_ps >= &frus[ yymaxdepth ] )	/* room on stack? */
449 		{
450 			/*
451 			** reallocate and recover.  Note that pointers
452 			** have to be reset, or bad things will happen
453 			*/
454 			long frups_index = (yy_ps - frus);
455 			long frupv_index = (yy_pv - fruv);
456 			long frupvt_index = (frupvt - fruv);
457 			int yynewmax;
458 #ifdef YYEXPAND
459 			yynewmax = YYEXPAND(yymaxdepth);
460 #else
461 			yynewmax = 2 * yymaxdepth;	/* double table size */
462 			if (yymaxdepth == YYMAXDEPTH)	/* first time growth */
463 			{
464 				char *newfrus = (char *)YYNEW(int);
465 				char *newfruv = (char *)YYNEW(YYSTYPE);
466 				if (newfrus != 0 && newfruv != 0)
467 				{
468 					frus = YYCOPY(newfrus, frus, int);
469 					fruv = YYCOPY(newfruv, fruv, YYSTYPE);
470 				}
471 				else
472 					yynewmax = 0;	/* failed */
473 			}
474 			else				/* not first time */
475 			{
476 				frus = YYENLARGE(frus, int);
477 				fruv = YYENLARGE(fruv, YYSTYPE);
478 				if (frus == 0 || fruv == 0)
479 					yynewmax = 0;	/* failed */
480 			}
481 #endif
482 			if (yynewmax <= yymaxdepth)	/* tables not expanded */
483 			{
484 				fruerror( "yacc stack overflow" );
485 				YYABORT;
486 			}
487 			yymaxdepth = yynewmax;
488 
489 			yy_ps = frus + frups_index;
490 			yy_pv = fruv + frupv_index;
491 			frupvt = fruv + frupvt_index;
492 		}
493 		*yy_ps = yy_state;
494 		*++yy_pv = fruval;
495 
496 		/*
497 		** we have a new state - find out what to do
498 		*/
499 	yy_newstate:
500 		if ( ( yy_n = frupact[ yy_state ] ) <= YYFLAG )
501 			goto frudefault;		/* simple state */
502 #if YYDEBUG
503 		/*
504 		** if debugging, need to mark whether new token grabbed
505 		*/
506 		frutmp = fruchar < 0;
507 #endif
508 		if ( ( fruchar < 0 ) && ( ( fruchar = YYLEX() ) < 0 ) )
509 			fruchar = 0;		/* reached EOF */
510 #if YYDEBUG
511 		if ( frudebug && frutmp )
512 		{
513 			register int yy_i;
514 
515 			printf( "Received token " );
516 			if ( fruchar == 0 )
517 				printf( "end-of-file\n" );
518 			else if ( fruchar < 0 )
519 				printf( "-none-\n" );
520 			else
521 			{
522 				for ( yy_i = 0; frutoks[yy_i].t_val >= 0;
523 					yy_i++ )
524 				{
525 					if ( frutoks[yy_i].t_val == fruchar )
526 						break;
527 				}
528 				printf( "%s\n", frutoks[yy_i].t_name );
529 			}
530 		}
531 #endif /* YYDEBUG */
532 		if ( ( ( yy_n += fruchar ) < 0 ) || ( yy_n >= YYLAST ) )
533 			goto frudefault;
534 		if ( fruchk[ yy_n = fruact[ yy_n ] ] == fruchar )	/*valid shift*/
535 		{
536 			fruchar = -1;
537 			fruval = frulval;
538 			yy_state = yy_n;
539 			if ( fruerrflag > 0 )
540 				fruerrflag--;
541 			goto yy_stack;
542 		}
543 
544 	frudefault:
545 		if ( ( yy_n = frudef[ yy_state ] ) == -2 )
546 		{
547 #if YYDEBUG
548 			frutmp = fruchar < 0;
549 #endif
550 			if ( ( fruchar < 0 ) && ( ( fruchar = YYLEX() ) < 0 ) )
551 				fruchar = 0;		/* reached EOF */
552 #if YYDEBUG
553 			if ( frudebug && frutmp )
554 			{
555 				register int yy_i;
556 
557 				printf( "Received token " );
558 				if ( fruchar == 0 )
559 					printf( "end-of-file\n" );
560 				else if ( fruchar < 0 )
561 					printf( "-none-\n" );
562 				else
563 				{
564 					for ( yy_i = 0;
565 						frutoks[yy_i].t_val >= 0;
566 						yy_i++ )
567 					{
568 						if ( frutoks[yy_i].t_val
569 							== fruchar )
570 						{
571 							break;
572 						}
573 					}
574 					printf( "%s\n", frutoks[yy_i].t_name );
575 				}
576 			}
577 #endif /* YYDEBUG */
578 			/*
579 			** look through exception table
580 			*/
581 			{
582 				register YYCONST int *yyxi = fruexca;
583 
584 				while ( ( *yyxi != -1 ) ||
585 					( yyxi[1] != yy_state ) )
586 				{
587 					yyxi += 2;
588 				}
589 				while ( ( *(yyxi += 2) >= 0 ) &&
590 					( *yyxi != fruchar ) )
591 					;
592 				if ( ( yy_n = yyxi[1] ) < 0 )
593 					YYACCEPT;
594 			}
595 		}
596 
597 		/*
598 		** check for syntax error
599 		*/
600 		if ( yy_n == 0 )	/* have an error */
601 		{
602 			/* no worry about speed here! */
603 			switch ( fruerrflag )
604 			{
605 			case 0:		/* new error */
606 				fruerror( "syntax error" );
607 				goto skip_init;
608 			yyerrlab:
609 				/*
610 				** get globals into registers.
611 				** we have a user generated syntax type error
612 				*/
613 				yy_pv = frupv;
614 				yy_ps = frups;
615 				yy_state = frustate;
616 			skip_init:
617 				frunerrs++;
618 				/* FALLTHRU */
619 			case 1:
620 			case 2:		/* incompletely recovered error */
621 					/* try again... */
622 				fruerrflag = 3;
623 				/*
624 				** find state where "error" is a legal
625 				** shift action
626 				*/
627 				while ( yy_ps >= frus )
628 				{
629 					yy_n = frupact[ *yy_ps ] + YYERRCODE;
630 					if ( yy_n >= 0 && yy_n < YYLAST &&
631 						fruchk[fruact[yy_n]] == YYERRCODE)					{
632 						/*
633 						** simulate shift of "error"
634 						*/
635 						yy_state = fruact[ yy_n ];
636 						goto yy_stack;
637 					}
638 					/*
639 					** current state has no shift on
640 					** "error", pop stack
641 					*/
642 #if YYDEBUG
643 #	define _POP_ "Error recovery pops state %d, uncovers state %d\n"
644 					if ( frudebug )
645 						printf( _POP_, *yy_ps,
646 							yy_ps[-1] );
647 #	undef _POP_
648 #endif
649 					yy_ps--;
650 					yy_pv--;
651 				}
652 				/*
653 				** there is no state on stack with "error" as
654 				** a valid shift.  give up.
655 				*/
656 				YYABORT;
657 			case 3:		/* no shift yet; eat a token */
658 #if YYDEBUG
659 				/*
660 				** if debugging, look up token in list of
661 				** pairs.  0 and negative shouldn't occur,
662 				** but since timing doesn't matter when
663 				** debugging, it doesn't hurt to leave the
664 				** tests here.
665 				*/
666 				if ( frudebug )
667 				{
668 					register int yy_i;
669 
670 					printf( "Error recovery discards " );
671 					if ( fruchar == 0 )
672 						printf( "token end-of-file\n" );
673 					else if ( fruchar < 0 )
674 						printf( "token -none-\n" );
675 					else
676 					{
677 						for ( yy_i = 0;
678 							frutoks[yy_i].t_val >= 0;
679 							yy_i++ )
680 						{
681 							if ( frutoks[yy_i].t_val
682 								== fruchar )
683 							{
684 								break;
685 							}
686 						}
687 						printf( "token %s\n",
688 							frutoks[yy_i].t_name );
689 					}
690 				}
691 #endif /* YYDEBUG */
692 				if ( fruchar == 0 )	/* reached EOF. quit */
693 					YYABORT;
694 				fruchar = -1;
695 				goto yy_newstate;
696 			}
697 		}/* end if ( yy_n == 0 ) */
698 		/*
699 		** reduction by production yy_n
700 		** put stack tops, etc. so things right after switch
701 		*/
702 #if YYDEBUG
703 		/*
704 		** if debugging, print the string that is the user's
705 		** specification of the reduction which is just about
706 		** to be done.
707 		*/
708 		if ( frudebug )
709 			printf( "Reduce by (%d) \"%s\"\n",
710 				yy_n, frureds[ yy_n ] );
711 #endif
712 		frutmp = yy_n;			/* value to switch over */
713 		frupvt = yy_pv;			/* $vars top of value stack */
714 		/*
715 		** Look in goto table for next state
716 		** Sorry about using yy_state here as temporary
717 		** register variable, but why not, if it works...
718 		** If frur2[ yy_n ] doesn't have the low order bit
719 		** set, then there is no action to be done for
720 		** this reduction.  So, no saving & unsaving of
721 		** registers done.  The only difference between the
722 		** code just after the if and the body of the if is
723 		** the goto yy_stack in the body.  This way the test
724 		** can be made before the choice of what to do is needed.
725 		*/
726 		{
727 			/* length of production doubled with extra bit */
728 			register int yy_len = frur2[ yy_n ];
729 
730 			if ( !( yy_len & 01 ) )
731 			{
732 				yy_len >>= 1;
733 				fruval = ( yy_pv -= yy_len )[1];	/* $$ = $1 */
734 				yy_state = frupgo[ yy_n = frur1[ yy_n ] ] +
735 					*( yy_ps -= yy_len ) + 1;
736 				if ( yy_state >= YYLAST ||
737 					fruchk[ yy_state =
738 					fruact[ yy_state ] ] != -yy_n )
739 				{
740 					yy_state = fruact[ frupgo[ yy_n ] ];
741 				}
742 				goto yy_stack;
743 			}
744 			yy_len >>= 1;
745 			fruval = ( yy_pv -= yy_len )[1];	/* $$ = $1 */
746 			yy_state = frupgo[ yy_n = frur1[ yy_n ] ] +
747 				*( yy_ps -= yy_len ) + 1;
748 			if ( yy_state >= YYLAST ||
749 				fruchk[ yy_state = fruact[ yy_state ] ] != -yy_n )
750 			{
751 				yy_state = fruact[ frupgo[ yy_n ] ];
752 			}
753 		}
754 					/* save until reenter driver code */
755 		frustate = yy_state;
756 		frups = yy_ps;
757 		frupv = yy_pv;
758 	}
759 	/*
760 	** code supplied by user is placed in this switch
761 	*/
762 	switch( frutmp )
763 	{
764 
765 case 1:
766 # line 67 "../libfru/nameSyntaxYacc.y"
767 {
768               gParserHead = frupvt[-0].pathDef;
769               gParserAnts
770 		= Ancestor::listTaggedAncestors((char *)frupvt[-0].pathDef->def->name);
771            } break;
772 case 2:
773 # line 75 "../libfru/nameSyntaxYacc.y"
774 {
775                fruval.pathDef = frupvt[-0].pathDef;
776            } break;
777 case 3:
778 # line 79 "../libfru/nameSyntaxYacc.y"
779 {
780               if (frupvt[-2].pathDef->def->dataType != FDTYPE_Record)
781               {
782                  fruerror (NULL);
783                  YYABORT;
784               }
785               int found = 0;
786               for ( int i=0;i<frupvt[-2].pathDef->def->enumCount;i++)
787               {
788                  if ( strcmp (frupvt[-0].pathDef->def->name, frupvt[-2].pathDef->def->enumTable[i].text) == 0 )
789                     found = 1;
790               }
791               if ( !found )
792               {
793                  fruerror (NULL);
794                  YYABORT;
795               }
796               // insert it in the list.
797               frupvt[-2].pathDef->next = frupvt[-0].pathDef;
798               // return the head of the list.
799               fruval.pathDef = frupvt[-2].pathDef;
800            } break;
801 case 4:
802 # line 102 "../libfru/nameSyntaxYacc.y"
803 {
804               // absolute path definitions MUST start with tagged elements.
805               if ( frupvt[-0].pathDef->def->tagType == FRU_X )
806               {
807                  fruerror ("First Element of absolute path MUST be tagged");
808                  YYABORT;
809               }
810               *gParserAbs = 1;
811               fruval.pathDef = frupvt[-0].pathDef;
812            } break;
813 case 5:
814 # line 115 "../libfru/nameSyntaxYacc.y"
815 {
816               const fru_regdef_t *def = fru_reg_lookup_def_by_name(frupvt[-0].name);
817               if ( def == NULL )
818               {
819                  fruerror (NULL);
820                  gParserErrno = FRU_NOREGDEF;
821                  free (frupvt[-0].name); // the lexer allocates this memory.
822                  YYABORT;
823               }
824               PathDef *pathDef = new PathDef;
825               pathDef->def = (fru_regdef_t *)def;
826               pathDef->iterIndex = 0;
827               pathDef->next = NULL;
828               free (frupvt[-0].name); // the lexer allocates this memory.
829               fruval.pathDef = pathDef;
830            } break;
831 case 6:
832 # line 132 "../libfru/nameSyntaxYacc.y"
833 {
834               const fru_regdef_t *def = fru_reg_lookup_def_by_name(frupvt[-3].name);
835               if ( def == NULL )
836               {
837                  fruerror (NULL);
838                  gParserErrno = FRU_NOREGDEF;
839                  free (frupvt[-3].name); // the lexer allocates this memory.
840                  YYABORT;
841               }
842               if ( def->iterationType == FRU_NOT_ITERATED )
843               {
844                  fruerror (NULL);
845                  free (frupvt[-3].name); // the lexer allocates this memory.
846                  YYABORT;
847               }
848               if ( (frupvt[-1].num != PathDef::lastIteration) &&
849 			(frupvt[-1].num != PathDef::addIteration) )
850               {
851                  if ( (frupvt[-1].num >= def->iterationCount) || (frupvt[-1].num < 0) )
852                  {
853                     fruerror (NULL);
854                     free (frupvt[-3].name); // the lexer allocates this memory.
855                     YYABORT;
856                  }
857               }
858               PathDef *pathDef = new PathDef;
859               pathDef->def = (fru_regdef_t *)def;
860               pathDef->iterIndex = frupvt[-1].num;
861               pathDef->next = NULL;
862               free (frupvt[-3].name); // the lexer allocates this memory.
863               fruval.pathDef = pathDef;
864            } break;
865 case 7:
866 # line 167 "../libfru/nameSyntaxYacc.y"
867 { fruval.num = frupvt[-0].num; } break;
868 case 8:
869 # line 169 "../libfru/nameSyntaxYacc.y"
870 { fruval.num = PathDef::lastIteration; } break;
871 case 9:
872 # line 171 "../libfru/nameSyntaxYacc.y"
873 { fruval.num = PathDef::addIteration; } break;
874 # line	556 "/usr/share/lib/ccs/yaccpar"
875 	}
876 	goto frustack;		/* reset registers in driver code */
877 }
878 
879