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 //
21 // 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 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 a) Interfaces to the Repository. You call cimmofParser::
59 methods to query and store compiled CIM elements.
60 b) Error handling.
61 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 gs.keenan 1.38 #if !defined(PEGASUS_PLATFORM_ZOS_ZSERIES_IBM) && !defined(__OS400__) && !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 bob 1.1 #include "cimmofParser.h"
83 #include "valueFactory.h"
84 #include "memobjs.h"
85 #include "qualifierList.h"
|
86 bob 1.3 #include "objname.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 qualifierList g_qualifierList(20);
|
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 kumpf 1.17 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 bob 1.1 /* I don't understand them, so it may be a while before they are */
139 /* ------------------------------------------------------------------- */
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 modelPath *modelpath;
187 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 e.boden 1.34 %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 e.boden 1.34 %type <strval> pragmaName pragmaVal keyValuePairName qualifierName
|
284 jim.wunderlich 1.40 %type <strval> referenceInitializer objectHandle
285 %type <strval> aliasInitializer
286 %type <strval> aliasIdentifier
|
287 e.boden 1.34 %type <strval> stringValue stringValues initializer constantValue
|
288 jim.wunderlich 1.40 %type <strval> TOK_ALIAS_IDENTIFIER alias
|
289 e.boden 1.34 %type <strval> TOK_POSITIVE_DECIMAL_VALUE TOK_OCTAL_VALUE TOK_HEX_VALUE
290 %type <strval> TOK_SIGNED_DECIMAL_VALUE TOK_BINARY_VALUE
291 %type <strval> TOK_SIMPLE_IDENTIFIER TOK_STRING_VALUE
292 %type <strval> TOK_UNEXPECTED_CHAR
|
293 kumpf 1.20 %type <typedinitializer> typedInitializer typedDefaultValue
294 %type <typedinitializer> typedQualifierParameter
|
295 e.boden 1.34 %type <value> qualifierValue
|
296 kumpf 1.17
|
297 karl 1.31
298
299
300
|
301 e.boden 1.34 %%
|
302 karl 1.31
303
304
305
306 /*
307 **------------------------------------------------------------------------------
308 **
309 ** Production rules section
310 **
311 **------------------------------------------------------------------------------
312 */
|
313 kumpf 1.17 mofSpec: mofProductions ;
|
314 bob 1.1
|
315 e.boden 1.34
|
316 bob 1.1 mofProductions: mofProduction mofProductions
317 | /* empty */ ;
|
318 e.boden 1.34
319
|
320 karl 1.16 // ATTN: P1 KS Apr 2002 Limit in (none) Directive handling. See FIXME below.
|
321 bob 1.1 mofProduction: compilerDirective { /* FIXME: Where do we put directives? */ }
322 | qualifierDeclaration
323 { cimmofParser::Instance()->addQualifier($1); delete $1; }
324 | classDeclaration
325 { cimmofParser::Instance()->addClass($1); }
326 | instanceDeclaration
|
327 bob 1.4 { cimmofParser::Instance()->addInstance($1); } ;
|
328 bob 1.1
|
329 e.boden 1.34
330
331
|
332 karl 1.31 /*
333 **------------------------------------------------------------------------------
334 **
335 ** class Declaration productions and processing
336 **
337 **------------------------------------------------------------------------------
338 */
|
339 bob 1.1 classDeclaration: classHead classBody
340 {
|
341 karl 1.31 YACCTRACE("classDeclaration");
|
342 jim.wunderlich 1.40 if (g_currentAliasDecl != String::EMPTY)
343 cimmofParser::Instance()->addClassAlias(g_currentAliasDecl, $$, false);
|
344 bob 1.1 } ;
345
|
346 e.boden 1.34
|
347 bob 1.1 classHead: qualifierList TOK_CLASS className alias superClass
348 {
|
349 karl 1.31 // create new instance of class with className and superclassName
350 // put returned class object on stack
351 YACCTRACE("classHead:");
352 $$ = cimmofParser::Instance()->newClassDecl(*$3, *$5);
353
354 // put list of qualifiers into class
355 applyQualifierList(&g_qualifierList, $$);
356
|
357 jim.wunderlich 1.40 g_currentAliasRef = *$4;
|
358 karl 1.31 if (g_currentClass)
359 delete g_currentClass;
360 g_currentClass = $$;
361 delete $3;
362 delete $4;
363 delete $5;
|
364 kumpf 1.17 } ;
|
365 bob 1.1
|
366 e.boden 1.34
367 className: TOK_SIMPLE_IDENTIFIER {} ;
368
|
369 bob 1.1
|
370 kumpf 1.23 superClass: TOK_COLON className { $$ = new CIMName(*$2); }
371 | /* empty */ { $$ = new CIMName(); } ;
|
372 bob 1.1
|
373 e.boden 1.34
|
374 bob 1.1 classBody: TOK_LEFTCURLYBRACE classFeatures TOK_RIGHTCURLYBRACE TOK_SEMICOLON
375 | TOK_LEFTCURLYBRACE TOK_RIGHTCURLYBRACE TOK_SEMICOLON ;
376
|
377 e.boden 1.34
|
378 bob 1.1 classFeatures: classFeature
379 | classFeatures classFeature ;
380
|
381 e.boden 1.34
|
382 bob 1.1 classFeature: propertyDeclaration {
|
383 karl 1.31 YACCTRACE("classFeature:applyProperty");
|
384 bob 1.3 cimmofParser::Instance()->applyProperty(*g_currentClass, *$1); delete $1; }
|
385 bob 1.1 | methodDeclaration {
|
386 karl 1.31 YACCTRACE("classFeature:applyMethod");
|
387 bob 1.1 cimmofParser::Instance()->applyMethod(*g_currentClass, *$1); }
388 | referenceDeclaration {
|
389 karl 1.31 YACCTRACE("classFeature:applyProperty");
|
390 bob 1.3 cimmofParser::Instance()->applyProperty(*g_currentClass, *$1); delete $1; };
|
391 bob 1.1
|
392 e.boden 1.34
393
394
395
396
|
397 karl 1.31 /*
398 **------------------------------------------------------------------------------
399 **
400 ** method Declaration productions and processing.
401 **
402 **------------------------------------------------------------------------------
403 */
404
405 methodDeclaration: qualifierList methodHead methodBody methodEnd
|
406 bob 1.1 {
|
407 karl 1.31 YACCTRACE("methodDeclaration");
|
408 bob 1.1 $$ = $2;
409 } ;
410
|
411 e.boden 1.34
412
|
413 karl 1.31 // methodHead processes the datatype and methodName and puts qualifierList.
414 // BUG 366. qualifier list was originally placed on in methoddeclaration
415 // which meant it might be overwritten by parameter qualifier lists.
416 methodHead: dataType methodName
|
417 bob 1.1 {
|
418 karl 1.31 YACCTRACE("methodHead");
419 if (g_currentMethod)
|
420 bob 1.1 delete g_currentMethod;
|
421 karl 1.31
422 // create new method instance with pointer to method name and datatype
423 g_currentMethod = cimmofParser::Instance()->newMethod(*$2, $1) ;
424
425 // put new method on stack
|
426 bob 1.1 $$ = g_currentMethod;
|
427 karl 1.31
428 // apply the method qualifier list.
429 applyQualifierList(&g_qualifierList, $$);
430
|
431 bob 1.1 delete $2;
432 } ;
433
|
434 e.boden 1.34
|
435 bob 1.1 methodBody: TOK_LEFTPAREN parameters TOK_RIGHTPAREN ;
436
|
437 e.boden 1.34
|
438 bob 1.1 methodEnd: TOK_SEMICOLON ;
439
|
440 e.boden 1.34
|
441 karl 1.31 methodName: TOK_SIMPLE_IDENTIFIER { $$ = new CIMName(*$1); } ;
442
|
443 e.boden 1.34
|
444 karl 1.31 //
445 // Productions for method parameters
446 //
447 parameters : parameter
448 | parameters TOK_COMMA parameter
449 | /* empty */ ;
450
|
451 e.boden 1.34
|
452 karl 1.31 parameter: qualifierList parameterType parameterName array
453 {
454 // ATTN: P2 2002 Question Need to create default value including type?
455
456 YACCTRACE("parameter:");
457 CIMParameter *p = 0;
458 cimmofParser *cp = cimmofParser::Instance();
459
460 // Create new parameter with name, type, isArray, array, referenceClassName
461 if ($4 == -1) {
462 p = cp->newParameter(*$3, $2, false, 0, g_referenceClassName);
463 } else {
464 p = cp->newParameter(*$3, $2, true, $4, g_referenceClassName);
465 }
466
467 g_referenceClassName = CIMName();
468
469 YACCTRACE("parameter:applyQualifierList");
470 applyQualifierList(&g_qualifierList, p);
471
472 cp->applyParameter(*g_currentMethod, *p);
473 karl 1.31 delete p;
474 delete $3;
475 } ;
476
|
477 e.boden 1.34
|
478 karl 1.31 parameterType: dataType { $$ = $1; }
479 | objectRef { $$ = CIMTYPE_REFERENCE; } ;
480
|
481 e.boden 1.34
482
483
484
485
|
486 karl 1.31 /*
487 **------------------------------------------------------------------------------
488 **
489 ** property Declaration productions and processing
490 **
491 **------------------------------------------------------------------------------
492 */
|
493 e.boden 1.34
|
494 bob 1.1 propertyDeclaration: qualifierList propertyBody propertyEnd
495 {
|
496 karl 1.31 // set body to stack and apply qualifier list
497 // ATTN: the apply qualifer only works here because
498 // there are not lower level qualifiers. We do productions
499 // that might have lower level qualifiers differently by
500 // setting up a xxxHead production where qualifiers are
501 // applied.
502 YACCTRACE("propertyDeclaration:");
503 $$ = $2;
504 applyQualifierList(&g_qualifierList, $$);
|
505 bob 1.1 } ;
506
|
507 e.boden 1.34
|
508 kumpf 1.18 propertyBody: dataType propertyName array typedDefaultValue
|
509 bob 1.1 {
|
510 kumpf 1.18 CIMValue *v = valueFactory::createValue($1, $3,
511 ($4->type == CIMMOF_NULL_VALUE), $4->value);
|
512 karl 1.13 if ($3 == -1) {
513 $$ = cimmofParser::Instance()->newProperty(*$2, *v, false, 0);
514 } else {
515 $$ = cimmofParser::Instance()->newProperty(*$2, *v, true, $3);
516 }
517
|
518 bob 1.1 delete $2;
|
519 kumpf 1.19 delete $4->value;
|
520 bob 1.1 delete v;
521 } ;
522
|
523 e.boden 1.34
|
524 bob 1.1 propertyEnd: TOK_SEMICOLON ;
|
525 e.boden 1.34
526
527
528
529
530
|
531 karl 1.31 /*
532 **------------------------------------------------------------------------------
533 **
534 ** reference Declaration productions and processing
535 **
536 **------------------------------------------------------------------------------
537 */
|
538 bob 1.1
539 referenceDeclaration: qualifierList referencedObject TOK_REF referenceName
540 referencePath TOK_SEMICOLON
541 {
|
542 bob 1.3 String s(*$2);
543 if (!String::equal(*$5, String::EMPTY))
|
544 kumpf 1.28 s.append("." + *$5);
|
545 kumpf 1.22 CIMValue *v = valueFactory::createValue(CIMTYPE_REFERENCE, -1, true, &s);
|
546 karl 1.13 //KS add the isArray and arraysize parameters. 8 mar 2002
547 $$ = cimmofParser::Instance()->newProperty(*$4, *v, false,0, *$2);
|
548 karl 1.31 applyQualifierList(&g_qualifierList, $$);
|
549 bob 1.1 delete $2;
550 delete $4;
551 delete $5;
|
552 bob 1.3 delete v;
|
553 bob 1.1 } ;
554
|
555 e.boden 1.34
|
556 bob 1.1 referencedObject: TOK_SIMPLE_IDENTIFIER { $$ = $1; } ;
557
|
558 e.boden 1.34
|
559 bob 1.1 referenceName: TOK_SIMPLE_IDENTIFIER { $$ = $1; };
560
|
561 e.boden 1.34
|
562 bob 1.1 referencePath: TOK_EQUAL stringValue { $$ = $2; }
563 | /* empty */ { $$ = new String(String::EMPTY); } ;
564
|
565 e.boden 1.34
|
566 bob 1.3 objectRef: className TOK_REF {
567 g_referenceClassName = *$1; } ;
|
568 bob 1.1
|
569 e.boden 1.34
|
570 kumpf 1.23 parameterName: TOK_SIMPLE_IDENTIFIER { $$ = new CIMName(*$1); } ;
|
571 bob 1.1
|
572 e.boden 1.34
|
573 kumpf 1.23 propertyName: TOK_SIMPLE_IDENTIFIER { $$ = new CIMName(*$1); } ;
|
574 bob 1.1
|
575 e.boden 1.34
|
576 bob 1.1 array: TOK_LEFTSQUAREBRACKET TOK_POSITIVE_DECIMAL_VALUE
577 TOK_RIGHTSQUAREBRACKET
578 { $$ = valueFactory::Stoi(*$2);
579 delete $2;
580 }
581 | TOK_LEFTSQUAREBRACKET TOK_RIGHTSQUAREBRACKET { $$ = 0; }
|
582 kumpf 1.17 | /* empty */ { $$ = -1; } ;
|
583 bob 1.1
|
584 e.boden 1.34
|
585 kumpf 1.18 typedDefaultValue: TOK_EQUAL typedInitializer { $$ = $2; }
586 | { /* empty */
587 g_typedInitializerValue.type = CIMMOF_NULL_VALUE;
588 g_typedInitializerValue.value = new String(String::EMPTY);
589 $$ = &g_typedInitializerValue;
590 };
|
591 bob 1.1
|
592 e.boden 1.34
|
593 bob 1.1 initializer: constantValue { $$ = $1; }
594 | arrayInitializer { $$ = $1; }
|
595 bob 1.3 | referenceInitializer { $$ = $1; } ;
|
596 bob 1.1
|
597 e.boden 1.34
|
598 kumpf 1.17 // The typedInitializer element is syntactially identical to
599 // the initializer element. However, the typedInitializer element
600 // returns, in addition to the value, the type of the value.
601 typedInitializer: nonNullConstantValue
602 {
603 g_typedInitializerValue.type = CIMMOF_CONSTANT_VALUE;
604 g_typedInitializerValue.value = $1;
605 $$ = &g_typedInitializerValue;
606 }
607 | TOK_NULL_VALUE
608 {
609 g_typedInitializerValue.type = CIMMOF_NULL_VALUE;
610 g_typedInitializerValue.value = new String(String::EMPTY);
611 $$ = &g_typedInitializerValue;
612 }
613 | arrayInitializer
614 {
615 g_typedInitializerValue.type = CIMMOF_ARRAY_VALUE;
616 g_typedInitializerValue.value = $1;
617 $$ = &g_typedInitializerValue;
618 }
619 kumpf 1.17 | referenceInitializer
620 {
621 g_typedInitializerValue.type = CIMMOF_REFERENCE_VALUE;
622 g_typedInitializerValue.value = $1;
623 $$ = &g_typedInitializerValue;
624 };
625
|
626 e.boden 1.34
|
627 karl 1.32 // BUG 497 - Commmas embedded in strings in arrays change the
628 // strings. Aded function stringWComma to escape commas.
629 constantValues: constantValue {
630 *$$ = valueFactory::stringWComma(String(*$1)); }
631 | constantValues TOK_COMMA constantValue
632 {
633 YACCTRACE("constantValues:1, Value= " << *$3);
634 (*$$).append(",");
635 //(*$$).append(*$3);
636 (*$$).append(valueFactory::stringWComma(String(*$3)));
637 delete $3;
638 } ;
|
639 bob 1.1
|
640 e.boden 1.34
|
641 kumpf 1.17 // The nonNullConstantValue has been added to allow NULL
642 // to be distinguished from the EMPTY STRING.
643
644 constantValue: nonNullConstantValue {$$ = $1;}
645 | TOK_NULL_VALUE { $$ = new String(String::EMPTY); } ;
646
|
647 e.boden 1.34
|
648 kumpf 1.17 nonNullConstantValue: integerValue { $$ = $1; }
|
649 bob 1.1 | TOK_REAL_VALUE { $$ = $1; }
650 | TOK_CHAR_VALUE { $$ = $1; }
651 | stringValues { }
|
652 kumpf 1.17 | booleanValue { $$ = new String($1 ? "T" : "F"); };
|
653 bob 1.1
|
654 e.boden 1.34
|
655 bob 1.1 integerValue: TOK_POSITIVE_DECIMAL_VALUE
656 | TOK_SIGNED_DECIMAL_VALUE
657 | TOK_OCTAL_VALUE {
658 $$ = new String(cimmofParser::Instance()->oct_to_dec(*$1));
659 delete $1; }
660 | TOK_HEX_VALUE {
661 $$ = new String(cimmofParser::Instance()->hex_to_dec(*$1));
662 delete $1; }
663 | TOK_BINARY_VALUE {
664 $$ = new String(cimmofParser::Instance()->binary_to_dec(*$1));
665 delete $1; };
666
|
667 e.boden 1.34
|
668 bob 1.1 booleanValue: TOK_FALSE { $$ = 0; }
669 | TOK_TRUE { $$ = 1; } ;
670
|
671 e.boden 1.34
|
672 bob 1.1 stringValues: stringValue { $$ = $1; }
673 | stringValues stringValue
674 {
|
675 kumpf 1.28 (*$$).append(*$2); delete $2;
|
676 bob 1.1 } ;
677
|
678 e.boden 1.34
|
679 bob 1.1 stringValue: TOK_STRING_VALUE
680 {
|
681 e.boden 1.34 //String oldrep = *$1;
682 //String s(oldrep), s1(String::EMPTY);
|
683 bob 1.1 // Handle quoted quote
|
684 e.boden 1.34 //int len = s.size();
685 //if (s[len] == '\n') {
686 //error: new line inside a string constant unless it is quoted
687 //if (s[len - 2] == '\\') {
688 //if (len > 3)
689 //s1 = s.subString(1, len-3);
690 //} else {
691 //cimmof_error("New line in string constant");
692 //}
693 //cimmofParser::Instance()->increment_lineno();
694 //} else { // Can only be a quotation mark
695 //if (s[len - 2] == '\\') { // if it is quoted
696 //if (len > 3) s1 = s.subString(1, len-3);
697 //s1.append('\"');
698 //cimmof_yy_less(len-1);
699 //} else { // This is the normal case: real quotes on both end
700 //s1 = s.subString(1, len - 2) ;
701 //}
702 //}
703 //delete $1;
704 $$ = //new String(s1);
705 e.boden 1.34 new String(*$1);
706 delete $1;
|
707 kumpf 1.17 } ;
|
708 bob 1.1
|
709 e.boden 1.34
|
710 kumpf 1.17 arrayInitializer:
711 TOK_LEFTCURLYBRACE constantValues TOK_RIGHTCURLYBRACE
712 { $$ = $2; }
713 | TOK_LEFTCURLYBRACE TOK_RIGHTCURLYBRACE
714 { $$ = new String(String::EMPTY); };
|
715 bob 1.1
|
716 e.boden 1.34
|
717 bob 1.1 referenceInitializer: objectHandle {}
|
718 bob 1.3 | aliasInitializer { } ;
|
719 bob 1.1
|
720 e.boden 1.34
|
721 bob 1.1 objectHandle: TOK_DQUOTE namespaceHandleRef modelPath TOK_DQUOTE
722 {
|
723 bob 1.3 // The objectName string is decomposed for syntactical purposes
724 // and reassembled here for later parsing in creation of an objname instance
725 String *s = new String(*$2);
726 if (!String::equal(*s, String::EMPTY) && $3)
|
727 kumpf 1.28 (*s).append(":");
|
728 bob 1.3 if ($3) {
|
729 kumpf 1.28 (*s).append($3->Stringrep());
|
730 bob 1.3 }
731 $$ = s;
|
732 bob 1.1 delete $2;
733 delete $3;
|
734 jim.wunderlich 1.40 MOF_trace2 ("objectHandle done $$ = ", $$->getCString());
|
735 kumpf 1.17 } ;
|
736 bob 1.1
|
737 e.boden 1.34
|
738 bob 1.3 aliasInitializer : aliasIdentifier {
|
739 jim.wunderlich 1.40
740 CIMObjectPath AOP;
741
742 MOF_trace2("aliasInitializer $$ = ", $$->getCString());
743 MOF_trace2("aliasInitializer $1 = ", $1->getCString());
744
745 g_currentAliasRef = *$$;
746
747 MOF_trace2("aliasInitializer g_currentAliasRef = ", g_currentAliasRef.getCString());
748 if (cimmofParser::Instance()->getInstanceAlias(g_currentAliasRef, AOP) == 0)
749 {
750 yyerror("aliasInitializer - 'aliasIdentifier' NOT FOUND");
751 YYABORT;
752 }
753
754 String *s = new String(AOP.toString());
755
756 $$ = s;
757
758 delete $1;
759
760 jim.wunderlich 1.40 MOF_trace2 ("aliasInitializer done $$ = ", $$->getCString());
761
762 };
|
763 bob 1.3
|
764 e.boden 1.34
|
765 bob 1.1 namespaceHandleRef: namespaceHandle TOK_COLON
766 { }
767 | /* empty */ { $$ = new String(String::EMPTY); };
768
|
769 e.boden 1.34
|
770 bob 1.1 namespaceHandle: stringValue {};
771
|
772 e.boden 1.34
|
773 bob 1.3 modelPath: className TOK_PERIOD keyValuePairList {
|
774 kumpf 1.30 modelPath *m = new modelPath((*$1).getString(), g_KeyBindingArray);
|
775 bob 1.3 g_KeyBindingArray.clear();
|
776 bob 1.1 delete $1;} ;
777
|
778 e.boden 1.34
|
779 bob 1.3 keyValuePairList: keyValuePair { $$ = 0; }
780 | keyValuePairList TOK_COMMA keyValuePair { $$ = 0; } ;
|
781 bob 1.1
|
782 e.boden 1.34
|
783 bob 1.1 keyValuePair: keyValuePairName TOK_EQUAL initializer
|
784 bob 1.3 {
|
785 kumpf 1.29 CIMKeyBinding *kb = new CIMKeyBinding(*$1, *$3,
|
786 bob 1.3 modelPath::KeyBindingTypeOf(*$3));
787 g_KeyBindingArray.append(*kb);
788 delete kb;
|
789 bob 1.1 delete $1;
790 delete $3; } ;
791
|
792 e.boden 1.34
|
793 bob 1.1 keyValuePairName: TOK_SIMPLE_IDENTIFIER ;
794
|
795 e.boden 1.34
|
796 jim.wunderlich 1.40 alias: TOK_AS aliasIdentifier {
|
797 kumpf 1.39 $$ = $2;
|
798 jim.wunderlich 1.40 g_currentAliasDecl = *$2;
799 MOF_trace2("aliasIdentifier $$ = ", $$->getCString());
800 MOF_trace2("aliasIdentifier g_currentAliasDecl = ", g_currentAliasDecl.getCString());
801
|
802 e.boden 1.35 }
|
803 jim.wunderlich 1.40 | /* empty */ {
804 $$ = new String(String::EMPTY);
805 g_currentAliasDecl = String::EMPTY}
|
806 e.boden 1.36 ;
|
807 e.boden 1.34
|
808 bob 1.1
809 aliasIdentifier: TOK_ALIAS_IDENTIFIER ;
810
|
811 e.boden 1.34
|
812 karl 1.31 /*
813 **------------------------------------------------------------------------------
814 **
815 ** Instance Declaration productions and processing
816 **
|
817 jim.wunderlich 1.40 **-----------------------------------------------------------------------------
|
818 karl 1.31 */
819
|
820 bob 1.1 instanceDeclaration: instanceHead instanceBody
821 {
|
822 bob 1.4 $$ = g_currentInstance;
|
823 jim.wunderlich 1.40 if (g_currentAliasDecl != String::EMPTY)
824 {
825 MOF_trace2("instanceDeclaration g_currentAliasDecl = ", g_currentAliasDecl.getCString());
826 // MOF_trace2 ("instanceDeclaration instance = ", ((CIMObject *)$$)->toString().getCString());
827 if (cimmofParser::Instance()->addInstanceAlias(g_currentAliasDecl, $$, true) == 0)
828 {
829 // Error alias already exist
830 MOF_error("ERROR: alias ALREADY EXISTS: aliasIdentifier = ",
831 g_currentAliasDecl.getCString());
832 yyerror("instanceDeclaration - 'aliasIdentifier' ALREADY EXISTS");
833 YYABORT;
834 }
835 }
|
836 bob 1.1 };
837
|
838 e.boden 1.34
839
|
840 bob 1.1 instanceHead: qualifierList TOK_INSTANCE TOK_OF className alias
841 {
842 if (g_currentInstance)
843 delete g_currentInstance;
|
844 jim.wunderlich 1.40 g_currentAliasDecl = *$5;
|
845 bob 1.4 g_currentInstance = cimmofParser::Instance()->newInstance(*$4);
|
846 karl 1.31 // apply the qualifierlist to the current instance
|
847 bob 1.1 $$ = g_currentInstance;
|
848 karl 1.31 applyQualifierList(&g_qualifierList, $$);
|
849 bob 1.4 delete $4;
|
850 bob 1.1 delete $5;
|
851 jim.wunderlich 1.40 if (g_currentAliasDecl != String::EMPTY)
852 MOF_trace2("instanceHead g_currentAliasDecl = ", g_currentAliasDecl.getCString());
|
853 bob 1.1 } ;
854
|
855 e.boden 1.34
856
|
857 bob 1.1 instanceBody: TOK_LEFTCURLYBRACE valueInitializers TOK_RIGHTCURLYBRACE
858 TOK_SEMICOLON ;
859
|
860 e.boden 1.34
861
|
862 bob 1.1 valueInitializers: valueInitializer
863 | valueInitializers valueInitializer ;
864
|
865 e.boden 1.34
866
|
867 kumpf 1.17 // ATTN-DE-P1-20020427: Processing NULL Initializer values is incomplete.
868 // Currently only the arrayInitializer element has been modified to
869 // return CIMMOF_NULL_VALUE
870 valueInitializer: qualifierList TOK_SIMPLE_IDENTIFIER TOK_EQUAL
871 typedInitializer TOK_SEMICOLON
|
872 bob 1.1 {
|
873 bob 1.3 cimmofParser *cp = cimmofParser::Instance();
|
874 kumpf 1.17 // ATTN: P1 InstanceUpdate function 2001 BB Instance update needs work here and CIMOM
|
875 bob 1.3 // a property. It must be fixed in the Common code first.
|
876 bob 1.1 // What we have to do here is create a CIMProperty and initialize it with
877 // the value provided. The name of the property is $2 and it belongs
878 // to the class whose name is in g_currentInstance->getClassName().
|
879 bob 1.3 // The steps are
880 // 2. Get property declaration's value object
|
881 mike 1.8 CIMProperty *oldprop = cp->PropertyFromInstance(*g_currentInstance,
|
882 bob 1.3 *$2);
|
883 mike 1.8 CIMValue *oldv = cp->ValueFromProperty(*oldprop);
|
884 kumpf 1.17
|
885 bob 1.3 // 3. create the new Value object of the same type
|
886 kumpf 1.17
887 // We want createValue to interpret a value as an array if is enclosed
888 // in {}s (e.g., { 2 } or {2, 3, 5}) or it is NULL and the property is
889 // defined as an array. createValue is responsible for the actual
890 // validation.
891
892 CIMValue *v = valueFactory::createValue(oldv->getType(),
893 (($4->type == CIMMOF_ARRAY_VALUE) |
894 (($4->type == CIMMOF_NULL_VALUE) & oldprop->isArray()))?0:-1,
895 ($4->type == CIMMOF_NULL_VALUE),
896 $4->value);
897
|
898 e.boden 1.34
|
899 bob 1.3 // 4. create a clone property with the new value
900 CIMProperty *newprop = cp->copyPropertyWithNewValue(*oldprop, *v);
|
901 karl 1.31
|
902 bob 1.1 // 5. apply the qualifiers;
|
903 karl 1.31 applyQualifierList(&g_qualifierList, newprop);
904
|
905 bob 1.1 // 6. and apply the CIMProperty to g_currentInstance.
|
906 bob 1.3 cp->applyProperty(*g_currentInstance, *newprop);
|
907 bob 1.1 delete $2;
|
908 kumpf 1.17 delete $4->value;
|
909 bob 1.3 delete oldprop;
910 delete oldv;
911 delete v;
912 delete newprop;
|
913 e.boden 1.34 };
914
915
916
917
|
918 bob 1.1
|
919 karl 1.31 /*
920 **------------------------------------------------------------------------------
921 **
922 ** Compiler directive productions and processing
923 **
924 **------------------------------------------------------------------------------
925 */
926
|
927 bob 1.1 compilerDirective: compilerDirectiveInclude
928 {
929 //printf("compilerDirectiveInclude ");
930 }
931 | compilerDirectivePragma
932 {
933 //printf("compilerDirectivePragma ");
934 } ;
935
|
936 e.boden 1.34
|
937 bob 1.1 compilerDirectiveInclude: TOK_PRAGMA TOK_INCLUDE TOK_LEFTPAREN fileName
938 TOK_RIGHTPAREN
939 {
940 cimmofParser::Instance()->enterInlineInclude(*$4); delete $4;
|
941 e.boden 1.34 };
942
|
943 bob 1.1
944 fileName: stringValue { $$ = $1; } ;
|
945 e.boden 1.34
946
|
947 bob 1.1 compilerDirectivePragma: TOK_PRAGMA pragmaName
948 TOK_LEFTPAREN pragmaVal TOK_RIGHTPAREN
949 { cimmofParser::Instance()->processPragma(*$2, *$4);
950 delete $2;
951 delete $4;
952 };
953
|
954 e.boden 1.34
955
956
|
957 karl 1.31 /*
958 **------------------------------------------------------------------------------
959 **
960 ** qualifier Declaration productions and processing
961 **
962 **------------------------------------------------------------------------------
963 */
964
|
965 bob 1.1 qualifierDeclaration: TOK_QUALIFIER qualifierName qualifierValue scope
966 defaultFlavor TOK_SEMICOLON
967 {
968 // CIMQualifierDecl *qd = new CIMQualifierDecl($2, $3, $4, $5);
|
969 kumpf 1.25 $$ = cimmofParser::Instance()->newQualifierDecl(*$2, $3, *$4, *$5);
|
970 bob 1.1 delete $2;
971 delete $3; // CIMValue object created in qualifierValue production
972 } ;
973
974
|
975 kumpf 1.18 qualifierValue: TOK_COLON dataType array typedDefaultValue
|
976 bob 1.1 {
|
977 kumpf 1.18 $$ = valueFactory::createValue($2, $3,
978 $4->type == CIMMOF_NULL_VALUE, $4->value);
979 delete $4->value;
|
980 kumpf 1.17 } ;
|
981 bob 1.1
|
982 e.boden 1.34
|
983 kumpf 1.26 scope: scope_begin metaElements TOK_RIGHTPAREN { $$ = $2; } ;
|
984 bob 1.1
|
985 e.boden 1.34
|
986 kumpf 1.25 scope_begin: TOK_COMMA TOK_SCOPE TOK_LEFTPAREN {
987 g_scope = CIMScope (CIMScope::NONE); } ;
|
988 bob 1.1
|
989 e.boden 1.34
|
990 bob 1.1 metaElements: metaElement { $$ = $1; }
991 | metaElements TOK_COMMA metaElement
|
992 kumpf 1.26 { $$->addScope(*$3); } ;
|
993 karl 1.16 // ATTN: 2001 P3 defer There is not CIMScope::SCHEMA. Spec Limit KS
|
994 bob 1.1
|
995 e.boden 1.34
|
996 kumpf 1.26 metaElement: TOK_CLASS { $$ = new CIMScope(CIMScope::CLASS); }
997 // | TOK_SCHEMA { $$ = new CIMScope(CIMScope::SCHEMA); }
998 | TOK_SCHEMA { $$ = new CIMScope(CIMScope::CLASS); }
999 | TOK_ASSOCIATION { $$ = new CIMScope(CIMScope::ASSOCIATION); }
1000 | TOK_INDICATION { $$ = new CIMScope(CIMScope::INDICATION); }
1001 // | TOK_QUALIFIER { $$ = new CIMScope(CIMScope::QUALIFIER); }
1002 | TOK_PROPERTY { $$ = new CIMScope(CIMScope::PROPERTY); }
1003 | TOK_REFERENCE { $$ = new CIMScope(CIMScope::REFERENCE); }
1004 | TOK_METHOD { $$ = new CIMScope(CIMScope::METHOD); }
1005 | TOK_PARAMETER { $$ = new CIMScope(CIMScope::PARAMETER); }
1006 | TOK_ANY { $$ = new CIMScope(CIMScope::ANY); } ;
|
1007 bob 1.1
|
1008 e.boden 1.34
|
1009 karl 1.11 // Correction KS 4 march 2002 - Set the default if empty
|
1010 bob 1.1 defaultFlavor: TOK_COMMA flavorHead explicitFlavors TOK_RIGHTPAREN
|
1011 kumpf 1.25 { $$ = &g_flavor; }
1012 | /* empty */ { $$ = new CIMFlavor (CIMFlavor::NONE); } ;
|
1013 bob 1.1
|
1014 e.boden 1.34
|
1015 karl 1.11 // Correction KS 4 March 2002 - set the defaults (was zero)
1016 // Set the flavors for the defaults required: via DEFAULTS
1017
|
1018 kumpf 1.25 flavorHead: TOK_FLAVOR TOK_LEFTPAREN {g_flavor = CIMFlavor (CIMFlavor::NONE);};
|
1019 bob 1.1
|
1020 e.boden 1.34
|
1021 bob 1.1 explicitFlavors: explicitFlavor
1022 | explicitFlavors TOK_COMMA explicitFlavor ;
1023
|
1024 mike 1.10
|
1025 karl 1.31 // ATTN:KS-26/03/02 P2 This accumulates the flavor definitions. However, it allows multiple instances
|
1026 karl 1.15 // of any keyword. Note also that each entity simply sets a bit so that you may
1027 // set disable and enable and we will not know which overrides the other.
1028 // We need to create the function to insure that you cannot enable then disable or
1029 // accept the latter and override the former.
1030
1031 // The compiler simply provides the flavors defined in the MOF and does not make any
1032 // assumptions about defaults, etc. That is a problem for resolution of the flavors.
|
1033 e.boden 1.34
|
1034 kumpf 1.25 explicitFlavor: TOK_ENABLEOVERRIDE
1035 { g_flavor.addFlavor (CIMFlavor::ENABLEOVERRIDE); }
1036 | TOK_DISABLEOVERRIDE { g_flavor.addFlavor (CIMFlavor::DISABLEOVERRIDE); }
1037 | TOK_RESTRICTED { g_flavor.addFlavor (CIMFlavor::RESTRICTED); }
1038 | TOK_TOSUBCLASS { g_flavor.addFlavor (CIMFlavor::TOSUBELEMENTS); }
1039 | TOK_TRANSLATABLE { g_flavor.addFlavor (CIMFlavor::TRANSLATABLE); };
|
1040 bob 1.1
|
1041 e.boden 1.34
|
1042 kumpf 1.25 flavor: overrideFlavors { $$ = &g_flavor; }
1043 | /* empty */ { $$ = new CIMFlavor (CIMFlavor::NONE); };
|
1044 bob 1.1
|
1045 e.boden 1.34
|
1046 bob 1.1 overrideFlavors: explicitFlavor
1047 | overrideFlavors explicitFlavor ;
1048
|
1049 e.boden 1.34
1050
|
1051 bob 1.1 dataType: intDataType { $$ = $1; }
1052 | realDataType { $$ = $1; }
|
1053 kumpf 1.22 | TOK_DT_STR { $$ = CIMTYPE_STRING; }
1054 | TOK_DT_BOOL { $$ = CIMTYPE_BOOLEAN; }
1055 | TOK_DT_DATETIME { $$ = CIMTYPE_DATETIME; } ;
1056
|
1057 e.boden 1.34
|
1058 kumpf 1.22 intDataType: TOK_DT_UINT8 { $$ = CIMTYPE_UINT8; }
1059 | TOK_DT_SINT8 { $$ = CIMTYPE_SINT8; }
1060 | TOK_DT_UINT16 { $$ = CIMTYPE_UINT16; }
1061 | TOK_DT_SINT16 { $$ = CIMTYPE_SINT16; }
1062 | TOK_DT_UINT32 { $$ = CIMTYPE_UINT32; }
1063 | TOK_DT_SINT32 { $$ = CIMTYPE_SINT32; }
1064 | TOK_DT_UINT64 { $$ = CIMTYPE_UINT64; }
1065 | TOK_DT_SINT64 { $$ = CIMTYPE_SINT64; }
1066 | TOK_DT_CHAR16 { $$ = CIMTYPE_CHAR16; } ;
|
1067 bob 1.1
|
1068 e.boden 1.34
|
1069 kumpf 1.22 realDataType: TOK_DT_REAL32 { $$ =CIMTYPE_REAL32; }
1070 | TOK_DT_REAL64 { $$ =CIMTYPE_REAL64; };
|
1071 bob 1.1
|
1072 karl 1.31
|
1073 e.boden 1.34
1074
|
1075 karl 1.31 /*
1076 **------------------------------------------------------------------------------
1077 **
1078 ** Qualifier list and qualifier processing
1079 **
1080 **------------------------------------------------------------------------------
1081 */
|
1082 bob 1.1 qualifierList: qualifierListBegin qualifiers TOK_RIGHTSQUAREBRACKET
|
1083 e.boden 1.34 | /* empty */ {
1084 //yydebug = 1; stderr = stdout;
1085 };
1086
1087
|
1088 bob 1.1
|
1089 karl 1.31 qualifierListBegin: TOK_LEFTSQUAREBRACKET {
|
1090 e.boden 1.34
1091 //yydebug = 1; stderr = stdout;
|
1092 karl 1.31 YACCTRACE("qualifierListbegin");
1093 g_qualifierList.init(); } ;
|
1094 bob 1.1
|
1095 e.boden 1.34
1096
|
1097 bob 1.1 qualifiers: qualifier { }
1098 | qualifiers TOK_COMMA qualifier { } ;
1099
|
1100 e.boden 1.34
1101
|
1102 kumpf 1.20 qualifier: qualifierName typedQualifierParameter flavor
|
1103 bob 1.1 {
1104 cimmofParser *p = cimmofParser::Instance();
1105 // The qualifier value can't be set until we know the contents of the
1106 // QualifierDeclaration. That's what QualifierValue() does.
|
1107 kumpf 1.20 CIMValue *v = p->QualifierValue(*$1,
1108 ($2->type == CIMMOF_NULL_VALUE), *$2->value);
|
1109 bob 1.1 $$ = p->newQualifier(*$1, *v, g_flavor);
1110 g_qualifierList.add($$);
1111 delete $1;
|
1112 kumpf 1.20 delete $2->value;
|
1113 bob 1.1 delete v;
1114 } ;
1115
|
1116 e.boden 1.34
1117
|
1118 kumpf 1.25 qualifierName: TOK_SIMPLE_IDENTIFIER {
1119 g_flavor = CIMFlavor (CIMFlavor::NONE); }
|
1120 bob 1.1 | metaElement {
|
1121 kumpf 1.26 $$ = new String((*$1).toString ());
|
1122 kumpf 1.25 g_flavor = CIMFlavor (CIMFlavor::NONE); } ;
|
1123 bob 1.1
|
1124 e.boden 1.34
1125
|
1126 kumpf 1.20 typedQualifierParameter: TOK_LEFTPAREN nonNullConstantValue TOK_RIGHTPAREN
1127 {
1128 g_typedInitializerValue.type = CIMMOF_CONSTANT_VALUE;
1129 g_typedInitializerValue.value = $2;
1130 $$ = &g_typedInitializerValue;
1131 }
1132 | TOK_LEFTPAREN TOK_NULL_VALUE TOK_RIGHTPAREN
1133 {
1134 g_typedInitializerValue.type = CIMMOF_NULL_VALUE;
1135 g_typedInitializerValue.value = new String(String::EMPTY);
1136 $$ = &g_typedInitializerValue;
1137 }
1138 | arrayInitializer
1139 {
1140 g_typedInitializerValue.type = CIMMOF_ARRAY_VALUE;
1141 g_typedInitializerValue.value = $1;
1142 $$ = &g_typedInitializerValue;
1143 }
1144 | { /* empty */
1145 g_typedInitializerValue.type = CIMMOF_NULL_VALUE;
1146 g_typedInitializerValue.value = new String(String::EMPTY);
1147 kumpf 1.20 $$ = &g_typedInitializerValue;
1148 };
|
1149 bob 1.1
|
1150 e.boden 1.34
|
1151 bob 1.1 pragmaName: TOK_SIMPLE_IDENTIFIER { $$ = $1; } ;
1152
|
1153 e.boden 1.34
|
1154 bob 1.1 pragmaVal: TOK_STRING_VALUE { $$ = $1; } ;
1155
1156 %%
|
1157 jim.wunderlich 1.40
1158 /*
1159 **==============================================================================
1160 **
1161 ** MOF_error():
1162 **
1163 **==============================================================================
1164 */
1165 static void MOF_error(const char * str, const char * S)
1166 {
1167 printf("%s %s\n", str, S);
1168 }
1169
1170 /*
1171 **==============================================================================
1172 **
1173 ** MOF_trace():
1174 **
1175 **==============================================================================
1176 */
1177 // #define DEBUG_cimmof 1
1178 jim.wunderlich 1.40
1179 static void MOF_trace(const char* str)
1180 {
1181 #ifdef DEBUG_cimmof
1182 printf("MOF_trace(): %s \n", str);
1183 #endif // DEBUG_cimmof
1184 }
1185
1186 static void MOF_trace2(const char * str, const char * S)
1187 {
1188 #ifdef DEBUG_cimmof
1189 printf("MOF_trace2(): %s %s\n", str, S);
1190 #endif // DEBUG_cimmof
1191 }
|