1 martin 1.55 //%LICENSE////////////////////////////////////////////////////////////////
|
2 martin 1.56 //
|
3 martin 1.55 // Licensed to The Open Group (TOG) under one or more contributor license
4 // agreements. Refer to the OpenPegasusNOTICE.txt file distributed with
5 // this work for additional information regarding copyright ownership.
6 // Each contributor licenses this file to you under the OpenPegasus Open
7 // Source License; you may not use this file except in compliance with the
8 // License.
|
9 martin 1.56 //
|
10 martin 1.55 // Permission is hereby granted, free of charge, to any person obtaining a
11 // copy of this software and associated documentation files (the "Software"),
12 // to deal in the Software without restriction, including without limitation
13 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
14 // and/or sell copies of the Software, and to permit persons to whom the
15 // Software is furnished to do so, subject to the following conditions:
|
16 martin 1.56 //
|
17 martin 1.55 // The above copyright notice and this permission notice shall be included
18 // in all copies or substantial portions of the Software.
|
19 martin 1.56 //
|
20 martin 1.55 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
21 martin 1.56 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
22 martin 1.55 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
23 // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
24 // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
25 // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
26 // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
27 martin 1.56 //
|
28 martin 1.55 //////////////////////////////////////////////////////////////////////////
|
29 bob 1.1 %{
30 /* Flex grammar created from CIM Specification Version 2.2 Appendix A */
31
32 /*
33 Note the following implementation details:
34
35 1. The MOF specification has a production of type assocDeclaration,
36 but an association is just a type of classDeclaration with a few
37 special rules. At least for the first pass, I'm treating an
38 associationDeclaration as a classDeclaration and applying its
39 syntactical rules outside of the grammar definition.
40
41 2. Same with the indicationDeclaration. It appears to be a normal
42 classDeclaration with the INDICATION qualifier and no special
43 syntactical rules.
44
45 3. The Parser uses String objects throughout to represent
46 character data. However, the tokenizer underneath is probably
47 working with 8-bit chars. If we later use an extended character
48 compatible tokenizer, I anticipate NO CHANGE to this parser.
49
50 bob 1.1 4. Besides the tokenizer, this parser uses 2 sets of outside
51 services:
52 1)Class valueFactory. This has a couple of static methods
|
53 karl 1.45 that assist in creating CIMValue objects from Strings.
54 2)Class cimmofParser. This has a wide variety of methods
55 that fall into these catagories:
|
56 bob 1.1 a) Interfaces to the Repository. You call cimmofParser::
57 methods to query and store compiled CIM elements.
|
58 karl 1.45 b) Error handling.
|
59 bob 1.1 c) Data format conversions.
60 d) Tokenizer manipulation
61 e) Pragma handling
62 f) Alias Handling
63 */
64
|
65 e.boden 1.34
|
66 mike 1.7 #define YYSTACKSIZE 2000
67
|
68 bob 1.1 #include <cstdlib>
|
69 r.kieninger 1.54 #if !defined(PEGASUS_OS_ZOS) && !defined(PEGASUS_OS_VMS)
|
70 mike 1.43 #if defined(PEGASUS_OS_DARWIN)
|
71 dudhe.girish 1.33 #include <sys/malloc.h>
72 #else
|
73 bob 1.1 #include <malloc.h>
|
74 dudhe.girish 1.33 #endif
|
75 sage 1.14 #endif
|
76 bob 1.1 #include <cstdio>
77 #include <cstring>
|
78 mike 1.5 #include <Pegasus/Common/String.h>
|
79 kumpf 1.23 #include <Pegasus/Common/CIMName.h>
|
80 kumpf 1.47 #include <Pegasus/Common/StringConversion.h>
|
81 bob 1.1 #include "cimmofParser.h"
82 #include "valueFactory.h"
83 #include "memobjs.h"
|
84 kumpf 1.50 #include <Pegasus/Common/CIMQualifierList.h>
|
85 kumpf 1.52 #include <Pegasus/Common/AutoPtr.h>
|
86 bob 1.1
|
87 e.boden 1.34 //include any useful debugging stuff here
88
|
89 karl 1.31 /* Debugging the parser. Debugging is provided through
90 1. debug functions in Bison that are controlled by a compile time
91 flag (YYDEBUG) and a runtime flag (yydebug) which is redefined
92 to cimmof_debug.
93 2. Debug functions defined through YACCTRACE, a macro defined
94 in cimmofparser.h and turned on and off manually.
95 All debugging must be turned on manually at this point by
96 setting the YYDEBUG compile flag and also setting YACCTRACE.
97 ATTN: TODO: automate the debug information flags.
98 */
99 // Enable this define to compie Bison/Yacc tracing
100 // ATTN: p3 03092003 ks Enabling this flag currently causes a compile error
101
|
102 e.boden 1.34 #define YYDEBUG 1
103 //static int cimmof_debug;
|
104 karl 1.31
|
105 bob 1.1 //extern cimmofParser g_cimmofParser;
106
|
107 e.boden 1.34 extern int cimmof_lex(void);
108 extern int cimmof_error(...);
|
109 bob 1.1 extern char *cimmof_text;
|
110 e.boden 1.34 extern void cimmof_yy_less(int n);
111 extern int cimmof_leng;
112
|
113 bob 1.1
114 /* ------------------------------------------------------------------- */
115 /* These globals provide continuity between various pieces of a */
116 /* declaration. They are usually interpreted as "these modifiers were */
117 /* encountered and need to be applied to the finished object". For */
118 /* example, qualifiers are accumulated in g_qualifierList[] as they */
119 /* encountered, then applied to the production they qualify when it */
120 /* is completed. */
121 /* ------------------------------------------------------------------- */
|
122 kumpf 1.25 CIMFlavor g_flavor = CIMFlavor (CIMFlavor::NONE);
123 CIMScope g_scope = CIMScope ();
|
124 karl 1.31 //ATTN: BB 2001 BB P1 - Fixed size qualifier list max 20. Make larger or var
|
125 kumpf 1.50 CIMQualifierList g_qualifierList;
|
126 bob 1.3 CIMMethod *g_currentMethod = 0;
127 CIMClass *g_currentClass = 0;
128 CIMInstance *g_currentInstance = 0;
|
129 mike 1.41 String g_currentAliasRef; // Alias reference
130 String g_currentAliasDecl; // Alias declaration
|
131 kumpf 1.23 CIMName g_referenceClassName = CIMName();
|
132 kumpf 1.29 Array<CIMKeyBinding> g_KeyBindingArray; // it gets created empty
|
133 karl 1.45 TYPED_INITIALIZER_VALUE g_typedInitializerValue;
|
134 bob 1.1
135 /* ------------------------------------------------------------------- */
|
136 bob 1.3 /* Pragmas, except for the Include pragma, are not handled yet */
|
137 karl 1.45 /* I don't understand them, so it may be a while before they are */
|
138 bob 1.1 /* ------------------------------------------------------------------- */
139 struct pragma {
140 String name;
141 String value;
142 };
143
144 /* ---------------------------------------------------------------- */
145 /* Use our general wrap manager to handle end-of-file */
146 /* ---------------------------------------------------------------- */
147 extern "C" {
148 int
149 cimmof_wrap() {
150 return cimmofParser::Instance()->wrapCurrentBuffer();
151 }
152 }
153
154 /* ---------------------------------------------------------------- */
155 /* Pass errors to our general log manager. */
156 /* ---------------------------------------------------------------- */
157 void
|
158 kumpf 1.20 cimmof_error(const char *msg) {
|
159 bob 1.1 cimmofParser::Instance()->log_parse_error(cimmof_text, msg);
160 // printf("Error: %s\n", msg);
161 }
162
|
163 jim.wunderlich 1.40 static void MOF_error(const char * str, const char * S);
164 static void MOF_trace(const char* str);
165 static void MOF_trace2(const char * str, const char * S);
166
|
167 e.boden 1.34 %}
|
168 bob 1.1
169 %union {
|
170 e.boden 1.34 //char *strval;
171 CIMClass *mofclass;
172 CIMFlavor *flavor;
173 CIMInstance *instance;
174 CIMKeyBinding *keybinding;
175 CIMMethod *method;
176 CIMName *cimnameval;
177 CIMObjectPath *reference;
178 CIMProperty *property;
179 CIMQualifier *qualifier;
180 CIMQualifierDecl *mofqualifier;
181 CIMScope *scope;
182 CIMType datatype;
183 CIMValue *value;
184 int ival;
|
185 kumpf 1.49 CIMObjectPath *modelpath;
|
186 e.boden 1.34 String *strptr;
187 String *strval;
188 struct pragma *pragma;
189 TYPED_INITIALIZER_VALUE *typedinitializer;
|
190 bob 1.1 }
191
|
192 e.boden 1.34
193
194 %token TOK_ALIAS_IDENTIFIER
195 %token TOK_ANY
196 %token TOK_AS
197 %token TOK_ASSOCIATION
198 %token TOK_BINARY_VALUE
199 %token TOK_CHAR_VALUE
200 %token TOK_CLASS
201 %token TOK_COLON
202 %token TOK_COMMA
203 %token TOK_DISABLEOVERRIDE
204 %token TOK_DQUOTE
205 %token TOK_DT_BOOL
206 %token TOK_DT_CHAR16
207 %token TOK_DT_CHAR8
208 %token TOK_DT_DATETIME
209 %token TOK_DT_REAL32
210 %token TOK_DT_REAL64
211 %token TOK_DT_SINT16
212 %token TOK_DT_SINT32
213 e.boden 1.34 %token TOK_DT_SINT64
214 %token TOK_DT_SINT8
215 %token TOK_DT_STR
216 %token TOK_DT_UINT16
217 %token TOK_DT_UINT32
218 %token TOK_DT_UINT64
219 %token TOK_DT_UINT8
220 %token TOK_ENABLEOVERRIDE
221 %token TOK_END_OF_FILE
222 %token TOK_EQUAL
223 %token TOK_FALSE
224 %token TOK_FLAVOR
225 %token TOK_HEX_VALUE
226 %token TOK_INCLUDE
227 %token TOK_INDICATION
228 %token TOK_INSTANCE
|
229 bob 1.1 %token TOK_LEFTCURLYBRACE
|
230 e.boden 1.34 %token TOK_LEFTPAREN
|
231 bob 1.1 %token TOK_LEFTSQUAREBRACKET
|
232 e.boden 1.34 %token TOK_METHOD
|
233 bob 1.1 %token TOK_NULL_VALUE
234 %token TOK_OCTAL_VALUE
|
235 e.boden 1.34 %token TOK_OF
236 %token TOK_PARAMETER
|
237 bob 1.1 %token TOK_PERIOD
|
238 e.boden 1.34 %token TOK_POSITIVE_DECIMAL_VALUE
|
239 bob 1.1 %token TOK_PRAGMA
|
240 e.boden 1.34 %token TOK_PROPERTY
|
241 bob 1.1 %token TOK_QUALIFIER
|
242 e.boden 1.34 %token TOK_REAL_VALUE
243 %token TOK_REF
|
244 bob 1.1 %token TOK_REFERENCE
245 %token TOK_RESTRICTED
|
246 e.boden 1.34 %token TOK_RIGHTCURLYBRACE
247 %token TOK_RIGHTPAREN
248 %token TOK_RIGHTSQUAREBRACKET
249 %token TOK_SCHEMA
250 %token TOK_SCOPE
251 %token TOK_SEMICOLON
252 %token TOK_SIGNED_DECIMAL_VALUE
253 %token TOK_SIMPLE_IDENTIFIER
254 %token TOK_STRING_VALUE
|
255 bob 1.1 %token TOK_TOSUBCLASS
256 %token TOK_TRANSLATABLE
|
257 e.boden 1.34 %token TOK_TRUE
|
258 bob 1.9 %token TOK_UNEXPECTED_CHAR
|
259 bob 1.1
|
260 kumpf 1.23
|
261 karl 1.45 %type <cimnameval> propertyName parameterName methodName className
262 %type <cimnameval> superClass
263 %type <datatype> dataType intDataType realDataType parameterType objectRef
264 %type <flavor> flavor defaultFlavor
265 %type <instance> instanceHead instanceDeclaration
266 %type <ival> array
267 %type <ival> booleanValue keyValuePairList
268 %type <keybinding> keyValuePair
269 %type <method> methodHead methodDeclaration
270 %type <modelpath> modelPath
271 %type <mofclass> classHead classDeclaration
272 %type <mofqualifier> qualifierDeclaration
273 %type <pragma> compilerDirectivePragma
274 %type <property> propertyBody propertyDeclaration referenceDeclaration
275 %type <qualifier> qualifier
276 %type <scope> scope metaElements metaElement
277 %type <strval> arrayInitializer constantValues
278 %type <strval> fileName referencedObject referenceName referencePath
279 %type <strval> integerValue TOK_REAL_VALUE TOK_CHAR_VALUE
280 %type <strval> namespaceHandle namespaceHandleRef
281 %type <strval> nonNullConstantValue
282 karl 1.45 %type <strval> pragmaName pragmaVal keyValuePairName qualifierName
283 %type <strval> referenceInitializer objectHandle
284 %type <strval> aliasInitializer
285 %type <strval> aliasIdentifier
286 %type <strval> stringValue stringValues initializer constantValue
287 %type <strval> TOK_ALIAS_IDENTIFIER alias
288 %type <strval> TOK_POSITIVE_DECIMAL_VALUE TOK_OCTAL_VALUE TOK_HEX_VALUE
|
289 kumpf 1.47 %type <strval> TOK_BINARY_VALUE TOK_SIGNED_DECIMAL_VALUE
|
290 karl 1.45 %type <strval> TOK_SIMPLE_IDENTIFIER TOK_STRING_VALUE
291 %type <strval> TOK_UNEXPECTED_CHAR
292 %type <typedinitializer> typedInitializer typedDefaultValue
|
293 kumpf 1.20 %type <typedinitializer> typedQualifierParameter
|
294 karl 1.45 %type <value> qualifierValue
|
295 karl 1.31
|
296 e.boden 1.34 %%
|
297 karl 1.31
298 /*
299 **------------------------------------------------------------------------------
300 **
301 ** Production rules section
302 **
303 **------------------------------------------------------------------------------
304 */
|
305 kumpf 1.17 mofSpec: mofProductions ;
|
306 bob 1.1
|
307 e.boden 1.34
|
308 bob 1.1 mofProductions: mofProduction mofProductions
309 | /* empty */ ;
|
310 e.boden 1.34
311
|
312 karl 1.16 // ATTN: P1 KS Apr 2002 Limit in (none) Directive handling. See FIXME below.
|
313 bob 1.1 mofProduction: compilerDirective { /* FIXME: Where do we put directives? */ }
|
314 karl 1.45 | qualifierDeclaration
|
315 kumpf 1.57 {
|
316 karl 1.45 cimmofParser::Instance()->addQualifier($1);
317 delete $1;
318 }
319 | classDeclaration
|
320 kumpf 1.57 {
|
321 karl 1.45 cimmofParser::Instance()->addClass($1);
322 }
323 | instanceDeclaration
324 {
325 cimmofParser::Instance()->addInstance($1);
326 } ;
|
327 e.boden 1.34
|
328 karl 1.31 /*
329 **------------------------------------------------------------------------------
330 **
331 ** class Declaration productions and processing
332 **
333 **------------------------------------------------------------------------------
334 */
|
335 bob 1.1 classDeclaration: classHead classBody
336 {
|
337 karl 1.31 YACCTRACE("classDeclaration");
|
338 jim.wunderlich 1.40 if (g_currentAliasDecl != String::EMPTY)
|
339 karl 1.45 cimmofParser::Instance()->addClassAlias(g_currentAliasDecl, $$, false);
|
340 bob 1.1 } ;
341
|
342 e.boden 1.34
|
343 bob 1.1 classHead: qualifierList TOK_CLASS className alias superClass
344 {
|
345 karl 1.31 // create new instance of class with className and superclassName
346 // put returned class object on stack
347 YACCTRACE("classHead:");
348 $$ = cimmofParser::Instance()->newClassDecl(*$3, *$5);
|
349 karl 1.45
|
350 karl 1.31 // put list of qualifiers into class
|
351 kumpf 1.50 applyQualifierList(g_qualifierList, *$$);
|
352 karl 1.45
|
353 jim.wunderlich 1.40 g_currentAliasRef = *$4;
|
354 karl 1.31 if (g_currentClass)
355 delete g_currentClass;
356 g_currentClass = $$;
357 delete $3;
358 delete $4;
359 delete $5;
|
360 kumpf 1.17 } ;
|
361 bob 1.1
|
362 e.boden 1.34
363 className: TOK_SIMPLE_IDENTIFIER {} ;
364
|
365 bob 1.1
|
366 kumpf 1.57 superClass: TOK_COLON className
367 {
368 $$ = new CIMName(*$2);
|
369 dmitry.mikulin 1.51 delete $2;
370 }
|
371 kumpf 1.57 | /* empty */
372 {
373 $$ = new CIMName();
|
374 dmitry.mikulin 1.51 }
|
375 bob 1.1
|
376 e.boden 1.34
|
377 bob 1.1 classBody: TOK_LEFTCURLYBRACE classFeatures TOK_RIGHTCURLYBRACE TOK_SEMICOLON
|
378 karl 1.45 | TOK_LEFTCURLYBRACE TOK_RIGHTCURLYBRACE TOK_SEMICOLON ;
|
379 bob 1.1
|
380 e.boden 1.34
|
381 bob 1.1 classFeatures: classFeature
|
382 karl 1.45 | classFeatures classFeature ;
|
383 bob 1.1
|
384 e.boden 1.34
|
385 kumpf 1.57 classFeature: propertyDeclaration
|
386 karl 1.45 {
387 YACCTRACE("classFeature:applyProperty");
388 cimmofParser::Instance()->applyProperty(*g_currentClass, *$1);
|
389 kumpf 1.57 delete $1;
|
390 karl 1.45 }
|
391 kumpf 1.57 | methodDeclaration
|
392 karl 1.45 {
393 YACCTRACE("classFeature:applyMethod");
|
394 kumpf 1.57 cimmofParser::Instance()->applyMethod(*g_currentClass, *$1);
|
395 karl 1.45 }
|
396 kumpf 1.57 | referenceDeclaration
|
397 karl 1.45 {
398 YACCTRACE("classFeature:applyProperty");
399 cimmofParser::Instance()->applyProperty(*g_currentClass, *$1);
|
400 kumpf 1.57 delete $1;
|
401 karl 1.45 };
|
402 bob 1.1
|
403 e.boden 1.34
404
405
406
407
|
408 karl 1.31 /*
409 **------------------------------------------------------------------------------
410 **
411 ** method Declaration productions and processing.
412 **
413 **------------------------------------------------------------------------------
414 */
415
|
416 karl 1.45 methodDeclaration: qualifierList methodHead methodBody methodEnd
|
417 bob 1.1 {
|
418 karl 1.45 YACCTRACE("methodDeclaration");
419 $$ = $2;
|
420 bob 1.1 } ;
421
|
422 e.boden 1.34
423
|
424 karl 1.31 // methodHead processes the datatype and methodName and puts qualifierList.
|
425 kumpf 1.50 // Note that the qualifierList is parsed in methodDeclaration and applied here
426 // so that it is not overwritten by parameter qualifier lists.
|
427 karl 1.45 methodHead: dataType methodName
|
428 bob 1.1 {
|
429 karl 1.31 YACCTRACE("methodHead");
430 if (g_currentMethod)
|
431 karl 1.45 delete g_currentMethod;
432
433 // create new method instance with pointer to method name and datatype
434 g_currentMethod = cimmofParser::Instance()->newMethod(*$2, $1) ;
|
435 karl 1.31
|
436 karl 1.45 // put new method on stack
437 $$ = g_currentMethod;
|
438 karl 1.31
|
439 karl 1.45 // apply the method qualifier list.
|
440 kumpf 1.50 applyQualifierList(g_qualifierList, *$$);
|
441 karl 1.31
|
442 karl 1.45 delete $2;
|
443 bob 1.1 } ;
444
|
445 e.boden 1.34
|
446 bob 1.1 methodBody: TOK_LEFTPAREN parameters TOK_RIGHTPAREN ;
447
|
448 e.boden 1.34
|
449 bob 1.1 methodEnd: TOK_SEMICOLON ;
450
|
451 e.boden 1.34
|
452 kumpf 1.57 methodName: TOK_SIMPLE_IDENTIFIER
453 {
454 $$ = new CIMName(*$1);
|
455 dmitry.mikulin 1.51 delete $1;
456 }
|
457 karl 1.31
|
458 e.boden 1.34
|
459 karl 1.31 //
460 // Productions for method parameters
461 //
462 parameters : parameter
|
463 karl 1.45 | parameters TOK_COMMA parameter
464 | /* empty */ ;
|
465 karl 1.31
|
466 e.boden 1.34
|
467 karl 1.45 parameter: qualifierList parameterType parameterName array
468 {
469 // ATTN: P2 2002 Question Need to create default value including type?
|
470 karl 1.31
|
471 karl 1.45 YACCTRACE("parameter:");
472 CIMParameter *p = 0;
473 cimmofParser *cp = cimmofParser::Instance();
474
475 // Create new parameter with name, type, isArray, array, referenceClassName
476 if ($4 == -1) {
477 p = cp->newParameter(*$3, $2, false, 0, g_referenceClassName);
478 }
479 else
480 {
481 p = cp->newParameter(*$3, $2, true, $4, g_referenceClassName);
482 }
|
483 e.boden 1.34
|
484 karl 1.45 g_referenceClassName = CIMName();
|
485 karl 1.31
|
486 karl 1.45 YACCTRACE("parameter:applyQualifierList");
|
487 kumpf 1.50 applyQualifierList(g_qualifierList, *p);
|
488 e.boden 1.34
|
489 karl 1.45 cp->applyParameter(*g_currentMethod, *p);
490 delete p;
491 delete $3;
492 } ;
|
493 e.boden 1.34
494
|
495 karl 1.45 parameterType: dataType { $$ = $1; }
496 | objectRef { $$ = CIMTYPE_REFERENCE; } ;
|
497 e.boden 1.34
498
|
499 karl 1.31 /*
500 **------------------------------------------------------------------------------
501 **
502 ** property Declaration productions and processing
503 **
504 **------------------------------------------------------------------------------
505 */
|
506 e.boden 1.34
|
507 karl 1.45 propertyDeclaration: qualifierList propertyBody propertyEnd
|
508 bob 1.1 {
|
509 karl 1.31 // set body to stack and apply qualifier list
510 // ATTN: the apply qualifer only works here because
511 // there are not lower level qualifiers. We do productions
512 // that might have lower level qualifiers differently by
|
513 karl 1.45 // setting up a xxxHead production where qualifiers are
|
514 karl 1.31 // applied.
515 YACCTRACE("propertyDeclaration:");
516 $$ = $2;
|
517 kumpf 1.50 applyQualifierList(g_qualifierList, *$$);
|
518 bob 1.1 } ;
519
|
520 e.boden 1.34
|
521 kumpf 1.18 propertyBody: dataType propertyName array typedDefaultValue
|
522 bob 1.1 {
|
523 karl 1.45 CIMValue *v = valueFactory::createValue($1, $3,
524 ($4->type == CIMMOF_NULL_VALUE), $4->value);
|
525 kumpf 1.57 if ($3 == -1)
|
526 karl 1.45 {
527 $$ = cimmofParser::Instance()->newProperty(*$2, *v, false, 0);
|
528 kumpf 1.57 }
529 else
|
530 karl 1.45 {
531 $$ = cimmofParser::Instance()->newProperty(*$2, *v, true, $3);
532 }
533
534 delete $2;
535 delete $4->value;
536 delete v;
|
537 bob 1.1 } ;
538
|
539 e.boden 1.34
|
540 bob 1.1 propertyEnd: TOK_SEMICOLON ;
|
541 e.boden 1.34
542
|
543 karl 1.31 /*
544 **------------------------------------------------------------------------------
545 **
546 ** reference Declaration productions and processing
547 **
548 **------------------------------------------------------------------------------
549 */
|
550 bob 1.1
551 referenceDeclaration: qualifierList referencedObject TOK_REF referenceName
|
552 karl 1.45 referencePath TOK_SEMICOLON
|
553 bob 1.1 {
|
554 karl 1.45 String s(*$2);
555 if (!String::equal(*$5, String::EMPTY))
556 s.append("." + *$5);
557 CIMValue *v = valueFactory::createValue(CIMTYPE_REFERENCE, -1, true, &s);
558 //KS add the isArray and arraysize parameters. 8 mar 2002
559 $$ = cimmofParser::Instance()->newProperty(*$4, *v, false,0, *$2);
|
560 kumpf 1.50 applyQualifierList(g_qualifierList, *$$);
|
561 karl 1.45 delete $2;
562 delete $4;
563 delete $5;
564 delete v;
|
565 bob 1.1 } ;
566
|
567 e.boden 1.34
|
568 bob 1.1 referencedObject: TOK_SIMPLE_IDENTIFIER { $$ = $1; } ;
569
|
570 e.boden 1.34
|
571 bob 1.1 referenceName: TOK_SIMPLE_IDENTIFIER { $$ = $1; };
572
|
573 e.boden 1.34
|
574 bob 1.1 referencePath: TOK_EQUAL stringValue { $$ = $2; }
|
575 karl 1.45 | /* empty */ { $$ = new String(String::EMPTY); } ;
|
576 bob 1.1
|
577 e.boden 1.34
|
578 kumpf 1.57 objectRef: className TOK_REF
|
579 dmitry.mikulin 1.51 {
|
580 kumpf 1.57 g_referenceClassName = *$1;
|
581 dmitry.mikulin 1.51 delete $1;
582 }
|
583 bob 1.1
|
584 e.boden 1.34
|
585 kumpf 1.57 parameterName: TOK_SIMPLE_IDENTIFIER
586 {
587 $$ = new CIMName(*$1);
|
588 dmitry.mikulin 1.51 delete $1;
589 }
|
590 bob 1.1
|
591 e.boden 1.34
|
592 kumpf 1.57 propertyName: TOK_SIMPLE_IDENTIFIER
593 {
594 $$ = new CIMName(*$1);
|
595 dmitry.mikulin 1.51 delete $1;
596 }
|
597 bob 1.1
|
598 e.boden 1.34
|
599 karl 1.45 array: TOK_LEFTSQUAREBRACKET TOK_POSITIVE_DECIMAL_VALUE
600 TOK_RIGHTSQUAREBRACKET
|
601 kumpf 1.47 {
|
602 kumpf 1.48 $$ = (Uint32) valueFactory::stringToUint(*$2, CIMTYPE_UINT32);
|
603 karl 1.45 delete $2;
604 }
605 | TOK_LEFTSQUAREBRACKET TOK_RIGHTSQUAREBRACKET
606 { $$ = 0; }
|
607 kumpf 1.57 | /* empty */
|
608 karl 1.45 { $$ = -1; } ;
609
610
611 typedDefaultValue: TOK_EQUAL typedInitializer { $$ = $2; }
|
612 kumpf 1.57 |
|
613 karl 1.45 { /* empty */
614 g_typedInitializerValue.type = CIMMOF_NULL_VALUE;
615 g_typedInitializerValue.value = new String(String::EMPTY);
616 $$ = &g_typedInitializerValue;
617 };
618
619
|
620 kumpf 1.57 initializer: constantValue
|
621 karl 1.45 { $$ = $1; }
622 | arrayInitializer
623 { $$ = $1; }
624 | referenceInitializer
625 { $$ = $1; } ;
|
626 bob 1.1
|
627 e.boden 1.34
|
628 karl 1.45 // The typedInitializer element is syntactially identical to
629 // the initializer element. However, the typedInitializer element
|
630 kumpf 1.17 // returns, in addition to the value, the type of the value.
|
631 karl 1.45 typedInitializer: nonNullConstantValue
632 {
633 g_typedInitializerValue.type = CIMMOF_CONSTANT_VALUE;
634 g_typedInitializerValue.value = $1;
635 $$ = &g_typedInitializerValue;
636 }
637 | TOK_NULL_VALUE
638 {
639 g_typedInitializerValue.type = CIMMOF_NULL_VALUE;
640 g_typedInitializerValue.value = new String(String::EMPTY);
641 $$ = &g_typedInitializerValue;
642 }
643 | arrayInitializer
644 {
645 g_typedInitializerValue.type = CIMMOF_ARRAY_VALUE;
646 g_typedInitializerValue.value = $1;
647 $$ = &g_typedInitializerValue;
648 }
649 | referenceInitializer
650 {
651 g_typedInitializerValue.type = CIMMOF_REFERENCE_VALUE;
652 karl 1.45 g_typedInitializerValue.value = $1;
653 $$ = &g_typedInitializerValue;
654 };
|
655 kumpf 1.17
|
656 e.boden 1.34
|
657 karl 1.32 // BUG 497 - Commmas embedded in strings in arrays change the
658 // strings. Aded function stringWComma to escape commas.
|
659 karl 1.45 constantValues: constantValue
660 {
661 *$$ = valueFactory::stringWComma(String(*$1)); }
662 | constantValues TOK_COMMA constantValue
663 {
664 YACCTRACE("constantValues:1, Value= " << *$3);
665 (*$$).append(",");
666 //(*$$).append(*$3);
667 (*$$).append(valueFactory::stringWComma(String(*$3)));
668 delete $3;
669 } ;
|
670 bob 1.1
|
671 e.boden 1.34
|
672 karl 1.45 // The nonNullConstantValue has been added to allow NULL
|
673 kumpf 1.17 // to be distinguished from the EMPTY STRING.
674
|
675 karl 1.45 constantValue: nonNullConstantValue
676 {$$ = $1;}
677 | TOK_NULL_VALUE
678 { $$ = new String(String::EMPTY); } ;
|
679 kumpf 1.17
|
680 e.boden 1.34
|
681 kumpf 1.17 nonNullConstantValue: integerValue { $$ = $1; }
|
682 karl 1.45 | TOK_REAL_VALUE
683 { $$ = $1; }
684 | TOK_CHAR_VALUE
685 { $$ = $1; }
686 | stringValues
687 { }
|
688 kumpf 1.57 | booleanValue
|
689 karl 1.45 {
690 $$ = new String($1 ? "T" : "F");
691 };
|
692 bob 1.1
|
693 e.boden 1.34
|
694 bob 1.1 integerValue: TOK_POSITIVE_DECIMAL_VALUE
|
695 karl 1.45 | TOK_OCTAL_VALUE
696 | TOK_HEX_VALUE
697 | TOK_BINARY_VALUE
|
698 kumpf 1.47 | TOK_SIGNED_DECIMAL_VALUE;
|
699 karl 1.45
700
701 booleanValue: TOK_FALSE
702 { $$ = 0; }
703 | TOK_TRUE
704 { $$ = 1; } ;
|
705 bob 1.1
|
706 e.boden 1.34
|
707 bob 1.1 stringValues: stringValue { $$ = $1; }
|
708 karl 1.45 | stringValues stringValue
709 {
710 (*$$).append(*$2); delete $2;
711 } ;
|
712 bob 1.1
|
713 e.boden 1.34
|
714 karl 1.45 stringValue: TOK_STRING_VALUE
715 {
|
716 e.boden 1.34 //String oldrep = *$1;
717 //String s(oldrep), s1(String::EMPTY);
|
718 bob 1.1 // Handle quoted quote
|
719 e.boden 1.34 //int len = s.size();
720 //if (s[len] == '\n') {
721 //error: new line inside a string constant unless it is quoted
722 //if (s[len - 2] == '\\') {
723 //if (len > 3)
|
724 karl 1.45 //s1 = s.subString(1, len-3);
|
725 e.boden 1.34 //} else {
726 //cimmof_error("New line in string constant");
727 //}
728 //cimmofParser::Instance()->increment_lineno();
729 //} else { // Can only be a quotation mark
730 //if (s[len - 2] == '\\') { // if it is quoted
731 //if (len > 3) s1 = s.subString(1, len-3);
732 //s1.append('\"');
733 //cimmof_yy_less(len-1);
734 //} else { // This is the normal case: real quotes on both end
735 //s1 = s.subString(1, len - 2) ;
736 //}
737 //}
738 //delete $1;
739 $$ = //new String(s1);
740 new String(*$1);
741 delete $1;
|
742 kumpf 1.17 } ;
|
743 bob 1.1
|
744 e.boden 1.34
|
745 karl 1.45 arrayInitializer:
746 TOK_LEFTCURLYBRACE constantValues TOK_RIGHTCURLYBRACE
747 { $$ = $2; }
748 | TOK_LEFTCURLYBRACE TOK_RIGHTCURLYBRACE
749 { $$ = new String(String::EMPTY); };
|
750 bob 1.1
|
751 e.boden 1.34
|
752 bob 1.1 referenceInitializer: objectHandle {}
|
753 karl 1.45 | aliasInitializer { } ;
|
754 bob 1.1
|
755 e.boden 1.34
|
756 bob 1.1 objectHandle: TOK_DQUOTE namespaceHandleRef modelPath TOK_DQUOTE
|
757 karl 1.45 {
|
758 kumpf 1.49 // The objectName string is decomposed for syntactical validation purposes
759 // and reassembled here for later parsing in creation of an CIMObjectPath
760 // instance
|
761 karl 1.45 String *s = new String(*$2);
762 if (!String::equal(*s, String::EMPTY) && $3)
763 (*s).append(":");
764 if ($3) {
|
765 kumpf 1.49 (*s).append($3->toString());
|
766 karl 1.45 }
767 $$ = s;
768 delete $2;
769 delete $3;
770 MOF_trace2 ("objectHandle done $$ = ", $$->getCString());
|
771 kumpf 1.17 } ;
|
772 bob 1.1
|
773 e.boden 1.34
|
774 karl 1.45 aliasInitializer : aliasIdentifier
775 {
776
777 CIMObjectPath AOP;
|
778 jim.wunderlich 1.40
|
779 karl 1.45 MOF_trace2("aliasInitializer $$ = ", $$->getCString());
780 MOF_trace2("aliasInitializer $1 = ", $1->getCString());
|
781 jim.wunderlich 1.40
|
782 karl 1.45 g_currentAliasRef = *$$;
|
783 jim.wunderlich 1.40
|
784 karl 1.45 MOF_trace2("aliasInitializer g_currentAliasRef = ",
785 g_currentAliasRef.getCString());
786 if (cimmofParser::Instance()->getInstanceAlias(g_currentAliasRef, AOP) == 0)
|
787 jim.wunderlich 1.40 {
|
788 karl 1.45 yyerror("aliasInitializer - 'aliasIdentifier' NOT FOUND");
789 YYABORT;
|
790 jim.wunderlich 1.40 }
791
|
792 karl 1.45 String *s = new String(AOP.toString());
|
793 jim.wunderlich 1.40
|
794 karl 1.45 $$ = s;
795
796 delete $1;
797
798 MOF_trace2 ("aliasInitializer done $$ = ", $$->getCString());
|
799 jim.wunderlich 1.40
800 };
|
801 bob 1.3
|
802 e.boden 1.34
|
803 bob 1.1 namespaceHandleRef: namespaceHandle TOK_COLON
|
804 karl 1.45 { }
805 | /* empty */ { $$ = new String(String::EMPTY); };
|
806 bob 1.1
|
807 e.boden 1.34
|
808 bob 1.1 namespaceHandle: stringValue {};
809
|
810 e.boden 1.34
|
811 bob 1.3 modelPath: className TOK_PERIOD keyValuePairList {
|
812 kumpf 1.49 CIMObjectPath *m = new CIMObjectPath(
813 String::EMPTY,
814 CIMNamespaceName(),
815 (*$1).getString(),
816 g_KeyBindingArray);
|
817 karl 1.45 g_KeyBindingArray.clear();
818 delete $1;} ;
|
819 bob 1.1
|
820 e.boden 1.34
|
821 karl 1.45 keyValuePairList: keyValuePair
822 { $$ = 0; }
823 | keyValuePairList TOK_COMMA keyValuePair
824 { $$ = 0; } ;
|
825 bob 1.1
|
826 e.boden 1.34
|
827 karl 1.45 keyValuePair: keyValuePairName TOK_EQUAL initializer
828 {
|
829 kumpf 1.49 CIMKeyBinding::Type keyBindingType;
830 Char16 firstChar = (*$3)[0];
831 if (firstChar = '\"')
832 keyBindingType = CIMKeyBinding::STRING;
833 else if ((firstChar == 'T') || (firstChar == 't') ||
834 (firstChar == 'F') || (firstChar == 'f'))
835 keyBindingType = CIMKeyBinding::BOOLEAN;
836 else
837 keyBindingType = CIMKeyBinding::NUMERIC;
838 CIMKeyBinding *kb = new CIMKeyBinding(*$1, *$3, keyBindingType);
|
839 karl 1.45 g_KeyBindingArray.append(*kb);
840 delete kb;
841 delete $1;
|
842 kumpf 1.57 delete $3;
|
843 karl 1.45 } ;
|
844 bob 1.1
|
845 e.boden 1.34
|
846 bob 1.1 keyValuePairName: TOK_SIMPLE_IDENTIFIER ;
847
|
848 e.boden 1.34
|
849 karl 1.45 alias: TOK_AS aliasIdentifier
850 {
851 $$ = $2;
852 g_currentAliasDecl = *$2;
853 MOF_trace2("aliasIdentifier $$ = ", $$->getCString());
854 MOF_trace2("aliasIdentifier g_currentAliasDecl = ",
855 g_currentAliasDecl.getCString());
856
857 }
858 | /* empty */ {
859 $$ = new String(String::EMPTY);
860 g_currentAliasDecl = String::EMPTY} ;
|
861 e.boden 1.34
|
862 bob 1.1
863 aliasIdentifier: TOK_ALIAS_IDENTIFIER ;
864
|
865 e.boden 1.34
|
866 karl 1.31 /*
867 **------------------------------------------------------------------------------
868 **
869 ** Instance Declaration productions and processing
870 **
|
871 jim.wunderlich 1.40 **-----------------------------------------------------------------------------
|
872 karl 1.31 */
873
|
874 bob 1.1 instanceDeclaration: instanceHead instanceBody
|
875 karl 1.45 {
876 $$ = g_currentInstance;
877 if (g_currentAliasDecl != String::EMPTY)
|
878 jim.wunderlich 1.40 {
|
879 karl 1.45 MOF_trace2("instanceDeclaration g_currentAliasDecl = ",
880 g_currentAliasDecl.getCString());
881 // MOF_trace2 ("instanceDeclaration instance =
882 // ", ((CIMObject *)$$)->toString().getCString());
883 if (cimmofParser::Instance()->addInstanceAlias(
884 g_currentAliasDecl, $$, true) == 0)
885 {
886 // Error alias already exist
887 MOF_error("ERROR: alias ALREADY EXISTS: aliasIdentifier = ",
888 g_currentAliasDecl.getCString());
889 yyerror("instanceDeclaration - 'aliasIdentifier' ALREADY EXISTS");
890 YYABORT;
891 }
|
892 jim.wunderlich 1.40 }
|
893 bob 1.1 };
894
|
895 e.boden 1.34
896
|
897 karl 1.45 instanceHead: qualifierList TOK_INSTANCE TOK_OF className alias
|
898 bob 1.1 {
|
899 karl 1.45 if (g_currentInstance)
900 delete g_currentInstance;
901 g_currentAliasDecl = *$5;
902 g_currentInstance = cimmofParser::Instance()->newInstance(*$4);
903 // apply the qualifierlist to the current instance
904 $$ = g_currentInstance;
|
905 kumpf 1.50 applyQualifierList(g_qualifierList, *$$);
|
906 karl 1.45 delete $4;
907 delete $5;
908 if (g_currentAliasDecl != String::EMPTY)
909 MOF_trace2("instanceHead g_currentAliasDecl = ",
910 g_currentAliasDecl.getCString());
|
911 bob 1.1 } ;
912
|
913 e.boden 1.34
914
|
915 bob 1.1 instanceBody: TOK_LEFTCURLYBRACE valueInitializers TOK_RIGHTCURLYBRACE
|
916 karl 1.45 TOK_SEMICOLON ;
|
917 bob 1.1
|
918 e.boden 1.34
919
|
920 bob 1.1 valueInitializers: valueInitializer
|
921 karl 1.45 | valueInitializers valueInitializer ;
|
922 bob 1.1
|
923 e.boden 1.34
924
|
925 kumpf 1.17 // ATTN-DE-P1-20020427: Processing NULL Initializer values is incomplete.
|
926 karl 1.45 // Currently only the arrayInitializer element has been modified to
|
927 kumpf 1.17 // return CIMMOF_NULL_VALUE
928 valueInitializer: qualifierList TOK_SIMPLE_IDENTIFIER TOK_EQUAL
|
929 karl 1.45 typedInitializer TOK_SEMICOLON
|
930 bob 1.1 {
|
931 kumpf 1.52 AutoPtr<String> identifier($2);
|
932 karl 1.45 cimmofParser *cp = cimmofParser::Instance();
933 // ATTN: P1 InstanceUpdate function 2001 BB Instance update needs
934 // work here and CIMOM
935 // a property. It must be fixed in the Common code first.
936 // What we have to do here is create a CIMProperty and initialize it with
937 // the value provided. The name of the property is $2 and it belongs
938 // to the class whose name is in g_currentInstance->getClassName().
939 // The steps are
940 // 2. Get property declaration's value object
|
941 kumpf 1.52 CIMProperty *oldprop =
942 cp->PropertyFromInstance(*g_currentInstance, *identifier);
|
943 karl 1.45 CIMValue *oldv = cp->ValueFromProperty(*oldprop);
944
945 // 3. create the new Value object of the same type
946
947 // We want createValue to interpret a value as an array if is enclosed
948 // in {}s (e.g., { 2 } or {2, 3, 5}) or it is NULL and the property is
949 // defined as an array. createValue is responsible for the actual
950 // validation.
951
952 CIMValue *v = valueFactory::createValue(oldv->getType(),
|
953 kumpf 1.53 (($4->type == CIMMOF_ARRAY_VALUE) ||
954 (($4->type == CIMMOF_NULL_VALUE) && oldprop->isArray()))?0:-1,
|
955 karl 1.45 ($4->type == CIMMOF_NULL_VALUE),
956 $4->value);
957
958
959 // 4. create a clone property with the new value
960 CIMProperty *newprop = cp->copyPropertyWithNewValue(*oldprop, *v);
961
962 // 5. apply the qualifiers;
|
963 kumpf 1.50 applyQualifierList(g_qualifierList, *newprop);
|
964 karl 1.45
965 // 6. and apply the CIMProperty to g_currentInstance.
966 cp->applyProperty(*g_currentInstance, *newprop);
967 delete $4->value;
968 delete oldprop;
969 delete oldv;
970 delete v;
971 delete newprop;
|
972 e.boden 1.34 };
973
974
975
976
|
977 bob 1.1
|
978 karl 1.31 /*
979 **------------------------------------------------------------------------------
980 **
981 ** Compiler directive productions and processing
982 **
983 **------------------------------------------------------------------------------
984 */
985
|
986 bob 1.1 compilerDirective: compilerDirectiveInclude
|
987 karl 1.45 {
988 //printf("compilerDirectiveInclude ");
989 }
990 | compilerDirectivePragma
991 {
992 //printf("compilerDirectivePragma ");
993 } ;
|
994 bob 1.1
|
995 e.boden 1.34
|
996 bob 1.1 compilerDirectiveInclude: TOK_PRAGMA TOK_INCLUDE TOK_LEFTPAREN fileName
|
997 karl 1.45 TOK_RIGHTPAREN
998 {
999 cimmofParser::Instance()->enterInlineInclude(*$4); delete $4;
1000 };
|
1001 e.boden 1.34
|
1002 bob 1.1
1003 fileName: stringValue { $$ = $1; } ;
|
1004 e.boden 1.34
1005
|
1006 bob 1.1 compilerDirectivePragma: TOK_PRAGMA pragmaName
|
1007 karl 1.45 TOK_LEFTPAREN pragmaVal TOK_RIGHTPAREN
1008 {
1009 cimmofParser::Instance()->processPragma(*$2, *$4);
1010 delete $2;
1011 delete $4;
1012 };
|
1013 bob 1.1
|
1014 e.boden 1.34
1015
1016
|
1017 karl 1.31 /*
1018 **------------------------------------------------------------------------------
1019 **
1020 ** qualifier Declaration productions and processing
1021 **
1022 **------------------------------------------------------------------------------
1023 */
1024
|
1025 bob 1.1 qualifierDeclaration: TOK_QUALIFIER qualifierName qualifierValue scope
|
1026 karl 1.45 defaultFlavor TOK_SEMICOLON
|
1027 bob 1.1 {
|
1028 karl 1.45 $$ = cimmofParser::Instance()->newQualifierDecl(*$2, $3, *$4, *$5);
|
1029 dmitry.mikulin 1.51 delete $2;
|
1030 karl 1.45 delete $3; // CIMValue object created in qualifierValue production
|
1031 dmitry.mikulin 1.51 delete $4; // CIMScope object created in scope/metaElements production
|
1032 bob 1.1 } ;
1033
1034
|
1035 kumpf 1.18 qualifierValue: TOK_COLON dataType array typedDefaultValue
|
1036 bob 1.1 {
|
1037 karl 1.45 $$ = valueFactory::createValue($2, $3,
1038 ($4->type == CIMMOF_NULL_VALUE),
1039 $4->value);
|
1040 kumpf 1.18 delete $4->value;
|
1041 kumpf 1.17 } ;
|
1042 bob 1.1
|
1043 e.boden 1.34
|
1044 kumpf 1.26 scope: scope_begin metaElements TOK_RIGHTPAREN { $$ = $2; } ;
|
1045 bob 1.1
|
1046 e.boden 1.34
|
1047 karl 1.45 scope_begin: TOK_COMMA TOK_SCOPE TOK_LEFTPAREN
1048 {
1049 g_scope = CIMScope (CIMScope::NONE);
1050 } ;
|
1051 bob 1.1
|
1052 e.boden 1.34
|
1053 bob 1.1 metaElements: metaElement { $$ = $1; }
|
1054 karl 1.45 | metaElements TOK_COMMA metaElement
|
1055 kumpf 1.57 {
1056 $$->addScope(*$3);
|
1057 dmitry.mikulin 1.51 delete $3;
1058 } ;
|
1059 karl 1.16 // ATTN: 2001 P3 defer There is not CIMScope::SCHEMA. Spec Limit KS
|
1060 bob 1.1
|
1061 e.boden 1.34
|
1062 kumpf 1.26 metaElement: TOK_CLASS { $$ = new CIMScope(CIMScope::CLASS); }
1063 // | TOK_SCHEMA { $$ = new CIMScope(CIMScope::SCHEMA); }
1064 | TOK_SCHEMA { $$ = new CIMScope(CIMScope::CLASS); }
1065 | TOK_ASSOCIATION { $$ = new CIMScope(CIMScope::ASSOCIATION); }
1066 | TOK_INDICATION { $$ = new CIMScope(CIMScope::INDICATION); }
1067 // | TOK_QUALIFIER { $$ = new CIMScope(CIMScope::QUALIFIER); }
1068 | TOK_PROPERTY { $$ = new CIMScope(CIMScope::PROPERTY); }
1069 | TOK_REFERENCE { $$ = new CIMScope(CIMScope::REFERENCE); }
1070 | TOK_METHOD { $$ = new CIMScope(CIMScope::METHOD); }
1071 | TOK_PARAMETER { $$ = new CIMScope(CIMScope::PARAMETER); }
1072 | TOK_ANY { $$ = new CIMScope(CIMScope::ANY); } ;
|
1073 bob 1.1
|
1074 e.boden 1.34
|
1075 karl 1.11 // Correction KS 4 march 2002 - Set the default if empty
|
1076 bob 1.1 defaultFlavor: TOK_COMMA flavorHead explicitFlavors TOK_RIGHTPAREN
|
1077 karl 1.45 { $$ = &g_flavor; }
|
1078 kumpf 1.57 | /* empty */
|
1079 dmitry.mikulin 1.51 {
1080 g_flavor = CIMFlavor (CIMFlavor::NONE);
1081 $$ = &g_flavor;
1082 } ;
|
1083 bob 1.1
|
1084 e.boden 1.34
|
1085 karl 1.11 // Correction KS 4 March 2002 - set the defaults (was zero)
1086 // Set the flavors for the defaults required: via DEFAULTS
1087
|
1088 kumpf 1.57 flavorHead: TOK_FLAVOR TOK_LEFTPAREN
|
1089 karl 1.45 {g_flavor = CIMFlavor (CIMFlavor::NONE);};
|
1090 bob 1.1
|
1091 e.boden 1.34
|
1092 bob 1.1 explicitFlavors: explicitFlavor
|
1093 karl 1.45 | explicitFlavors TOK_COMMA explicitFlavor ;
|
1094 bob 1.1
|
1095 mike 1.10
|
1096 karl 1.45 // ATTN:KS-26/03/02 P2 This accumulates the flavor definitions.
1097 // However, it allows multiple instances
|
1098 karl 1.15 // of any keyword. Note also that each entity simply sets a bit so that you may
1099 // set disable and enable and we will not know which overrides the other.
|
1100 karl 1.45 // We need to create the function to insure that you cannot enable then
1101 //disable or accept the latter and override the former.
|
1102 karl 1.15
|
1103 karl 1.45 // The compiler simply provides the flavors defined in the MOF and does not
1104 // make any assumptions about defaults, etc. That is a problem for
1105 // resolution of the flavors.
1106
1107 explicitFlavor: TOK_ENABLEOVERRIDE
1108 { g_flavor.addFlavor (CIMFlavor::ENABLEOVERRIDE); }
1109 | TOK_DISABLEOVERRIDE { g_flavor.addFlavor (CIMFlavor::DISABLEOVERRIDE); }
1110 | TOK_RESTRICTED { g_flavor.addFlavor (CIMFlavor::RESTRICTED); }
|
1111 kumpf 1.58 | TOK_TOSUBCLASS { g_flavor.addFlavor (CIMFlavor::TOSUBCLASS); }
|
1112 karl 1.45 | TOK_TRANSLATABLE { g_flavor.addFlavor (CIMFlavor::TRANSLATABLE); };
|
1113 bob 1.1
|
1114 e.boden 1.34
|
1115 kumpf 1.25 flavor: overrideFlavors { $$ = &g_flavor; }
|
1116 kumpf 1.57 | /* empty */
1117 {
|
1118 dmitry.mikulin 1.51 g_flavor = CIMFlavor (CIMFlavor::NONE);
1119 $$ = &g_flavor;
1120 } ;
|
1121 bob 1.1
|
1122 e.boden 1.34
|
1123 bob 1.1 overrideFlavors: explicitFlavor
|
1124 karl 1.45 | overrideFlavors explicitFlavor ;
|
1125 bob 1.1
|
1126 e.boden 1.34
1127
|
1128 bob 1.1 dataType: intDataType { $$ = $1; }
|
1129 karl 1.45 | realDataType { $$ = $1; }
1130 | TOK_DT_STR { $$ = CIMTYPE_STRING; }
1131 | TOK_DT_BOOL { $$ = CIMTYPE_BOOLEAN; }
1132 | TOK_DT_DATETIME { $$ = CIMTYPE_DATETIME; } ;
|
1133 kumpf 1.22
|
1134 e.boden 1.34
|
1135 kumpf 1.22 intDataType: TOK_DT_UINT8 { $$ = CIMTYPE_UINT8; }
|
1136 karl 1.45 | TOK_DT_SINT8 { $$ = CIMTYPE_SINT8; }
1137 | TOK_DT_UINT16 { $$ = CIMTYPE_UINT16; }
1138 | TOK_DT_SINT16 { $$ = CIMTYPE_SINT16; }
1139 | TOK_DT_UINT32 { $$ = CIMTYPE_UINT32; }
1140 | TOK_DT_SINT32 { $$ = CIMTYPE_SINT32; }
1141 | TOK_DT_UINT64 { $$ = CIMTYPE_UINT64; }
1142 | TOK_DT_SINT64 { $$ = CIMTYPE_SINT64; }
1143 | TOK_DT_CHAR16 { $$ = CIMTYPE_CHAR16; } ;
|
1144 karl 1.31
|
1145 e.boden 1.34
|
1146 kumpf 1.57 realDataType: TOK_DT_REAL32
|
1147 karl 1.45 { $$ =CIMTYPE_REAL32; }
|
1148 kumpf 1.57 | TOK_DT_REAL64
|
1149 karl 1.45 { $$ =CIMTYPE_REAL64; };
|
1150 e.boden 1.34
|
1151 karl 1.31 /*
1152 **------------------------------------------------------------------------------
1153 **
1154 ** Qualifier list and qualifier processing
1155 **
1156 **------------------------------------------------------------------------------
1157 */
|
1158 karl 1.45 qualifierList: qualifierListBegin qualifiers TOK_RIGHTSQUAREBRACKET
|
1159 kumpf 1.57 | /* empty */
|
1160 karl 1.45 {
|
1161 karl 1.46 //yydebug = 1; stderr = stdout;
|
1162 karl 1.45 };
|
1163 e.boden 1.34
|
1164 karl 1.45 qualifierListBegin: TOK_LEFTSQUAREBRACKET {
|
1165 e.boden 1.34 //yydebug = 1; stderr = stdout;
|
1166 karl 1.31 YACCTRACE("qualifierListbegin");
|
1167 kumpf 1.50 g_qualifierList.clear(); } ;
|
1168 bob 1.1
|
1169 karl 1.45 qualifiers: qualifier
1170 { }
1171 | qualifiers TOK_COMMA qualifier
1172 { } ;
|
1173 e.boden 1.34
|
1174 kumpf 1.20 qualifier: qualifierName typedQualifierParameter flavor
|
1175 bob 1.1 {
|
1176 karl 1.45 cimmofParser *p = cimmofParser::Instance();
1177 // The qualifier value can't be set until we know the contents of the
1178 // QualifierDeclaration. That's what QualifierValue() does.
1179 CIMValue *v = p->QualifierValue(*$1,
1180 ($2->type == CIMMOF_NULL_VALUE), *$2->value);
1181 $$ = p->newQualifier(*$1, *v, g_flavor);
|
1182 kumpf 1.50 g_qualifierList.add(*$$);
1183 delete $$;
|
1184 karl 1.45 delete $1;
1185 delete $2->value;
1186 delete v;
1187 } ;
|
1188 e.boden 1.34
|
1189 karl 1.45 qualifierName: TOK_SIMPLE_IDENTIFIER {
1190 g_flavor = CIMFlavor (CIMFlavor::NONE); }
1191 | metaElement {
1192 $$ = new String((*$1).toString ());
|
1193 kumpf 1.57 g_flavor = CIMFlavor (CIMFlavor::NONE);
|
1194 dmitry.mikulin 1.51 delete $1; } ;
|
1195 bob 1.1
|
1196 e.boden 1.34
1197
|
1198 karl 1.45 typedQualifierParameter: TOK_LEFTPAREN nonNullConstantValue TOK_RIGHTPAREN
1199 {
1200 g_typedInitializerValue.type = CIMMOF_CONSTANT_VALUE;
1201 g_typedInitializerValue.value = $2;
1202 $$ = &g_typedInitializerValue;
1203 }
1204 | TOK_LEFTPAREN TOK_NULL_VALUE TOK_RIGHTPAREN
1205 {
1206 g_typedInitializerValue.type = CIMMOF_NULL_VALUE;
1207 g_typedInitializerValue.value = new String(String::EMPTY);
1208 $$ = &g_typedInitializerValue;
1209 }
1210 | arrayInitializer
1211 {
1212 g_typedInitializerValue.type = CIMMOF_ARRAY_VALUE;
1213 g_typedInitializerValue.value = $1;
1214 $$ = &g_typedInitializerValue;
1215 }
1216 | { /* empty */
1217 g_typedInitializerValue.type = CIMMOF_NULL_VALUE;
1218 g_typedInitializerValue.value = new String(String::EMPTY);
1219 karl 1.45 $$ = &g_typedInitializerValue;
1220 };
|
1221 bob 1.1
|
1222 e.boden 1.34
|
1223 bob 1.1 pragmaName: TOK_SIMPLE_IDENTIFIER { $$ = $1; } ;
1224
|
1225 e.boden 1.34
|
1226 bob 1.1 pragmaVal: TOK_STRING_VALUE { $$ = $1; } ;
1227
1228 %%
|
1229 jim.wunderlich 1.40
1230 /*
1231 **==============================================================================
1232 **
1233 ** MOF_error():
1234 **
1235 **==============================================================================
1236 */
1237 static void MOF_error(const char * str, const char * S)
1238 {
|
1239 karl 1.45 printf("%s %s\n", str, S);
|
1240 jim.wunderlich 1.40 }
1241
1242 /*
1243 **==============================================================================
1244 **
1245 ** MOF_trace():
1246 **
1247 **==============================================================================
1248 */
1249 // #define DEBUG_cimmof 1
1250
1251 static void MOF_trace(const char* str)
1252 {
1253 #ifdef DEBUG_cimmof
1254 printf("MOF_trace(): %s \n", str);
1255 #endif // DEBUG_cimmof
1256 }
1257
1258 static void MOF_trace2(const char * str, const char * S)
1259 {
1260 #ifdef DEBUG_cimmof
|
1261 karl 1.45 printf("MOF_trace2(): %s %s\n", str, S);
|
1262 jim.wunderlich 1.40 #endif // DEBUG_cimmof
1263 }
|