cprover
|
#include "mode.h"
#include <list>
#include <memory>
#include <set>
#include "language.h"
#include <util/invariant.h>
#include <util/namespace.h>
Go to the source code of this file.
Classes | |
struct | language_entryt |
Typedefs | |
typedef std::list< language_entryt > | languagest |
Functions | |
void | register_language (language_factoryt factory) |
Register a language Note: registering a language is required for using the functions in language_util.h. More... | |
std::unique_ptr< languaget > | get_language_from_mode (const irep_idt &mode) |
Get the language corresponding to the given mode. More... | |
const irep_idt & | get_mode_from_identifier (const namespacet &ns, const irep_idt &identifier) |
Get the mode of the given identifier's symbol. More... | |
std::unique_ptr< languaget > | get_language_from_identifier (const namespacet &ns, const irep_idt &identifier) |
Get the language corresponding to the mode of the given identifier's symbol. More... | |
std::unique_ptr< languaget > | get_language_from_filename (const std::string &filename) |
Get the language corresponding to the registered file name extensions. More... | |
std::unique_ptr< languaget > | get_default_language () |
Returns the default language. More... | |
Variables | |
languagest | languages |
typedef std::list<language_entryt> languagest |
std::unique_ptr<languaget> get_default_language | ( | ) |
Returns the default language.
Definition at line 138 of file mode.cpp.
References languages, and PRECONDITION.
Referenced by get_language_from_identifier(), json(), show_symbol_table_brief_plain(), language_uit::show_symbol_table_plain(), and show_symbol_table_plain().
std::unique_ptr<languaget> get_language_from_filename | ( | const std::string & | filename | ) |
Get the language corresponding to the registered file name extensions.
filename | a filename |
nullptr
if the extension cannot be resolved to any registered language Definition at line 101 of file mode.cpp.
References languages.
Referenced by cbmc_parse_optionst::doit(), jbmc_parse_optionst::doit(), lazy_goto_modelt::initialize(), initialize_goto_model(), language_uit::parse(), compilet::parse(), and cbmc_parse_optionst::preprocessing().
std::unique_ptr<languaget> get_language_from_identifier | ( | const namespacet & | ns, |
const irep_idt & | identifier | ||
) |
Get the language corresponding to the mode of the given identifier's symbol.
ns | a namespace |
identifier | an identifier |
ID_unknown
, or the default language otherwise; Note: It is assumed as an invariant that languages of symbols in the symbol table have been registered. Definition at line 83 of file mode.cpp.
References get_default_language(), get_language_from_mode(), get_mode_from_identifier(), id2string(), and INVARIANT.
Referenced by from_expr(), from_type(), to_expr(), and type_to_name().
Get the language corresponding to the given mode.
mode | the mode, e.g. ID_C |
nullptr
if the language has not been registered Definition at line 50 of file mode.cpp.
References languages.
Referenced by goto_checkt::add_guarded_claim(), get_language_from_identifier(), json(), load_java_class(), load_java_class_lazy(), rebuild_goto_start_function_baset< maybe_lazy_goto_modelt >::operator()(), compilet::parse(), show_symbol_table_brief_plain(), language_uit::show_symbol_table_plain(), and show_symbol_table_plain().
const irep_idt& get_mode_from_identifier | ( | const namespacet & | ns, |
const irep_idt & | identifier | ||
) |
Get the mode of the given identifier's symbol.
ns | a namespace |
identifier | an identifier |
ID_C
, if the identifier is in the given symbol table, or ID_unknown
otherwise Definition at line 65 of file mode.cpp.
References dstringt::empty(), namespacet::lookup(), and symbolt::mode.
Referenced by get_language_from_identifier().
void register_language | ( | language_factoryt | factory | ) |
Register a language Note: registering a language is required for using the functions in language_util.h.
factory | a language factory, e.g. new_ansi_c_language |
Definition at line 38 of file mode.cpp.
References languaget::extensions(), languaget::id(), and languages.
Referenced by clobber_parse_optionst::doit(), jbmc_parse_optionst::doit(), load_java_class(), load_java_class_lazy(), goto_diff_languagest::register_languages(), jdiff_languagest::register_languages(), goto_cc_modet::register_languages(), cbmc_parse_optionst::register_languages(), goto_instrument_parse_optionst::register_languages(), janalyzer_parse_optionst::register_languages(), and goto_analyzer_parse_optionst::register_languages().
languagest languages |
Definition at line 32 of file mode.cpp.
Referenced by language_filest::final(), language_filest::generate_support_functions(), get_default_language(), jdiff_parse_optionst::get_goto_program(), goto_diff_parse_optionst::get_goto_program(), get_language_from_filename(), get_language_from_mode(), register_language(), and bmct::show_vcc_plain().