5 * The contents of this file are subject to the terms of the
6 * Common Development and Distribution License, Version 1.0 only
7 * (the "License"). You may not use this file except in compliance
10 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
11 * or http://www.opensolaris.org/os/licensing.
12 * See the License for the specific language governing permissions
13 * and limitations under the License.
15 * When distributing Covered Code, include this CDDL HEADER in each
16 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
17 * If applicable, add the following below this CDDL HEADER, with the
18 * fields enclosed by brackets "[]" replaced with your own identifying
19 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright (c) 2000-2001 by Sun Microsystems, Inc.
24 * All rights reserved.
27 #pragma ident "%Z%%M% %I% %E% SMI"
29 /* This is the yacc grammar for the libfru NamingSyntax */
38 extern fru_errno_t gParserErrno
;
39 extern
char *gParserString
;
40 extern Ancestor
*gParserAnts
;
41 extern PathDef
*gParserHead
;
42 extern
int *gParserAbs
;
44 extern
void yyerror (const char *msg
);
45 extern
int yylex (void);
55 %token SEPIDENT ITERBEGIN ITEREND
60 %type
<pathDef
> recordpath element
70 = Ancestor
::listTaggedAncestors
((char *)$1->def
->name
);
78 | element SEPIDENT recordpath
80 if
($1->def
->dataType
!= FDTYPE_Record
)
86 for
( int i
=0;i
<$1->def
->enumCount
;i
++)
88 if
( strcmp
($3->def
->name
, $1->def
->enumTable
[i
].text
) == 0 )
96 // insert it in the list.
98 // return the head of the list.
101 | SEPIDENT recordpath
103 // absolute path definitions MUST start with tagged elements.
104 if
( $2->def
->tagType
== FRU_X
)
106 yyerror ("First Element of absolute path MUST be tagged");
116 const fru_regdef_t
*def
= fru_reg_lookup_def_by_name
($1);
120 gParserErrno
= FRU_NOREGDEF
;
121 free
($1); // the lexer allocates this memory.
124 PathDef
*pathDef
= new PathDef
;
125 pathDef
->def
= (fru_regdef_t
*)def
;
126 pathDef
->iterIndex
= 0;
127 pathDef
->next
= NULL
;
128 free
($1); // the lexer allocates this memory.
131 | NAME ITERBEGIN itercount ITEREND
133 const fru_regdef_t
*def
= fru_reg_lookup_def_by_name
($1);
137 gParserErrno
= FRU_NOREGDEF
;
138 free
($1); // the lexer allocates this memory.
141 if
( def
->iterationType
== FRU_NOT_ITERATED
)
144 free
($1); // the lexer allocates this memory.
147 if
( ($3 != PathDef
::lastIteration
) &&
148 ($3 != PathDef
::addIteration
) )
150 if
( ($3 >= def
->iterationCount
) ||
($3 < 0) )
153 free
($1); // the lexer allocates this memory.
157 PathDef
*pathDef
= new PathDef
;
158 pathDef
->def
= (fru_regdef_t
*)def
;
159 pathDef
->iterIndex
= $3;
160 pathDef
->next
= NULL
;
161 free
($1); // the lexer allocates this memory.
169 { $$
= PathDef
::lastIteration
; }
171 { $$
= PathDef
::addIteration
; }
177 yyerror (const char *msg
)
179 gParserErrno
= FRU_INVALPATH
;
182 // just to override what the library should have done.
183 int yywrap
(void) { return
1; }