-
Notifications
You must be signed in to change notification settings - Fork 277
ansi_c_parsert: construct with message handler #8141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,22 @@ Author: Daniel Kroening, [email protected] | |
|
||
#include "c_storage_spec.h" | ||
|
||
ansi_c_parsert ansi_c_parser; | ||
int yyansi_clex_init_extra(ansi_c_parsert *, void **); | ||
int yyansi_clex_destroy(void *); | ||
int yyansi_cparse(ansi_c_parsert &, void *); | ||
void yyansi_cset_debug(int, void *); | ||
|
||
bool ansi_c_parsert::parse() | ||
{ | ||
void *scanner; | ||
yyansi_clex_init_extra(this, &scanner); | ||
#ifdef ANSI_C_DEBUG | ||
yyansi_cset_debug(1, scanner); | ||
#endif | ||
bool parse_fail = yyansi_cparse(*this, scanner) != 0; | ||
yyansi_clex_destroy(scanner); | ||
return parse_fail; | ||
} | ||
|
||
ansi_c_id_classt ansi_c_parsert::lookup( | ||
const irep_idt &base_name, | ||
|
@@ -73,14 +88,6 @@ void ansi_c_parsert::add_tag_with_body(irept &tag) | |
} | ||
} | ||
|
||
extern char *yyansi_ctext; | ||
|
||
int yyansi_cerror(const std::string &error) | ||
{ | ||
ansi_c_parser.parse_error(error, yyansi_ctext); | ||
return 0; | ||
} | ||
|
||
void ansi_c_parsert::add_declarator( | ||
exprt &declaration, | ||
irept &declarator) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,15 +18,14 @@ Author: Daniel Kroening, [email protected] | |
#include "ansi_c_parse_tree.h" | ||
#include "ansi_c_scope.h" | ||
|
||
int yyansi_cparse(); | ||
|
||
class ansi_c_parsert:public parsert | ||
{ | ||
public: | ||
ansi_c_parse_treet parse_tree; | ||
|
||
ansi_c_parsert() | ||
: tag_following(false), | ||
explicit ansi_c_parsert(message_handlert &message_handler) | ||
: parsert(message_handler), | ||
tag_following(false), | ||
asm_block_following(false), | ||
parenthesis_counter(0), | ||
mode(modet::NONE), | ||
|
@@ -37,14 +36,14 @@ class ansi_c_parsert:public parsert | |
float16_type(false), | ||
bf16_type(false) | ||
{ | ||
// set up global scope | ||
scopes.clear(); | ||
scopes.push_back(scopet()); | ||
} | ||
|
||
virtual bool parse() override | ||
{ | ||
return yyansi_cparse()!=0; | ||
} | ||
bool parse() override; | ||
|
||
virtual void clear() override | ||
void clear() override | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ❓ Is this function still used anywhere? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I will clean this up across the type hierarchy (removing just this override seems dangerous, as any use of |
||
{ | ||
parsert::clear(); | ||
parse_tree.clear(); | ||
|
@@ -170,9 +169,4 @@ class ansi_c_parsert:public parsert | |
std::list<std::map<const irep_idt, bool>> pragma_cprover_stack; | ||
}; | ||
|
||
extern ansi_c_parsert ansi_c_parser; | ||
|
||
int yyansi_cerror(const std::string &error); | ||
void ansi_c_scanner_init(); | ||
|
||
#endif // CPROVER_ANSI_C_ANSI_C_PARSER_H |
Uh oh!
There was an error while loading. Please reload this page.