cprover
Parser Class Reference
Collaboration diagram for Parser:
[legend]

Public Member Functions

 Parser (cpp_parsert &_cpp_parser)
 
bool operator() ()
 

Protected Types

enum  DeclKind { kDeclarator, kArgDeclarator, kCastDeclarator }
 
enum  TemplateDeclKind {
  tdk_unknown, tdk_decl, tdk_instantiation, tdk_specialization,
  num_tdks
}
 

Protected Member Functions

new_scopetadd_id (const irept &name, new_scopet::kindt)
 
new_scopetadd_id (const irep_idt &, new_scopet::kindt)
 
void make_sub_scope (const irept &name, new_scopet::kindt)
 
void make_sub_scope (const irep_idt &, new_scopet::kindt)
 
bool rProgram (cpp_itemt &item)
 
bool SyntaxError ()
 
bool rDefinition (cpp_itemt &)
 
bool rNullDeclaration (cpp_declarationt &)
 
bool rTypedef (cpp_declarationt &)
 
bool rTypedefUsing (cpp_declarationt &)
 
bool rTypedefStatement (codet &)
 
bool rTypeSpecifier (typet &, bool)
 
bool isTypeSpecifier ()
 
bool rLinkageSpec (cpp_linkage_spect &)
 
bool rNamespaceSpec (cpp_namespace_spect &)
 
bool rUsing (cpp_usingt &)
 
bool rStaticAssert (cpp_static_assertt &)
 
bool rLinkageBody (cpp_linkage_spect::itemst &)
 
bool rTemplateDecl (cpp_declarationt &)
 
bool rTemplateDecl2 (typet &, TemplateDeclKind &kind)
 
bool rTempArgList (irept &)
 
bool rTempArgDeclaration (cpp_declarationt &)
 
bool rExternTemplateDecl (irept &)
 
bool rDeclaration (cpp_declarationt &)
 
bool rIntegralDeclaration (cpp_declarationt &, cpp_storage_spect &, cpp_member_spect &, typet &, typet &)
 
bool rConstDeclaration (cpp_declarationt &, cpp_storage_spect &, cpp_member_spect &, typet &)
 
bool rOtherDeclaration (cpp_declarationt &, cpp_storage_spect &, cpp_member_spect &, typet &)
 
bool rCondition (exprt &)
 
bool rSimpleDeclaration (cpp_declarationt &)
 
bool isConstructorDecl ()
 
bool isPtrToMember (int)
 
bool optMemberSpec (cpp_member_spect &)
 
bool optStorageSpec (cpp_storage_spect &)
 
bool optCvQualify (typet &)
 
bool optAlignas (typet &)
 
bool rAttribute (typet &)
 
bool optAttribute (cpp_declarationt &)
 
bool optIntegralTypeOrClassSpec (typet &)
 
bool rConstructorDecl (cpp_declaratort &, typet &, typet &trailing_return_type)
 
bool optThrowDecl (irept &)
 
bool rDeclarators (cpp_declarationt::declaratorst &, bool, bool=false)
 
bool rDeclaratorWithInit (cpp_declaratort &, bool, bool)
 
bool rDeclarator (cpp_declaratort &, DeclKind, bool, bool, bool=false)
 
bool rDeclaratorQualifier ()
 
bool optPtrOperator (typet &)
 
bool rMemberInitializers (irept &)
 
bool rMemberInit (exprt &)
 
bool rName (irept &)
 
bool rOperatorName (irept &)
 
bool rCastOperatorName (irept &)
 
bool rPtrToMember (irept &)
 
bool rTemplateArgs (irept &)
 
bool rArgDeclListOrInit (exprt &, bool &, bool)
 
bool rArgDeclList (irept &)
 
bool rArgDeclaration (cpp_declarationt &)
 
bool rFunctionArguments (exprt &)
 
bool rInitializeExpr (exprt &)
 
bool rEnumSpec (typet &)
 
bool rEnumBody (irept &)
 
bool rClassSpec (typet &)
 
bool rBaseSpecifiers (irept &)
 
bool rClassBody (exprt &)
 
bool rClassMember (cpp_itemt &)
 
bool rAccessDecl (irept &)
 
bool rCommaExpression (exprt &)
 
bool rExpression (exprt &, bool)
 
bool rConditionalExpr (exprt &, bool)
 
bool rLogicalOrExpr (exprt &, bool)
 
bool rLogicalAndExpr (exprt &, bool)
 
bool rInclusiveOrExpr (exprt &, bool)
 
bool rExclusiveOrExpr (exprt &, bool)
 
bool rAndExpr (exprt &, bool)
 
bool rEqualityExpr (exprt &, bool)
 
bool rRelationalExpr (exprt &, bool)
 
bool rShiftExpr (exprt &, bool)
 
bool rAdditiveExpr (exprt &)
 
bool rMultiplyExpr (exprt &)
 
bool rPmExpr (exprt &)
 
bool rCastExpr (exprt &)
 
bool rTypeName (typet &)
 
bool rTypeNameOrFunctionType (typet &)
 
bool rUnaryExpr (exprt &)
 
bool rThrowExpr (exprt &)
 
bool rNoexceptExpr (exprt &)
 
bool rSizeofExpr (exprt &)
 
bool rTypeidExpr (exprt &)
 
bool rAlignofExpr (exprt &)
 
bool isAllocateExpr (int)
 
bool rAllocateExpr (exprt &)
 
bool rAllocateType (exprt &, typet &, exprt &)
 
bool rNewDeclarator (typet &)
 
bool rAllocateInitializer (exprt &)
 
bool rPostfixExpr (exprt &)
 
bool rPrimaryExpr (exprt &)
 
bool rVarName (exprt &)
 
bool rVarNameCore (exprt &)
 
bool maybeTemplateArgs ()
 
bool rFunctionBody (cpp_declaratort &)
 
bool rCompoundStatement (codet &)
 
bool rStatement (codet &)
 
bool rIfStatement (codet &)
 
bool rSwitchStatement (codet &)
 
bool rWhileStatement (codet &)
 
bool rDoStatement (codet &)
 
bool rForStatement (codet &)
 
bool rTryStatement (codet &)
 
bool rExprStatement (codet &)
 
bool rDeclarationStatement (codet &)
 
bool rIntegralDeclStatement (codet &, cpp_storage_spect &, typet &, typet &)
 
bool rOtherDeclStatement (codet &, cpp_storage_spect &, typet &)
 
bool MaybeTypeNameOrClassTemplate (cpp_tokent &)
 
void SkipTo (int token)
 
bool moreVarName ()
 
bool rString (cpp_tokent &tk)
 
bool rGCCAsmStatement (codet &)
 
bool rMSC_tryStatement (codet &)
 
bool rMSC_leaveStatement (codet &)
 
bool rMSCAsmStatement (codet &)
 
bool rMSC_if_existsStatement (codet &)
 
bool rTypePredicate (exprt &)
 
bool rMSCuuidof (exprt &)
 
bool rMSC_if_existsExpr (exprt &)
 
void merge_types (const typet &src, typet &dest)
 
void set_location (irept &dest, const cpp_tokent &token)
 
void make_subtype (const typet &src, typet &dest)
 

Protected Attributes

cpp_token_buffertlex
 
cpp_parsertparser
 
new_scopet root_scope
 
new_scopetcurrent_scope
 
std::size_t number_of_errors
 
irep_idt current_function
 
unsigned int max_errors
 

Detailed Description

Definition at line 200 of file parse.cpp.

Member Enumeration Documentation

◆ DeclKind

enum Parser::DeclKind
protected
Enumerator
kDeclarator 
kArgDeclarator 
kCastDeclarator 

Definition at line 226 of file parse.cpp.

◆ TemplateDeclKind

enum Parser::TemplateDeclKind
protected
Enumerator
tdk_unknown 
tdk_decl 
tdk_instantiation 
tdk_specialization 
num_tdks 

Definition at line 227 of file parse.cpp.

Constructor & Destructor Documentation

◆ Parser()

Parser::Parser ( cpp_parsert _cpp_parser)
inlineexplicit

Definition at line 203 of file parse.cpp.

References current_scope, new_scopet::kind, new_scopet::NAMESPACE, and root_scope.

Member Function Documentation

◆ add_id() [1/2]

new_scopet & Parser::add_id ( const irept name,
new_scopet::kindt  kind 
)
protected

Definition at line 421 of file parse.cpp.

References current_scope, new_scopet::get_anon_id(), and irept::get_sub().

Referenced by make_sub_scope(), and rTempArgDeclaration().

◆ add_id() [2/2]

new_scopet & Parser::add_id ( const irep_idt id,
new_scopet::kindt  kind 
)
protected

◆ isAllocateExpr()

bool Parser::isAllocateExpr ( int  t)
protected

Definition at line 6018 of file parse.cpp.

References lex, cpp_token_buffert::LookAhead(), TOK_DELETE, TOK_NEW, and TOK_SCOPE.

Referenced by rUnaryExpr().

◆ isConstructorDecl()

bool Parser::isConstructorDecl ( )
protected

◆ isPtrToMember()

bool Parser::isPtrToMember ( int  i)
protected

Definition at line 1903 of file parse.cpp.

References lex, cpp_token_buffert::LookAhead(), TOK_IDENTIFIER, and TOK_SCOPE.

Referenced by isConstructorDecl(), and optPtrOperator().

◆ isTypeSpecifier()

◆ make_sub_scope() [1/2]

void Parser::make_sub_scope ( const irept name,
new_scopet::kindt  kind 
)
protected

Definition at line 445 of file parse.cpp.

References add_id(), and current_scope.

Referenced by rClassSpec(), and rTemplateDecl().

◆ make_sub_scope() [2/2]

void Parser::make_sub_scope ( const irep_idt id,
new_scopet::kindt  kind 
)
protected

Definition at line 451 of file parse.cpp.

References add_id(), and current_scope.

◆ make_subtype()

void Parser::make_subtype ( const typet src,
typet dest 
)
inlineprotected

◆ maybeTemplateArgs()

bool Parser::maybeTemplateArgs ( )
protected

Definition at line 7056 of file parse.cpp.

References lex, cpp_token_buffert::LookAhead(), TOK_SCOPE, and TOK_SHIFTRIGHT.

Referenced by rVarNameCore().

◆ MaybeTypeNameOrClassTemplate()

bool Parser::MaybeTypeNameOrClassTemplate ( cpp_tokent )
protected

Definition at line 8357 of file parse.cpp.

Referenced by rTypeSpecifier().

◆ merge_types()

◆ moreVarName()

bool Parser::moreVarName ( )
protected

Definition at line 7039 of file parse.cpp.

References lex, cpp_token_buffert::LookAhead(), TOK_IDENTIFIER, TOK_OPERATOR, TOK_SCOPE, and TOK_TEMPLATE.

Referenced by rVarNameCore().

◆ operator()()

bool Parser::operator() ( void  )

◆ optAlignas()

bool Parser::optAlignas ( typet cv)
protected

◆ optAttribute()

bool Parser::optAttribute ( cpp_declarationt declaration)
protected

◆ optCvQualify()

◆ optIntegralTypeOrClassSpec()

◆ optMemberSpec()

◆ optPtrOperator()

◆ optStorageSpec()

◆ optThrowDecl()

bool Parser::optThrowDecl ( irept throw_decl)
protected

◆ rAccessDecl()

bool Parser::rAccessDecl ( irept mem)
protected

Definition at line 4718 of file parse.cpp.

References cpp_token_buffert::get_token(), lex, and rName().

Referenced by rClassMember().

◆ rAdditiveExpr()

bool Parser::rAdditiveExpr ( exprt exp)
protected

◆ rAlignofExpr()

bool Parser::rAlignofExpr ( exprt exp)
protected

◆ rAllocateExpr()

◆ rAllocateInitializer()

bool Parser::rAllocateInitializer ( exprt init)
protected

◆ rAllocateType()

◆ rAndExpr()

bool Parser::rAndExpr ( exprt exp,
bool  template_args 
)
protected

◆ rArgDeclaration()

◆ rArgDeclList()

bool Parser::rArgDeclList ( irept arglist)
protected

◆ rArgDeclListOrInit()

bool Parser::rArgDeclListOrInit ( exprt arglist,
bool &  is_args,
bool  maybe_init 
)
protected

◆ rAttribute()

◆ rBaseSpecifiers()

bool Parser::rBaseSpecifiers ( irept bases)
protected

◆ rCastExpr()

◆ rCastOperatorName()

bool Parser::rCastOperatorName ( irept name)
protected

◆ rClassBody()

◆ rClassMember()

◆ rClassSpec()

◆ rCommaExpression()

◆ rCompoundStatement()

◆ rCondition()

bool Parser::rCondition ( exprt statement)
protected

◆ rConditionalExpr()

bool Parser::rConditionalExpr ( exprt exp,
bool  template_args 
)
protected

◆ rConstDeclaration()

bool Parser::rConstDeclaration ( cpp_declarationt declaration,
cpp_storage_spect storage_spec,
cpp_member_spect member_spec,
typet cv_q 
)
protected

◆ rConstructorDecl()

◆ rDeclaration()

◆ rDeclarationStatement()

◆ rDeclarator()

◆ rDeclaratorQualifier()

bool Parser::rDeclaratorQualifier ( )
protected

◆ rDeclarators()

bool Parser::rDeclarators ( cpp_declarationt::declaratorst declarators,
bool  should_be_declarator,
bool  is_statement = false 
)
protected

◆ rDeclaratorWithInit()

◆ rDefinition()

◆ rDoStatement()

bool Parser::rDoStatement ( codet statement)
protected

◆ rEnumBody()

◆ rEnumSpec()

◆ rEqualityExpr()

bool Parser::rEqualityExpr ( exprt exp,
bool  template_args 
)
protected

◆ rExclusiveOrExpr()

bool Parser::rExclusiveOrExpr ( exprt exp,
bool  template_args 
)
protected

◆ rExpression()

◆ rExprStatement()

◆ rExternTemplateDecl()

bool Parser::rExternTemplateDecl ( irept decl)
protected

Definition at line 1339 of file parse.cpp.

References cpp_token_buffert::get_token(), lex, rDeclaration(), TOK_EXTERN, and TOK_TEMPLATE.

Referenced by rDefinition().

◆ rForStatement()

◆ rFunctionArguments()

bool Parser::rFunctionArguments ( exprt args)
protected

◆ rFunctionBody()

◆ rGCCAsmStatement()

◆ rIfStatement()

◆ rInclusiveOrExpr()

bool Parser::rInclusiveOrExpr ( exprt exp,
bool  template_args 
)
protected

◆ rInitializeExpr()

◆ rIntegralDeclaration()

◆ rIntegralDeclStatement()

◆ rLinkageBody()

bool Parser::rLinkageBody ( cpp_linkage_spect::itemst items)
protected

◆ rLinkageSpec()

◆ rLogicalAndExpr()

bool Parser::rLogicalAndExpr ( exprt exp,
bool  template_args 
)
protected

◆ rLogicalOrExpr()

bool Parser::rLogicalOrExpr ( exprt exp,
bool  template_args 
)
protected

◆ rMemberInit()

◆ rMemberInitializers()

bool Parser::rMemberInitializers ( irept init)
protected

◆ rMSC_if_existsExpr()

bool Parser::rMSC_if_existsExpr ( exprt expr)
protected

◆ rMSC_if_existsStatement()

bool Parser::rMSC_if_existsStatement ( codet code)
protected

◆ rMSC_leaveStatement()

bool Parser::rMSC_leaveStatement ( codet statement)
protected

Definition at line 7889 of file parse.cpp.

References cpp_token_buffert::get_token(), lex, set_location(), and TOK_MSC_LEAVE.

Referenced by rStatement().

◆ rMSC_tryStatement()

◆ rMSCAsmStatement()

bool Parser::rMSCAsmStatement ( codet statement)
protected

◆ rMSCuuidof()

◆ rMultiplyExpr()

bool Parser::rMultiplyExpr ( exprt exp)
protected

◆ rName()

◆ rNamespaceSpec()

◆ rNewDeclarator()

bool Parser::rNewDeclarator ( typet decl)
protected

◆ rNoexceptExpr()

bool Parser::rNoexceptExpr ( exprt exp)
protected

◆ rNullDeclaration()

bool Parser::rNullDeclaration ( cpp_declarationt decl)
protected

Definition at line 592 of file parse.cpp.

References cpp_token_buffert::get_token(), lex, and set_location().

Referenced by rClassMember(), and rDefinition().

◆ rOperatorName()

◆ rOtherDeclaration()

◆ rOtherDeclStatement()

◆ rPmExpr()

bool Parser::rPmExpr ( exprt exp)
protected

◆ rPostfixExpr()

◆ rPrimaryExpr()

◆ rProgram()

bool Parser::rProgram ( cpp_itemt item)
protected

◆ rPtrToMember()

◆ rRelationalExpr()

bool Parser::rRelationalExpr ( exprt exp,
bool  template_args 
)
protected

◆ rShiftExpr()

bool Parser::rShiftExpr ( exprt exp,
bool  template_args 
)
protected

◆ rSimpleDeclaration()

◆ rSizeofExpr()

◆ rStatement()

◆ rStaticAssert()

bool Parser::rStaticAssert ( cpp_static_assertt cpp_static_assert)
protected

◆ rString()

bool Parser::rString ( cpp_tokent tk)
protected

◆ rSwitchStatement()

bool Parser::rSwitchStatement ( codet statement)
protected

◆ rTempArgDeclaration()

◆ rTempArgList()

bool Parser::rTempArgList ( irept args)
protected

◆ rTemplateArgs()

◆ rTemplateDecl()

◆ rTemplateDecl2()

◆ rThrowExpr()

bool Parser::rThrowExpr ( exprt exp)
protected

◆ rTryStatement()

◆ rTypedef()

◆ rTypedefStatement()

bool Parser::rTypedefStatement ( codet statement)
protected

Definition at line 685 of file parse.cpp.

References exprt::op0(), exprt::operands(), and rTypedef().

Referenced by rStatement().

◆ rTypedefUsing()

◆ rTypeidExpr()

◆ rTypeName()

◆ rTypeNameOrFunctionType()

◆ rTypePredicate()

◆ rTypeSpecifier()

◆ rUnaryExpr()

◆ rUsing()

◆ rVarName()

bool Parser::rVarName ( exprt name)
protected

◆ rVarNameCore()

◆ rWhileStatement()

bool Parser::rWhileStatement ( codet statement)
protected

◆ set_location()

void Parser::set_location ( irept dest,
const cpp_tokent token 
)
inlineprotected

Definition at line 390 of file parse.cpp.

References irept::add(), current_function, dstringt::empty(), cpp_tokent::filename, cpp_tokent::line_no, source_locationt::set_file(), source_locationt::set_function(), and source_locationt::set_line().

Referenced by optCvQualify(), optIntegralTypeOrClassSpec(), optPtrOperator(), optStorageSpec(), rAdditiveExpr(), rAlignofExpr(), rAllocateExpr(), rAndExpr(), rAttribute(), rCastExpr(), rClassBody(), rClassMember(), rClassSpec(), rCommaExpression(), rCompoundStatement(), rConditionalExpr(), rConstructorDecl(), rDeclaratorWithInit(), rDoStatement(), rEnumBody(), rEnumSpec(), rEqualityExpr(), rExclusiveOrExpr(), rExpression(), rExprStatement(), rForStatement(), rFunctionBody(), rGCCAsmStatement(), rIfStatement(), rInclusiveOrExpr(), rInitializeExpr(), rIntegralDeclStatement(), rLinkageSpec(), rLogicalAndExpr(), rLogicalOrExpr(), rMemberInit(), rMemberInitializers(), rMSC_if_existsExpr(), rMSC_if_existsStatement(), rMSC_leaveStatement(), rMSC_tryStatement(), rMSCAsmStatement(), rMSCuuidof(), rMultiplyExpr(), rName(), rNamespaceSpec(), rNewDeclarator(), rNoexceptExpr(), rNullDeclaration(), rOperatorName(), rOtherDeclStatement(), rPmExpr(), rPostfixExpr(), rPrimaryExpr(), rPtrToMember(), rRelationalExpr(), rShiftExpr(), rSizeofExpr(), rStatement(), rStaticAssert(), rSwitchStatement(), rTempArgDeclaration(), rTemplateArgs(), rTemplateDecl2(), rThrowExpr(), rTryStatement(), rTypedef(), rTypedefUsing(), rTypeidExpr(), rTypePredicate(), rUnaryExpr(), rUsing(), rVarNameCore(), and rWhileStatement().

◆ SkipTo()

void Parser::SkipTo ( int  token)
protected

◆ SyntaxError()

Member Data Documentation

◆ current_function

irep_idt Parser::current_function
protected

Definition at line 386 of file parse.cpp.

Referenced by rFunctionBody(), and set_location().

◆ current_scope

new_scopet* Parser::current_scope
protected

Definition at line 220 of file parse.cpp.

Referenced by add_id(), make_sub_scope(), Parser(), rClassSpec(), and rTemplateDecl().

◆ lex

cpp_token_buffert& Parser::lex
protected

Definition at line 215 of file parse.cpp.

Referenced by isAllocateExpr(), isConstructorDecl(), isPtrToMember(), isTypeSpecifier(), maybeTemplateArgs(), moreVarName(), optAlignas(), optAttribute(), optCvQualify(), optIntegralTypeOrClassSpec(), optMemberSpec(), optPtrOperator(), optStorageSpec(), optThrowDecl(), rAccessDecl(), rAdditiveExpr(), rAlignofExpr(), rAllocateExpr(), rAllocateInitializer(), rAllocateType(), rAndExpr(), rArgDeclaration(), rArgDeclList(), rArgDeclListOrInit(), rAttribute(), rBaseSpecifiers(), rCastExpr(), rClassBody(), rClassMember(), rClassSpec(), rCommaExpression(), rCompoundStatement(), rCondition(), rConditionalExpr(), rConstDeclaration(), rConstructorDecl(), rDeclaration(), rDeclarationStatement(), rDeclarator(), rDeclaratorQualifier(), rDeclarators(), rDeclaratorWithInit(), rDefinition(), rDoStatement(), rEnumBody(), rEnumSpec(), rEqualityExpr(), rExclusiveOrExpr(), rExpression(), rExprStatement(), rExternTemplateDecl(), rForStatement(), rFunctionArguments(), rFunctionBody(), rGCCAsmStatement(), rIfStatement(), rInclusiveOrExpr(), rInitializeExpr(), rIntegralDeclaration(), rIntegralDeclStatement(), rLinkageBody(), rLinkageSpec(), rLogicalAndExpr(), rLogicalOrExpr(), rMemberInit(), rMemberInitializers(), rMSC_if_existsExpr(), rMSC_if_existsStatement(), rMSC_leaveStatement(), rMSC_tryStatement(), rMSCAsmStatement(), rMSCuuidof(), rMultiplyExpr(), rName(), rNamespaceSpec(), rNewDeclarator(), rNoexceptExpr(), rNullDeclaration(), rOperatorName(), rOtherDeclaration(), rOtherDeclStatement(), rPmExpr(), rPostfixExpr(), rPrimaryExpr(), rProgram(), rPtrToMember(), rRelationalExpr(), rShiftExpr(), rSimpleDeclaration(), rSizeofExpr(), rStatement(), rStaticAssert(), rString(), rSwitchStatement(), rTempArgDeclaration(), rTempArgList(), rTemplateArgs(), rTemplateDecl(), rTemplateDecl2(), rThrowExpr(), rTryStatement(), rTypedef(), rTypedefUsing(), rTypeidExpr(), rTypeNameOrFunctionType(), rTypePredicate(), rTypeSpecifier(), rUnaryExpr(), rUsing(), rVarNameCore(), rWhileStatement(), SkipTo(), and SyntaxError().

◆ max_errors

unsigned int Parser::max_errors
protected

Definition at line 418 of file parse.cpp.

Referenced by operator()(), and SyntaxError().

◆ number_of_errors

std::size_t Parser::number_of_errors
protected

Definition at line 385 of file parse.cpp.

Referenced by operator()(), and SyntaxError().

◆ parser

cpp_parsert& Parser::parser
protected

Definition at line 216 of file parse.cpp.

Referenced by operator()(), and SyntaxError().

◆ root_scope

new_scopet Parser::root_scope
protected

Definition at line 219 of file parse.cpp.

Referenced by operator()(), and Parser().


The documentation for this class was generated from the following file: