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