version 1.39, 2005/06/28 19:54:31
|
version 1.40, 2005/10/14 21:11:34
|
|
|
CIMMethod *g_currentMethod = 0; | CIMMethod *g_currentMethod = 0; |
CIMClass *g_currentClass = 0; | CIMClass *g_currentClass = 0; |
CIMInstance *g_currentInstance = 0; | CIMInstance *g_currentInstance = 0; |
String g_currentAlias = String::EMPTY; |
String g_currentAliasRef = String::EMPTY; // Alias reference |
|
String g_currentAliasDecl = String::EMPTY; // Alias declaration |
CIMName g_referenceClassName = CIMName(); | CIMName g_referenceClassName = CIMName(); |
Array<CIMKeyBinding> g_KeyBindingArray; // it gets created empty | Array<CIMKeyBinding> g_KeyBindingArray; // it gets created empty |
TYPED_INITIALIZER_VALUE g_typedInitializerValue; | TYPED_INITIALIZER_VALUE g_typedInitializerValue; |
|
|
// printf("Error: %s\n", msg); | // printf("Error: %s\n", msg); |
} | } |
| |
|
static void MOF_error(const char * str, const char * S); |
|
static void MOF_trace(const char* str); |
|
static void MOF_trace2(const char * str, const char * S); |
|
|
%} | %} |
| |
%union { | %union { |
|
|
%type <strval> namespaceHandle namespaceHandleRef | %type <strval> namespaceHandle namespaceHandleRef |
%type <strval> nonNullConstantValue | %type <strval> nonNullConstantValue |
%type <strval> pragmaName pragmaVal keyValuePairName qualifierName | %type <strval> pragmaName pragmaVal keyValuePairName qualifierName |
%type <strval> referenceInitializer aliasInitializer objectHandle |
%type <strval> referenceInitializer objectHandle |
|
%type <strval> aliasInitializer |
|
%type <strval> aliasIdentifier |
%type <strval> stringValue stringValues initializer constantValue | %type <strval> stringValue stringValues initializer constantValue |
%type <strval> TOK_ALIAS_IDENTIFIER alias aliasIdentifier |
%type <strval> TOK_ALIAS_IDENTIFIER alias |
%type <strval> TOK_POSITIVE_DECIMAL_VALUE TOK_OCTAL_VALUE TOK_HEX_VALUE | %type <strval> TOK_POSITIVE_DECIMAL_VALUE TOK_OCTAL_VALUE TOK_HEX_VALUE |
%type <strval> TOK_SIGNED_DECIMAL_VALUE TOK_BINARY_VALUE | %type <strval> TOK_SIGNED_DECIMAL_VALUE TOK_BINARY_VALUE |
%type <strval> TOK_SIMPLE_IDENTIFIER TOK_STRING_VALUE | %type <strval> TOK_SIMPLE_IDENTIFIER TOK_STRING_VALUE |
|
|
classDeclaration: classHead classBody | classDeclaration: classHead classBody |
{ | { |
YACCTRACE("classDeclaration"); | YACCTRACE("classDeclaration"); |
if (g_currentAlias != String::EMPTY) |
if (g_currentAliasDecl != String::EMPTY) |
cimmofParser::Instance()->addClassAlias(g_currentAlias, $$, false); |
cimmofParser::Instance()->addClassAlias(g_currentAliasDecl, $$, false); |
} ; | } ; |
| |
| |
|
|
// put list of qualifiers into class | // put list of qualifiers into class |
applyQualifierList(&g_qualifierList, $$); | applyQualifierList(&g_qualifierList, $$); |
| |
g_currentAlias = *$4; |
g_currentAliasRef = *$4; |
if (g_currentClass) | if (g_currentClass) |
delete g_currentClass; | delete g_currentClass; |
g_currentClass = $$; | g_currentClass = $$; |
|
|
$$ = s; | $$ = s; |
delete $2; | delete $2; |
delete $3; | delete $3; |
|
MOF_trace2 ("objectHandle done $$ = ", $$->getCString()); |
} ; | } ; |
| |
| |
aliasInitializer : aliasIdentifier { | aliasInitializer : aliasIdentifier { |
// convert somehow from alias to a CIM object name |
|
yyerror("'alias' is not yet supported (see bugzilla 14)."); |
CIMObjectPath AOP; |
delete $1; |
|
|
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; | YYABORT; |
|
} |
|
|
|
String *s = new String(AOP.toString()); |
|
|
|
$$ = s; |
|
|
|
delete $1; |
|
|
|
MOF_trace2 ("aliasInitializer done $$ = ", $$->getCString()); |
|
|
}; | }; |
| |
| |
|
|
| |
| |
alias: TOK_AS aliasIdentifier { | alias: TOK_AS aliasIdentifier { |
yyerror("'alias' is not yet supported (see bugzilla 14)."); |
|
$$ = $2; | $$ = $2; |
YYABORT; |
g_currentAliasDecl = *$2; |
|
MOF_trace2("aliasIdentifier $$ = ", $$->getCString()); |
|
MOF_trace2("aliasIdentifier g_currentAliasDecl = ", g_currentAliasDecl.getCString()); |
|
|
} | } |
| /* empty */ { $$ = new String(String::EMPTY); } |
| /* empty */ { |
|
$$ = new String(String::EMPTY); |
|
g_currentAliasDecl = String::EMPTY} |
; | ; |
| |
| |
aliasIdentifier: TOK_ALIAS_IDENTIFIER ; | aliasIdentifier: TOK_ALIAS_IDENTIFIER ; |
| |
| |
|
|
|
|
|
|
/* | /* |
**------------------------------------------------------------------------------ | **------------------------------------------------------------------------------ |
** | ** |
** Instance Declaration productions and processing | ** Instance Declaration productions and processing |
** | ** |
**------------------------------------------------------------------------------ |
**----------------------------------------------------------------------------- |
*/ | */ |
| |
instanceDeclaration: instanceHead instanceBody | instanceDeclaration: instanceHead instanceBody |
{ | { |
$$ = g_currentInstance; | $$ = g_currentInstance; |
if (g_currentAlias != String::EMPTY) |
if (g_currentAliasDecl != String::EMPTY) |
cimmofParser::Instance()->addInstanceAlias(g_currentAlias, $1, true); |
{ |
|
MOF_trace2("instanceDeclaration g_currentAliasDecl = ", g_currentAliasDecl.getCString()); |
|
// MOF_trace2 ("instanceDeclaration instance = ", ((CIMObject *)$$)->toString().getCString()); |
|
if (cimmofParser::Instance()->addInstanceAlias(g_currentAliasDecl, $$, true) == 0) |
|
{ |
|
// Error alias already exist |
|
MOF_error("ERROR: alias ALREADY EXISTS: aliasIdentifier = ", |
|
g_currentAliasDecl.getCString()); |
|
yyerror("instanceDeclaration - 'aliasIdentifier' ALREADY EXISTS"); |
|
YYABORT; |
|
} |
|
} |
}; | }; |
| |
| |
|
|
{ | { |
if (g_currentInstance) | if (g_currentInstance) |
delete g_currentInstance; | delete g_currentInstance; |
g_currentAlias = *$5; |
g_currentAliasDecl = *$5; |
g_currentInstance = cimmofParser::Instance()->newInstance(*$4); | g_currentInstance = cimmofParser::Instance()->newInstance(*$4); |
// apply the qualifierlist to the current instance | // apply the qualifierlist to the current instance |
$$ = g_currentInstance; | $$ = g_currentInstance; |
applyQualifierList(&g_qualifierList, $$); | applyQualifierList(&g_qualifierList, $$); |
delete $4; | delete $4; |
delete $5; | delete $5; |
|
if (g_currentAliasDecl != String::EMPTY) |
|
MOF_trace2("instanceHead g_currentAliasDecl = ", g_currentAliasDecl.getCString()); |
} ; | } ; |
| |
| |
|
|
pragmaVal: TOK_STRING_VALUE { $$ = $1; } ; | pragmaVal: TOK_STRING_VALUE { $$ = $1; } ; |
| |
%% | %% |
|
|
|
/* |
|
**============================================================================== |
|
** |
|
** MOF_error(): |
|
** |
|
**============================================================================== |
|
*/ |
|
static void MOF_error(const char * str, const char * S) |
|
{ |
|
printf("%s %s\n", str, S); |
|
} |
|
|
|
/* |
|
**============================================================================== |
|
** |
|
** MOF_trace(): |
|
** |
|
**============================================================================== |
|
*/ |
|
// #define DEBUG_cimmof 1 |
|
|
|
static void MOF_trace(const char* str) |
|
{ |
|
#ifdef DEBUG_cimmof |
|
printf("MOF_trace(): %s \n", str); |
|
#endif // DEBUG_cimmof |
|
} |
|
|
|
static void MOF_trace2(const char * str, const char * S) |
|
{ |
|
#ifdef DEBUG_cimmof |
|
printf("MOF_trace2(): %s %s\n", str, S); |
|
#endif // DEBUG_cimmof |
|
} |