CBMC
ansi_c_parsert Class Reference

#include <ansi_c_parser.h>

+ Inheritance diagram for ansi_c_parsert:
+ Collaboration diagram for ansi_c_parsert:

Public Types

enum  decl_typet { decl_typet::TAG, decl_typet::MEMBER, decl_typet::PARAMETER, decl_typet::OTHER }
 
typedef configt::ansi_ct::flavourt modet
 
typedef ansi_c_identifiert identifiert
 
typedef ansi_c_scopet scopet
 
typedef std::list< scopetscopest
 
- Public Types inherited from messaget
enum  message_levelt {
  M_ERROR =1, M_WARNING =2, M_RESULT =4, M_STATUS =6,
  M_STATISTICS =8, M_PROGRESS =9, M_DEBUG =10
}
 

Public Member Functions

 ansi_c_parsert ()
 
virtual bool parse () override
 
virtual void clear () override
 
scopetroot_scope ()
 
const scopetroot_scope () const
 
void pop_scope ()
 
scopetcurrent_scope ()
 
void add_declarator (exprt &declaration, irept &declarator)
 
void add_tag_with_body (irept &tag)
 
void copy_item (const ansi_c_declarationt &declaration)
 
void new_scope (const std::string &prefix)
 
ansi_c_id_classt lookup (const irep_idt &base_name, irep_idt &identifier, bool tag, bool label)
 
irep_idt lookup_label (const irep_idt base_name)
 
bool pragma_cprover_empty ()
 True iff the CPROVER pragma stack is empty. More...
 
void pragma_cprover_push ()
 Pushes an empty level in the CPROVER pragma stack. More...
 
void pragma_cprover_pop ()
 Pops a level in the CPROVER pragma stack. More...
 
void pragma_cprover_add_check (const irep_idt &name, bool enabled)
 Adds a check to the CPROVER pragma stack. More...
 
bool pragma_cprover_clash (const irep_idt &name, bool enabled)
 Returns true iff the same check with polarity is already present at top of the stack. More...
 
void set_pragma_cprover ()
 Tags source_location with the current CPROVER pragma stack. More...
 
- Public Member Functions inherited from parsert
 parsert ()
 
virtual ~parsert ()
 
bool read (char &ch)
 
bool eof ()
 
void parse_error (const std::string &message, const std::string &before)
 
void inc_line_no ()
 
void set_line_no (unsigned _line_no)
 
void set_file (const irep_idt &file)
 
irep_idt get_file () const
 
unsigned get_line_no () const
 
unsigned get_column () const
 
void set_column (unsigned _column)
 
void set_source_location (exprt &e)
 
void set_function (const irep_idt &function)
 
void advance_column (unsigned token_width)
 
- Public Member Functions inherited from messaget
virtual void set_message_handler (message_handlert &_message_handler)
 
message_handlertget_message_handler ()
 
 messaget ()
 
 messaget (const messaget &other)
 
messagetoperator= (const messaget &other)
 
 messaget (message_handlert &_message_handler)
 
virtual ~messaget ()
 
mstreamtget_mstream (unsigned message_level) const
 
mstreamterror () const
 
mstreamtwarning () const
 
mstreamtresult () const
 
mstreamtstatus () const
 
mstreamtstatistics () const
 
mstreamtprogress () const
 
mstreamtdebug () const
 
void conditional_output (mstreamt &mstream, const std::function< void(mstreamt &)> &output_generator) const
 Generate output to message_stream using output_generator if the configured verbosity is at least as high as that of message_stream. More...
 

Static Public Member Functions

static ansi_c_id_classt get_class (const typet &type)
 
- Static Public Member Functions inherited from messaget
static unsigned eval_verbosity (const std::string &user_input, const message_levelt default_verbosity, message_handlert &dest)
 Parse a (user-)provided string as a verbosity level and set it as the verbosity of dest. More...
 
static commandt command (unsigned c)
 Create an ECMA-48 SGR (Select Graphic Rendition) command. More...
 

Public Attributes

ansi_c_parse_treet parse_tree
 
bool tag_following
 
bool asm_block_following
 
unsigned parenthesis_counter
 
std::string string_literal
 
std::list< exprtpragma_pack
 
modet mode
 
bool cpp98
 
bool cpp11
 
bool for_has_scope
 
bool ts_18661_3_Floatn_types
 
scopest scopes
 
- Public Attributes inherited from parsert
std::istream * in
 
std::string this_line
 
std::string last_line
 
std::vector< exprtstack
 

Private Attributes

std::list< std::map< const irep_idt, bool > > pragma_cprover_stack
 

Additional Inherited Members

- Static Public Attributes inherited from messaget
static eomt eom
 
static const commandt reset
 return to default formatting, as defined by the terminal More...
 
static const commandt red
 render text with red foreground color More...
 
static const commandt green
 render text with green foreground color More...
 
static const commandt yellow
 render text with yellow foreground color More...
 
static const commandt blue
 render text with blue foreground color More...
 
static const commandt magenta
 render text with magenta foreground color More...
 
static const commandt cyan
 render text with cyan foreground color More...
 
static const commandt bright_red
 render text with bright red foreground color More...
 
static const commandt bright_green
 render text with bright green foreground color More...
 
static const commandt bright_yellow
 render text with bright yellow foreground color More...
 
static const commandt bright_blue
 render text with bright blue foreground color More...
 
static const commandt bright_magenta
 render text with bright magenta foreground color More...
 
static const commandt bright_cyan
 render text with bright cyan foreground color More...
 
static const commandt bold
 render text with bold font More...
 
static const commandt faint
 render text with faint font More...
 
static const commandt italic
 render italic text More...
 
static const commandt underline
 render underlined text More...
 
- Protected Attributes inherited from parsert
source_locationt source_location
 
unsigned line_no
 
unsigned previous_line_no
 
unsigned column
 
- Protected Attributes inherited from messaget
message_handlertmessage_handler
 
mstreamt mstream
 

Detailed Description

Definition at line 23 of file ansi_c_parser.h.

Member Typedef Documentation

◆ identifiert

◆ modet

◆ scopest

typedef std::list<scopet> ansi_c_parsert::scopest

Definition at line 85 of file ansi_c_parser.h.

◆ scopet

Definition at line 83 of file ansi_c_parser.h.

Member Enumeration Documentation

◆ decl_typet

Enumerator
TAG 
MEMBER 
PARAMETER 
OTHER 

Definition at line 109 of file ansi_c_parser.h.

Constructor & Destructor Documentation

◆ ansi_c_parsert()

ansi_c_parsert::ansi_c_parsert ( )
inline

Definition at line 28 of file ansi_c_parser.h.

Member Function Documentation

◆ add_declarator()

void ansi_c_parsert::add_declarator ( exprt declaration,
irept declarator 
)

Definition at line 84 of file ansi_c_parser.cpp.

◆ add_tag_with_body()

void ansi_c_parsert::add_tag_with_body ( irept tag)

Definition at line 58 of file ansi_c_parser.cpp.

◆ clear()

virtual void ansi_c_parsert::clear ( )
inlineoverridevirtual

Reimplemented from parsert.

Definition at line 45 of file ansi_c_parser.h.

◆ copy_item()

void ansi_c_parsert::copy_item ( const ansi_c_declarationt declaration)
inline

Definition at line 117 of file ansi_c_parser.h.

◆ current_scope()

scopet& ansi_c_parsert::current_scope ( )
inline

Definition at line 103 of file ansi_c_parser.h.

◆ get_class()

ansi_c_id_classt ansi_c_parsert::get_class ( const typet type)
static

Definition at line 157 of file ansi_c_parser.cpp.

◆ lookup()

ansi_c_id_classt ansi_c_parsert::lookup ( const irep_idt base_name,
irep_idt identifier,
bool  tag,
bool  label 
)

Definition at line 15 of file ansi_c_parser.cpp.

◆ lookup_label()

irep_idt ansi_c_parsert::lookup_label ( const irep_idt  base_name)
inline

Definition at line 138 of file ansi_c_parser.h.

◆ new_scope()

void ansi_c_parsert::new_scope ( const std::string &  prefix)
inline

Definition at line 123 of file ansi_c_parser.h.

◆ parse()

virtual bool ansi_c_parsert::parse ( )
inlineoverridevirtual

Implements parsert.

Definition at line 40 of file ansi_c_parser.h.

◆ pop_scope()

void ansi_c_parsert::pop_scope ( )
inline

Definition at line 98 of file ansi_c_parser.h.

◆ pragma_cprover_add_check()

void ansi_c_parsert::pragma_cprover_add_check ( const irep_idt name,
bool  enabled 
)

Adds a check to the CPROVER pragma stack.

Definition at line 194 of file ansi_c_parser.cpp.

◆ pragma_cprover_clash()

bool ansi_c_parsert::pragma_cprover_clash ( const irep_idt name,
bool  enabled 
)

Returns true iff the same check with polarity is already present at top of the stack.

Definition at line 204 of file ansi_c_parser.cpp.

◆ pragma_cprover_empty()

bool ansi_c_parsert::pragma_cprover_empty ( )

True iff the CPROVER pragma stack is empty.

Definition at line 179 of file ansi_c_parser.cpp.

◆ pragma_cprover_pop()

void ansi_c_parsert::pragma_cprover_pop ( )

Pops a level in the CPROVER pragma stack.

Definition at line 189 of file ansi_c_parser.cpp.

◆ pragma_cprover_push()

void ansi_c_parsert::pragma_cprover_push ( )

Pushes an empty level in the CPROVER pragma stack.

Definition at line 184 of file ansi_c_parser.cpp.

◆ root_scope() [1/2]

scopet& ansi_c_parsert::root_scope ( )
inline

Definition at line 88 of file ansi_c_parser.h.

◆ root_scope() [2/2]

const scopet& ansi_c_parsert::root_scope ( ) const
inline

Definition at line 93 of file ansi_c_parser.h.

◆ set_pragma_cprover()

void ansi_c_parsert::set_pragma_cprover ( )

Tags source_location with the current CPROVER pragma stack.

Definition at line 211 of file ansi_c_parser.cpp.

Member Data Documentation

◆ asm_block_following

bool ansi_c_parsert::asm_block_following

Definition at line 65 of file ansi_c_parser.h.

◆ cpp11

bool ansi_c_parsert::cpp11

Definition at line 74 of file ansi_c_parser.h.

◆ cpp98

bool ansi_c_parsert::cpp98

Definition at line 74 of file ansi_c_parser.h.

◆ for_has_scope

bool ansi_c_parsert::for_has_scope

Definition at line 77 of file ansi_c_parser.h.

◆ mode

modet ansi_c_parsert::mode

Definition at line 71 of file ansi_c_parser.h.

◆ parenthesis_counter

unsigned ansi_c_parsert::parenthesis_counter

Definition at line 66 of file ansi_c_parser.h.

◆ parse_tree

ansi_c_parse_treet ansi_c_parsert::parse_tree

Definition at line 26 of file ansi_c_parser.h.

◆ pragma_cprover_stack

std::list<std::map<const irep_idt, bool> > ansi_c_parsert::pragma_cprover_stack
private

Definition at line 166 of file ansi_c_parser.h.

◆ pragma_pack

std::list<exprt> ansi_c_parsert::pragma_pack

Definition at line 68 of file ansi_c_parser.h.

◆ scopes

scopest ansi_c_parsert::scopes

Definition at line 86 of file ansi_c_parser.h.

◆ string_literal

std::string ansi_c_parsert::string_literal

Definition at line 67 of file ansi_c_parser.h.

◆ tag_following

bool ansi_c_parsert::tag_following

Definition at line 64 of file ansi_c_parser.h.

◆ ts_18661_3_Floatn_types

bool ansi_c_parsert::ts_18661_3_Floatn_types

Definition at line 80 of file ansi_c_parser.h.


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