⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cimmof.y

📁 Pegasus is an open-source implementationof the DMTF CIM and WBEM standards. It is designed to be por
💻 Y
📖 第 1 页 / 共 3 页
字号:
**** method Declaration productions and processing.****------------------------------------------------------------------------------*/methodDeclaration: qualifierList methodHead methodBody methodEnd {  YACCTRACE("methodDeclaration");  $$ = $2;} ;// methodHead processes the datatype and methodName and puts qualifierList.// BUG 366. qualifier list was originally placed on in methoddeclaration// which meant it might be overwritten by parameter qualifier lists.methodHead: dataType methodName {    YACCTRACE("methodHead");    if (g_currentMethod)    delete g_currentMethod;  // create new method instance with pointer to method name and datatype  g_currentMethod = cimmofParser::Instance()->newMethod(*$2, $1) ;    // put new method on stack  $$ = g_currentMethod;  // apply the method qualifier list.  applyQualifierList(&g_qualifierList, $$);  delete $2;} ;methodBody: TOK_LEFTPAREN parameters TOK_RIGHTPAREN ;methodEnd: TOK_SEMICOLON ;methodName: TOK_SIMPLE_IDENTIFIER { $$ = new CIMName(*$1); } ;////  Productions for method parameters//parameters : parameter           | parameters TOK_COMMA parameter           | /* empty */ ;parameter: qualifierList parameterType parameterName array {   // ATTN: P2 2002 Question Need to create default value including type?    YACCTRACE("parameter:");  CIMParameter *p = 0;  cimmofParser *cp = cimmofParser::Instance();  // Create new parameter with name, type, isArray, array, referenceClassName  if ($4 == -1) {    p = cp->newParameter(*$3, $2, false, 0, g_referenceClassName);  } else {    p = cp->newParameter(*$3, $2, true, $4, g_referenceClassName);  }  g_referenceClassName = CIMName();  YACCTRACE("parameter:applyQualifierList");  applyQualifierList(&g_qualifierList, p);  cp->applyParameter(*g_currentMethod, *p);  delete p;  delete $3;} ;parameterType: dataType { $$ = $1; }             | objectRef { $$ = CIMTYPE_REFERENCE; } ;/***------------------------------------------------------------------------------****   property Declaration productions and processing****------------------------------------------------------------------------------*/propertyDeclaration: qualifierList propertyBody propertyEnd {    // set body to stack and apply qualifier list    // ATTN: the apply qualifer only works here because    // there are not lower level qualifiers.  We do productions    // that might have lower level qualifiers differently by    // setting up a xxxHead production where qualifiers are     // applied.    YACCTRACE("propertyDeclaration:");    $$ = $2;    applyQualifierList(&g_qualifierList, $$);} ;propertyBody: dataType propertyName array typedDefaultValue{  CIMValue *v = valueFactory::createValue($1, $3,                       ($4->type == CIMMOF_NULL_VALUE), $4->value);  if ($3 == -1) {    $$ = cimmofParser::Instance()->newProperty(*$2, *v, false, 0);} else {                                               $$ = cimmofParser::Instance()->newProperty(*$2, *v, true, $3);  }  delete $2;  delete $4->value;  delete v;} ;propertyEnd: TOK_SEMICOLON ;/***------------------------------------------------------------------------------****    reference Declaration productions and processing****------------------------------------------------------------------------------*/referenceDeclaration: qualifierList referencedObject TOK_REF referenceName                      referencePath TOK_SEMICOLON {  String s(*$2);  if (!String::equal(*$5, String::EMPTY))    s.append("." + *$5);  CIMValue *v = valueFactory::createValue(CIMTYPE_REFERENCE, -1, true, &s);  //KS add the isArray and arraysize parameters. 8 mar 2002  $$ = cimmofParser::Instance()->newProperty(*$4, *v, false,0, *$2);  applyQualifierList(&g_qualifierList, $$);  delete $2;  delete $4;  delete $5;   delete v;} ;referencedObject: TOK_SIMPLE_IDENTIFIER { $$ = $1; } ;referenceName: TOK_SIMPLE_IDENTIFIER { $$ = $1; };referencePath: TOK_EQUAL stringValue { $$ = $2; }               | /* empty */ { $$ = new String(String::EMPTY); } ;objectRef: className TOK_REF {                            g_referenceClassName = *$1; } ;parameterName: TOK_SIMPLE_IDENTIFIER { $$ = new CIMName(*$1); } ;propertyName: TOK_SIMPLE_IDENTIFIER { $$ = new CIMName(*$1); } ;array: TOK_LEFTSQUAREBRACKET TOK_POSITIVE_DECIMAL_VALUE           TOK_RIGHTSQUAREBRACKET                 { $$ = valueFactory::Stoi(*$2);		   delete $2;                 }     | TOK_LEFTSQUAREBRACKET TOK_RIGHTSQUAREBRACKET { $$ = 0; }      | /* empty */ { $$ = -1; } ;typedDefaultValue: TOK_EQUAL typedInitializer { $$ = $2; }              | {   /* empty */                  g_typedInitializerValue.type = CIMMOF_NULL_VALUE;                  g_typedInitializerValue.value = new String(String::EMPTY);                   $$ = &g_typedInitializerValue;              };initializer: constantValue { $$ = $1; }           | arrayInitializer { $$ = $1; }           | referenceInitializer { $$ = $1; } ;// The typedInitializer element is syntactially identical to // the initializer element. However, the typedInitializer element // returns, in addition to the value, the type of the value.typedInitializer: nonNullConstantValue            {            g_typedInitializerValue.type = CIMMOF_CONSTANT_VALUE;           g_typedInitializerValue.value =  $1;            $$ = &g_typedInitializerValue;           }         | TOK_NULL_VALUE           {           g_typedInitializerValue.type = CIMMOF_NULL_VALUE;           g_typedInitializerValue.value = new String(String::EMPTY);            $$ = &g_typedInitializerValue;           }         | arrayInitializer           {            g_typedInitializerValue.type = CIMMOF_ARRAY_VALUE;           g_typedInitializerValue.value =  $1;            $$ = &g_typedInitializerValue;           }         | referenceInitializer           {            g_typedInitializerValue.type = CIMMOF_REFERENCE_VALUE;           g_typedInitializerValue.value =  $1;            $$ = &g_typedInitializerValue;           };// BUG 497 - Commmas embedded in strings in arrays change the// strings.  Aded function stringWComma to escape commas.constantValues: constantValue {             *$$ = valueFactory::stringWComma(String(*$1)); }         | constantValues TOK_COMMA constantValue               {                YACCTRACE("constantValues:1, Value= " << *$3);                (*$$).append(",");                 //(*$$).append(*$3);                (*$$).append(valueFactory::stringWComma(String(*$3)));                delete $3;              } ;// The nonNullConstantValue has been added to allow NULL // to be distinguished from the EMPTY STRING.constantValue: nonNullConstantValue {$$ = $1;}             | TOK_NULL_VALUE { $$ = new String(String::EMPTY); } ;nonNullConstantValue: integerValue { $$ = $1; }             | TOK_REAL_VALUE { $$ = $1; }             | TOK_CHAR_VALUE { $$ =  $1; }             | stringValues { }             | booleanValue { $$ = new String($1 ? "T" : "F"); };integerValue: TOK_POSITIVE_DECIMAL_VALUE            | TOK_SIGNED_DECIMAL_VALUE            | TOK_OCTAL_VALUE {                   $$ = new String(cimmofParser::Instance()->oct_to_dec(*$1));                   delete $1; }            | TOK_HEX_VALUE {                   $$ = new String(cimmofParser::Instance()->hex_to_dec(*$1));	           delete $1; }            | TOK_BINARY_VALUE {                 $$ = new String(cimmofParser::Instance()->binary_to_dec(*$1));	           delete $1; };booleanValue: TOK_FALSE { $$ = 0; }            | TOK_TRUE  { $$ = 1; } ;stringValues: stringValue { $$ = $1; }            | stringValues stringValue               {                 (*$$).append(*$2);  delete $2;              } ;stringValue: TOK_STRING_VALUE {    //String oldrep = *$1;   //String s(oldrep), s1(String::EMPTY);   // Handle quoted quote   //int len = s.size();   //if (s[len] == '\n') {       //error: new line inside a string constant unless it is quoted       //if (s[len - 2] == '\\') {           //if (len > 3)	        //s1 = s.subString(1, len-3);       //} else {           //cimmof_error("New line in string constant");           //}       //cimmofParser::Instance()->increment_lineno();   //} else { // Can only be a quotation mark       //if (s[len - 2] == '\\') {  // if it is quoted           //if (len > 3) s1 = s.subString(1, len-3);           //s1.append('\"');           //cimmof_yy_less(len-1);       //} else { // This is the normal case:  real quotes on both end           //s1 = s.subString(1, len - 2) ;           //}       //}   //delete $1;   $$ = //new String(s1);        new String(*$1);   delete $1;} ;arrayInitializer:        TOK_LEFTCURLYBRACE constantValues TOK_RIGHTCURLYBRACE            { $$ = $2; }      | TOK_LEFTCURLYBRACE  TOK_RIGHTCURLYBRACE            { $$ = new String(String::EMPTY); };referenceInitializer: objectHandle {}                  | aliasInitializer {  } ;objectHandle: TOK_DQUOTE namespaceHandleRef modelPath TOK_DQUOTE{   // The objectName string is decomposed for syntactical purposes   // and reassembled here for later parsing in creation of an objname instance   String *s = new String(*$2);  if (!String::equal(*s, String::EMPTY) && $3)    (*s).append(":");  if ($3) {    (*s).append($3->Stringrep());  }  $$ = s;  delete $2;  delete $3;  MOF_trace2 ("objectHandle done $$ = ", $$->getCString());} ;aliasInitializer : aliasIdentifier {    CIMObjectPath AOP;  MOF_trace2("aliasInitializer $$ = ", $$->getCString());  MOF_trace2("aliasInitializer $1 = ", $1->getCString());  g_currentAliasRef = *$$;  MOF_trace2("aliasInitializer g_currentAliasRef = ", g_currentAliasRef.getCString());  if (cimmofParser::Instance()->getInstanceAlias(g_currentAliasRef, AOP) == 0)    {      yyerror("aliasInitializer - 'aliasIdentifier' NOT FOUND");      YYABORT;    }  String *s = new String(AOP.toString());  $$ = s;    delete $1;  MOF_trace2 ("aliasInitializer done $$ = ", $$->getCString());  };namespaceHandleRef: namespaceHandle TOK_COLON                    { }                  | /* empty */ { $$ = new String(String::EMPTY); };namespaceHandle: stringValue {};modelPath: className TOK_PERIOD keyValuePairList {             modelPath *m = new modelPath((*$1).getString(), g_KeyBindingArray);             g_KeyBindingArray.clear();              delete $1;} ;keyValuePairList: keyValuePair { $$ = 0; }                | keyValuePairList TOK_COMMA keyValuePair { $$ = 0; } ;keyValuePair: keyValuePairName TOK_EQUAL initializer               {		CIMKeyBinding *kb = new CIMKeyBinding(*$1, *$3,                               modelPath::KeyBindingTypeOf(*$3));		g_KeyBindingArray.append(*kb);		delete kb;		delete $1;	        delete $3; } ;keyValuePairName: TOK_SIMPLE_IDENTIFIER ;alias: TOK_AS aliasIdentifier {

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -