30 ui_message_handler(_ui_message_handler),
53 std::ifstream infile(
widen(filename));
55 std::ifstream infile(filename);
60 error() <<
"failed to open input file `" << filename <<
"'" <<
eom;
72 error() <<
"failed to figure out type of file" <<
eom;
82 status() <<
"Parsing " << filename <<
eom;
84 if(language.
parse(infile, filename))
87 std::cerr <<
"PARSING ERROR\n";
105 error() <<
"CONVERSION ERROR" <<
eom;
118 error() <<
"CONVERSION ERROR" <<
eom;
140 error() <<
"cannot show symbol table in this format" <<
eom;
146 error() <<
"cannot show symbol table in this format" <<
eom;
154 out <<
"\nSymbols:\n\n";
157 std::set<std::string> symbols;
161 symbols.insert(
id2string(symbol_pair.first));
166 for(
const std::string &
id : symbols)
170 std::unique_ptr<languaget> ptr;
184 std::string type_str, value_str;
194 out << symbol.
name <<
" " << type_str <<
'\n';
198 out <<
"Symbol......: " << symbol.
name <<
'\n' << std::flush;
199 out <<
"Pretty name.: " << symbol.
pretty_name <<
'\n';
200 out <<
"Module......: " << symbol.
module <<
'\n';
201 out <<
"Base name...: " << symbol.
base_name <<
'\n';
202 out <<
"Mode........: " << symbol.
mode <<
'\n';
203 out <<
"Type........: " << type_str <<
'\n';
204 out <<
"Value.......: " << value_str <<
'\n';
205 out <<
"Flags.......:";
210 out <<
" static_lifetime";
212 out <<
" thread_local";
214 out <<
" file_local";
241 out <<
"Location....: " << symbol.
location <<
'\n';
243 out <<
'\n' << std::flush;
symbol_tablet symbol_table
irep_idt name
The unique identifier.
virtual ~language_uit()
Destructor.
const std::string & id2string(const irep_idt &d)
bool final(symbol_table_baset &symbol_table)
std::wstring widen(const char *s)
irep_idt mode
Language mode.
std::unique_ptr< languaget > get_default_language()
Returns the default language.
std::unique_ptr< languaget > get_language_from_mode(const irep_idt &mode)
Get the language corresponding to the given mode.
language_filest language_files
language_filet & add_file(const std::string &filename)
exprt value
Initial value of symbol.
irep_idt module
Name of module the symbol belongs to.
irep_idt pretty_name
Language-specific display name.
const cmdlinet & _cmdline
virtual void show_symbol_table(bool brief=false)
std::unique_ptr< languaget > get_language_from_filename(const std::string &filename)
Get the language corresponding to the registered file name extensions.
virtual void show_symbol_table_xml_ui(bool brief)
std::unique_ptr< languaget > language
source_locationt source_location
void set_file(const irep_idt &file)
ui_message_handlert & ui_message_handler
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
Abstract interface to support a programming language.
bool typecheck(symbol_tablet &symbol_table)
virtual void set_message_handler(message_handlert &_message_handler)
virtual bool from_type(const typet &type, std::string &code, const namespacet &ns)
Formats the given type in a language-specific way.
virtual void show_symbol_table_plain(std::ostream &out, bool brief)
typet type
Type of symbol.
source_locationt location
Source code location of definition of symbol.
message_handlert & get_message_handler()
mstreamt & status() const
irep_idt base_name
Base (non-scoped) name.
virtual void set_language_options(const optionst &)
Set language-specific options.
language_uit(const cmdlinet &cmdline, ui_message_handlert &ui_message_handler, optionst *options=nullptr)
Constructor.
virtual bool from_expr(const exprt &expr, std::string &code, const namespacet &ns)
Formats the given expression in a language-specific way.
virtual bool parse(std::istream &instream, const std::string &path)=0
message_handlert * message_handler
bool lookup(const irep_idt &name, const symbolt *&symbol) const override
See documentation for namespace_baset::lookup().
void set_object_bits_from_symbol_table(const symbol_tablet &)
Sets the number of bits used for object addresses.