version 1.34, 2007/02/16 19:10:32
|
version 1.35, 2007/06/22 21:34:59
|
|
|
// | // |
//============================================================================== | //============================================================================== |
// | // |
// Author: Bob Blair (bblair@bmc.com) |
|
// |
|
// Modified By: Carol Ann Krug Graves, Hewlett-Packard Company |
|
// (carolann_graves@hp.com) |
|
// Gerarda Marquez (gmarquez@us.ibm.com) |
|
// -- PEP 43 changes |
|
// Terry Martin, Hewlett-Packard Company (terry.martin@hp.com) |
|
// | // |
//%///////////////////////////////////////////////////////////////////////////// | //%///////////////////////////////////////////////////////////////////////////// |
| |
|
|
//class cimmofRepository; | //class cimmofRepository; |
| |
// This class extends class parser (see parser.h) | // This class extends class parser (see parser.h) |
class PEGASUS_COMPILER_LINKAGE cimmofParser : public parser { |
class PEGASUS_COMPILER_LINKAGE cimmofParser : public parser |
|
{ |
private: | private: |
// This is meant to be a singleton, so we hide the constructor | // This is meant to be a singleton, so we hide the constructor |
// and the destructor | // and the destructor |
static cimmofParser *_instance; | static cimmofParser *_instance; |
|
|
cimmofParser(); | cimmofParser(); |
|
|
~cimmofParser(); | ~cimmofParser(); |
|
|
void trace(const String &head, const String &tail) const; | void trace(const String &head, const String &tail) const; |
|
|
//either throw us out or retry depending on user preference | //either throw us out or retry depending on user preference |
void maybeThrowParseError(const String &msg) const; | void maybeThrowParseError(const String &msg) const; |
void maybeThrowLexerError(const String &msg) const; | void maybeThrowLexerError(const String &msg) const; |
|
|
| |
// Here are the members added by this specialization | // Here are the members added by this specialization |
const mofCompilerOptions *_cmdline; | const mofCompilerOptions *_cmdline; |
|
|
String _includefile; // temp storage for included file to be entered | String _includefile; // temp storage for included file to be entered |
cimmofRepositoryInterface _repository; // the repository interface object |
|
|
cimmofRepositoryInterface _repository; // repository interface object |
|
|
String _defaultNamespacePath; // The path we'll use if none is given | String _defaultNamespacePath; // The path we'll use if none is given |
|
|
String _currentNamespacePath; // a namespace set from a #pragma | String _currentNamespacePath; // a namespace set from a #pragma |
|
|
compilerCommonDefs::operationType _ot; | compilerCommonDefs::operationType _ot; |
public: | public: |
// Provide a way for the singleton to be constructed, or a | // Provide a way for the singleton to be constructed, or a |
// pointer to be returned: | // pointer to be returned: |
static cimmofParser *Instance(); | static cimmofParser *Instance(); |
|
|
void elog(const String &msg) const; // handle logging of errors | void elog(const String &msg) const; // handle logging of errors |
|
|
void wlog(const String &msg) const; // handle logging of warnings | void wlog(const String &msg) const; // handle logging of warnings |
| |
//------------------------------------------------------------------ | //------------------------------------------------------------------ |
|
|
const String &getCurrentNamespacePath() const; | const String &getCurrentNamespacePath() const; |
// Get the effective namespace path -- the override, if there is one. | // Get the effective namespace path -- the override, if there is one. |
const String &getNamespacePath() const; | const String &getNamespacePath() const; |
|
|
//------------------------------------------------------------------ | //------------------------------------------------------------------ |
// Methods that implement or override base class methods | // Methods that implement or override base class methods |
//------------------------------------------------------------------ | //------------------------------------------------------------------ |
|
|
// Handle the processing of CIM-specific constructs | // Handle the processing of CIM-specific constructs |
//------------------------------------------------------------------ | //------------------------------------------------------------------ |
// This is called after a completed #pragma production is formed | // This is called after a completed #pragma production is formed |
void processPragma(const String &pragmaName, const String &pragmaString); |
void processPragma(const String &pragmaName, |
// This is called when a completed class declaration production is formed |
const String &pragmaString); |
|
|
|
// addClass called when completed class declaration production is formed |
int addClass(CIMClass *classdecl); | int addClass(CIMClass *classdecl); |
|
|
// This is called when a new class declaration heading is discovered | // This is called when a new class declaration heading is discovered |
CIMClass *newClassDecl(const CIMName &name, const CIMName &superclass); | CIMClass *newClassDecl(const CIMName &name, const CIMName &superclass); |
|
|
// Called when a completed instanace declaration production is formed | // Called when a completed instanace declaration production is formed |
int addInstance(CIMInstance *instance); | int addInstance(CIMInstance *instance); |
|
|
// Called when a new qualifier declaration heading is discovered | // Called when a new qualifier declaration heading is discovered |
CIMQualifierDecl *newQualifierDecl(const String &name, const CIMValue *value, |
CIMQualifierDecl *newQualifierDecl(const String &name, |
|
const CIMValue *value, |
const CIMScope & scope, const CIMFlavor & flavor); | const CIMScope & scope, const CIMFlavor & flavor); |
|
|
// Called when a completed qualifier declaration production is formed | // Called when a completed qualifier declaration production is formed |
int addQualifier(CIMQualifierDecl *qualifier); | int addQualifier(CIMQualifierDecl *qualifier); |
|
|
// Called when a new qualifier declaration heading is discovered | // Called when a new qualifier declaration heading is discovered |
CIMQualifier *newQualifier(const String &name, const CIMValue &val, | CIMQualifier *newQualifier(const String &name, const CIMValue &val, |
const CIMFlavor & flav); | const CIMFlavor & flav); |
|
|
// Called when a new instance declaration heading is discovered | // Called when a new instance declaration heading is discovered |
CIMInstance *newInstance(const CIMName &name); | CIMInstance *newInstance(const CIMName &name); |
|
|
// Called when a new property is discovered | // Called when a new property is discovered |
CIMProperty *newProperty(const CIMName &name, const CIMValue &val, | CIMProperty *newProperty(const CIMName &name, const CIMValue &val, |
const Boolean isArray, | const Boolean isArray, |
const Uint32 arraySize, | const Uint32 arraySize, |
const CIMName &referencedObj = CIMName()) const; | const CIMName &referencedObj = CIMName()) const; |
|
|
// Called when a property production inside a class is complete | // Called when a property production inside a class is complete |
int applyProperty(CIMClass &c, CIMProperty &p); | int applyProperty(CIMClass &c, CIMProperty &p); |
|
|
// Called when a property production inside an instance is complete | // Called when a property production inside an instance is complete |
int applyProperty(CIMInstance &instance, CIMProperty &p); | int applyProperty(CIMInstance &instance, CIMProperty &p); |
|
|
// Called when a new method is discovered | // Called when a new method is discovered |
CIMMethod *newMethod(const CIMName &name, const CIMType type); | CIMMethod *newMethod(const CIMName &name, const CIMType type); |
|
|
// Called when a method production inside a class is complete | // Called when a method production inside a class is complete |
int applyMethod(CIMClass &c, CIMMethod &m); | int applyMethod(CIMClass &c, CIMMethod &m); |
|
|
// Called when a method parameter is discovered | // Called when a method parameter is discovered |
CIMParameter *newParameter(const CIMName &name, const CIMType type, | CIMParameter *newParameter(const CIMName &name, const CIMType type, |
Boolean isArray=false, Uint32 array=0, | Boolean isArray=false, Uint32 array=0, |
const CIMName &objName=CIMName()); | const CIMName &objName=CIMName()); |
|
|
// Called when a method parameter production is complete | // Called when a method parameter production is complete |
int applyParameter(CIMMethod &method, CIMParameter &parm); | int applyParameter(CIMMethod &method, CIMParameter &parm); |
|
|
// Called when a qualifier value production is complete | // Called when a qualifier value production is complete |
CIMValue *QualifierValue(const CIMName &qualifierName, | CIMValue *QualifierValue(const CIMName &qualifierName, |
Boolean isNull, const String &valstr); | Boolean isNull, const String &valstr); |
|
|
// Called to retrieve the value object for an existing parameter | // Called to retrieve the value object for an existing parameter |
CIMProperty *PropertyFromInstance(CIMInstance &instance, | CIMProperty *PropertyFromInstance(CIMInstance &instance, |
const CIMName &propertyName) const; | const CIMName &propertyName) const; |
|
|
CIMValue *ValueFromProperty(const CIMProperty &prop) const; | CIMValue *ValueFromProperty(const CIMProperty &prop) const; |
|
|
CIMValue *PropertyValueFromInstance(CIMInstance &instance, | CIMValue *PropertyValueFromInstance(CIMInstance &instance, |
const CIMName &propertyName) const; | const CIMName &propertyName) const; |
|
|
// Called when a class alias is found | // Called when a class alias is found |
void addClassAlias(const String &alias, const CIMClass *cd, | void addClassAlias(const String &alias, const CIMClass *cd, |
Boolean isInstance); | Boolean isInstance); |
|
|
// Called when an instance alias is found | // Called when an instance alias is found |
Uint32 addInstanceAlias(const String &alias, const CIMInstance *cd, | Uint32 addInstanceAlias(const String &alias, const CIMInstance *cd, |
Boolean isInstance); | Boolean isInstance); |
|
|
// Called when an instance alias reference is found | // Called when an instance alias reference is found |
Uint32 getInstanceAlias(const String &alias, CIMObjectPath &ObjPath); | Uint32 getInstanceAlias(const String &alias, CIMObjectPath &ObjPath); |
|
|
// Called when a reference declaration is found | // Called when a reference declaration is found |
CIMObjectPath *newReference(const objectName &oname); | CIMObjectPath *newReference(const objectName &oname); |
|
|
// Make a clone of a property object, inserting a new value object | // Make a clone of a property object, inserting a new value object |
CIMProperty *copyPropertyWithNewValue(const CIMProperty &p, | CIMProperty *copyPropertyWithNewValue(const CIMProperty &p, |
const CIMValue &v) const; | const CIMValue &v) const; |