Puma Reference Manual Puma::CSemantic Class Reference



Puma::CSemantic Class Reference

#include <CSemantic.h>

Inheritance diagram for Puma::CSemantic:
Inheritance graph

Public Member Functions

 CSemantic (CSyntax &, CBuilder &)
 
virtual void init (CSemDatabase &, Unit &)
 Initialize the semantic analysis. More...
 
void configure (Config &)
 Configure the semantic analysis. More...
 
virtual CTree * id_expr ()
 
virtual CTree * typedef_name ()
 
virtual CTree * init_declarator ()
 
virtual CTree * abst_declarator ()
 
virtual CTree * direct_abst_declarator ()
 
virtual CTree * param_decl_clause ()
 
virtual CTree * finish_fct_def ()
 
virtual CTree * arg_decl_seq ()
 
virtual CTree * decl_spec_seq1 ()
 
virtual CTree * decl_spec_seq_err ()
 
virtual CTree * declare_parameter ()
 
virtual CTree * identifier_list ()
 
virtual bool finish_param_check (bool)
 
virtual CTree * begin_decl ()
 
virtual CTree * array_delim ()
 
virtual CTree * enumerator_def ()
 
virtual CTree * trans_unit ()
 
virtual CTree * class_spec ()
 
virtual CTree * cmpd_stmt ()
 
virtual CTree * select_stmt ()
 
virtual CTree * iter_stmt ()
 
virtual void introduce_label (CTree *&)
 
virtual CTree * introduce_object (CTree *=0)
 
virtual CTree * introduce_named_type ()
 
virtual CTree * introduce_enum ()
 
virtual CTree * introduce_enumerator ()
 
virtual CTree * introduce_function ()
 
virtual CTree * introduce_parameter ()
 
virtual CTree * introduce_class ()
 
virtual CTree * introduce_member ()
 
virtual CTree * introduce_tag ()
 
void enter_arg_decl_seq ()
 
void leave_arg_decl_seq ()
 
void begin_param_check ()
 
bool in_arg_decl_seq () const
 
bool decl_spec_seq ()
 
bool empty_decl_spec_seq ()
 
virtual bool implicit_int ()
 
virtual CProtection::Type protection () const
 
void reenter_class_scope ()
 
void enter_scope (CStructure *scp)
 Enter the given scope. More...
 
void reenter_scope (CStructure *scp)
 Reenter the given scope. More...
 
void leave_scopes ()
 Leave all scopes entered up to the current scope. More...
 
- Public Member Functions inherited from Puma::Semantic
void error_sink (ErrorSink &e)
 Set the error output stream object. More...
 
void undo (CTree *tree)
 Undo the declaration analysis of the given syntax tree node. More...
 
CTree * PrivateName ()
 Create a new anonymous (private) name. More...
 
void save_state ()
 Save the current semantic analysis state. More...
 
void forget_state ()
 Discard the saved semantic analysis state. More...
 
void restore_state ()
 Restore the saved semantic analysis state. More...
 
CFileInfo * getFile ()
 Get the root node of the semantic tree. More...
 
void enter_local_scope ()
 Enter a local scope. More...
 
virtual void enter_param_decl_clause ()
 Enter a function parameter declaration clause. More...
 
virtual void leave_param_decl_clause ()
 Leave a function parameter declaration clause. More...
 
bool in_param_decl_clause ()
 Check if in the declaration of a function parameter clause. More...
 
void finish_decl ()
 Finish the analysis of the current declaration. More...
 
void finish_declarator ()
 Finish the analysis of the current declarator. More...
 
- Public Member Functions inherited from Puma::PtrStack< CObjectInfo >
 PtrStack (long=8192, long=8192)
 
virtual ~PtrStack ()
 
void Push (const CObjectInfo *)
 
void Pop ()
 
CObjectInfo * Top () const
 
long Length () const
 
CObjectInfo * Get (long) const
 
void New ()
 
void Forget ()
 
void Reject ()
 
void Destroy ()
 
long Stacks () const
 
void Reset ()
 

Protected Types

enum  SemObjType {
  CLASS,
  UNION,
  ENUM,
  TYPEDEF,
  FCT,
  ATTRIB,
  ARG,
  TAG,
  NON_TAG,
  ANY
}
 

Protected Member Functions

void declareImplicitFcts ()
 
virtual CBuilder & builder () const
 
virtual CSyntax & syntax () const
 
virtual void Delete ()
 Delete the top item on the semantic stack. More...
 
CObjectInfo * lookup (const char *, SemObjType, bool=false) const
 
CObjectInfo * lookup (CT_SimpleName *, SemObjType, bool=false) const
 
CObjectInfo * lookup (const char *, CStructure *, SemObjType, bool) const
 
CObjectInfo * lookupBuiltin (const char *name) const
 
CLinkage::Type determine_linkage (CSemDeclSpecs *, SemObjType, CObjectInfo *=(CObjectInfo *) 0) const
 
CStorage::Type determine_storage_class (CSemDeclSpecs *, SemObjType, CLinkage::Type) const
 
bool typeMatch (CTypeInfo *, CTypeInfo *) const
 
CStructure * findParent () const
 
void setSpecifiers (CObjectInfo *, CSemDeclSpecs *) const
 
bool isRedefiningTypedef (CObjectInfo *, int obj_type) const
 
bool isRedefinedFunction (CFunctionInfo *) const
 
CAttributeInfo * createAttribute (const char *, CStructure *, CTypeInfo *, bool=false)
 
CTypedefInfo * createTypedef (const char *, CStructure *, CTypeInfo *)
 
void createParameter (CFunctionInfo *, CTypeInfo *)
 
CFunctionInfo * createFunction (const char *, CStructure *, CTypeInfo *)
 
CTypeInfo * resolveExpr (CTree *expr, CTree *base) const
 
- Protected Member Functions inherited from Puma::Semantic
 Semantic ()
 Constructor. More...
 
virtual ~Semantic ()
 Destructor. More...
 
void common_settings (CObjectInfo *info, CTree *tree)
 Apply command settings on the given semantic object. More...
 
void common_settings (CObjectInfo *info, CTree *tree, CSemDeclarator *d)
 Apply command settings on the given semantic object. More...
 
void Push (CObjectInfo *info)
 Push the given semantic information object on the semantic stack. More...
 
bool in_decl () const
 Check if currently analysing a declaration. More...
 
void decl_begin (CSemDeclSpecs *ds)
 Begin analysing a declaration. More...
 
void decl_end ()
 Finish analysing a declaration. More...
 
void decl_specs_begin (CT_DeclSpecSeq *dss)
 Begin analysing a declaration specifier sequence. More...
 
void decl_specs_end ()
 Finish analysing a declaration specifier sequence. More...
 
CSemDeclSpecs * sem_decl_specs () const
 Get the semantic information for the currently analysed declaration specifier sequence. More...
 
CT_DeclSpecSeq * decl_specs () const
 Get the currently analysed declaration specifier sequence. More...
 
- Protected Member Functions inherited from Puma::PtrStack< CObjectInfo >
virtual void Remove ()
 

Protected Attributes

bool in_arg_decl
 
bool _in_arg_decl_seq
 
bool is_type_name
 
bool support_implicit_int
 
PtrStack< CStructure > non_record_scopes
 
- Protected Attributes inherited from Puma::Semantic
CSemDatabase * _db
 Database of all semantic objects of the semantic tree. More...
 
CFileInfo * _file
 Top level semantic object representing the file scope. More...
 
ErrorSink * _err
 Error output stream. More...
 
long _Anonymous
 Counter for generating anonymous (private) names. More...
 
CEnumInfo * current_enum
 The current enumeration, if inside the definition of an enumeration. More...
 
CStructure * current_fct
 The current function, if inside the definition of a function. More...
 
CStructure * current_scope
 The current scope. More...
 
BCStack< CSemDeclSpecs *, 256 > _sem_decl_specs
 Stack for the type analysis of declarations. More...
 
BCStack< CT_DeclSpecSeq *, 256 > _decl_specs
 Stack for collecting declaration specifiers. More...
 
BCStack< bool, 256 > _in_param_decl_clause
 Stack for the state of analysing a function parameter list. More...
 
BCStack< bool, 256 > _in_decl
 Stack for the state of analysing a declaration. More...
 

Member Enumeration Documentation

Enumerator
CLASS 
UNION 
ENUM 
TYPEDEF 
FCT 
ATTRIB 
ARG 
TAG 
NON_TAG 
ANY 

Constructor & Destructor Documentation

Puma::CSemantic::CSemantic ( CSyntax &  s,
CBuilder &  b 
)
inline

Member Function Documentation

virtual CTree* Puma::CSemantic::abst_declarator ( )
virtual
virtual CTree* Puma::CSemantic::arg_decl_seq ( )
virtual
virtual CTree* Puma::CSemantic::array_delim ( )
virtual
virtual CTree* Puma::CSemantic::begin_decl ( )
virtual
void Puma::CSemantic::begin_param_check ( )
CBuilder & Puma::CSemantic::builder ( ) const
inlineprotectedvirtual
virtual CTree* Puma::CSemantic::class_spec ( )
virtual

Reimplemented in Puma::CCSemantic.

virtual CTree* Puma::CSemantic::cmpd_stmt ( )
virtual
void Puma::CSemantic::configure ( Config &  c)
virtual

Configure the semantic analysis.

Parameters
cThe configuration settings.

Reimplemented from Puma::Semantic.

CAttributeInfo* Puma::CSemantic::createAttribute ( const char *  ,
CStructure *  ,
CTypeInfo *  ,
bool  = false 
)
protected
CFunctionInfo* Puma::CSemantic::createFunction ( const char *  ,
CStructure *  ,
CTypeInfo *   
)
protected
void Puma::CSemantic::createParameter ( CFunctionInfo *  ,
CTypeInfo *   
)
protected
CTypedefInfo* Puma::CSemantic::createTypedef ( const char *  ,
CStructure *  ,
CTypeInfo *   
)
protected
bool Puma::CSemantic::decl_spec_seq ( )
virtual CTree* Puma::CSemantic::decl_spec_seq1 ( )
virtual

Reimplemented in Puma::CCSemantic.

virtual CTree* Puma::CSemantic::decl_spec_seq_err ( )
virtual
virtual CTree* Puma::CSemantic::declare_parameter ( )
virtual
void Puma::CSemantic::declareImplicitFcts ( )
inlineprotected
virtual void Puma::CSemantic::Delete ( )
protectedvirtual

Delete the top item on the semantic stack.

To be implemented by derived classes.

Reimplemented from Puma::Semantic.

Reimplemented in Puma::CCSemantic.

CLinkage::Type Puma::CSemantic::determine_linkage ( CSemDeclSpecs *  ,
SemObjType  ,
CObjectInfo *  = (CObjectInfo *) 0 
) const
protected
CStorage::Type Puma::CSemantic::determine_storage_class ( CSemDeclSpecs *  ,
SemObjType  ,
CLinkage::Type   
) const
protected
virtual CTree* Puma::CSemantic::direct_abst_declarator ( )
virtual
bool Puma::CSemantic::empty_decl_spec_seq ( )
void Puma::CSemantic::enter_arg_decl_seq ( )
inline
void Puma::CSemantic::enter_scope ( CStructure *  scope)
virtual

Enter the given scope.

Sets the parent of the entered scope to the current scope.

Parameters
scopeThe scope to enter.

Reimplemented from Puma::Semantic.

virtual CTree* Puma::CSemantic::enumerator_def ( )
virtual

Reimplemented in Puma::CCSemantic.

CStructure* Puma::CSemantic::findParent ( ) const
protected
virtual CTree* Puma::CSemantic::finish_fct_def ( )
virtual
virtual bool Puma::CSemantic::finish_param_check ( bool  )
virtual
virtual CTree* Puma::CSemantic::id_expr ( )
virtual
virtual CTree* Puma::CSemantic::identifier_list ( )
virtual
virtual bool Puma::CSemantic::implicit_int ( )
virtual

Reimplemented in Puma::CCSemantic.

bool Puma::CSemantic::in_arg_decl_seq ( ) const
inline
virtual void Puma::CSemantic::init ( CSemDatabase &  db,
Unit &  file 
)
virtual

Initialize the semantic analysis.

Parameters
dbThe semantic object database.
fileThe input file.

Reimplemented from Puma::Semantic.

Reimplemented in Puma::CCSemantic.

virtual CTree* Puma::CSemantic::init_declarator ( )
virtual

Reimplemented in Puma::CCSemantic.

virtual CTree* Puma::CSemantic::introduce_class ( )
virtual
virtual CTree* Puma::CSemantic::introduce_enum ( )
virtual

Reimplemented in Puma::CCSemantic.

virtual CTree* Puma::CSemantic::introduce_enumerator ( )
virtual

Reimplemented in Puma::CCSemantic.

virtual CTree* Puma::CSemantic::introduce_function ( )
virtual
virtual void Puma::CSemantic::introduce_label ( CTree *&  )
virtual
virtual CTree* Puma::CSemantic::introduce_member ( )
virtual

Reimplemented in Puma::CCSemantic.

virtual CTree* Puma::CSemantic::introduce_named_type ( )
virtual

Reimplemented in Puma::CCSemantic.

virtual CTree* Puma::CSemantic::introduce_object ( CTree *  = 0)
virtual
virtual CTree* Puma::CSemantic::introduce_parameter ( )
virtual

Reimplemented in Puma::CCSemantic.

virtual CTree* Puma::CSemantic::introduce_tag ( )
virtual

Reimplemented in Puma::CCSemantic.

bool Puma::CSemantic::isRedefinedFunction ( CFunctionInfo *  ) const
protected
bool Puma::CSemantic::isRedefiningTypedef ( CObjectInfo *  ,
int  obj_type 
) const
protected
virtual CTree* Puma::CSemantic::iter_stmt ( )
virtual
void Puma::CSemantic::leave_arg_decl_seq ( )
inline
void Puma::CSemantic::leave_scopes ( )
virtual

Leave all scopes entered up to the current scope.

Make the parent scope of the current scope to the current scope.

Reimplemented from Puma::Semantic.

CObjectInfo * Puma::CSemantic::lookup ( const char *  id,
SemObjType  type,
bool  nested = false 
) const
inlineprotected
CObjectInfo * Puma::CSemantic::lookup ( CT_SimpleName *  id,
SemObjType  type,
bool  nested = false 
) const
inlineprotected
CObjectInfo* Puma::CSemantic::lookup ( const char *  ,
CStructure *  ,
SemObjType  ,
bool   
) const
protected
CObjectInfo* Puma::CSemantic::lookupBuiltin ( const char *  name) const
protected
virtual CTree* Puma::CSemantic::param_decl_clause ( )
virtual
CProtection::Type Puma::CSemantic::protection ( ) const
inlinevirtual

Reimplemented in Puma::CCSemantic.

void Puma::CSemantic::reenter_class_scope ( )
void Puma::CSemantic::reenter_scope ( CStructure *  scope)
virtual

Reenter the given scope.

Does not reset the parent of entered scope.

Parameters
scopeThe scope to reenter.

Reimplemented from Puma::Semantic.

CTypeInfo* Puma::CSemantic::resolveExpr ( CTree *  expr,
CTree *  base 
) const
protected
virtual CTree* Puma::CSemantic::select_stmt ( )
virtual
void Puma::CSemantic::setSpecifiers ( CObjectInfo *  ,
CSemDeclSpecs *   
) const
protected
CSyntax & Puma::CSemantic::syntax ( ) const
inlineprotectedvirtual
virtual CTree* Puma::CSemantic::trans_unit ( )
virtual
virtual CTree* Puma::CSemantic::typedef_name ( )
virtual

Reimplemented in Puma::CCSemantic.

bool Puma::CSemantic::typeMatch ( CTypeInfo *  ,
CTypeInfo *   
) const
protected

Member Data Documentation

bool Puma::CSemantic::_in_arg_decl_seq
protected
bool Puma::CSemantic::in_arg_decl
protected
bool Puma::CSemantic::is_type_name
protected
PtrStack<CStructure> Puma::CSemantic::non_record_scopes
protected
bool Puma::CSemantic::support_implicit_int
protected



Puma Reference Manual. Created on Fri Aug 28 2015.