-
Notifications
You must be signed in to change notification settings - Fork 269
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
statement_list_parsert: construct with message handler
This both avoids an object of static lifetime as well as it fixes the (transitive) use of the deprecated messaget() constructor.
- Loading branch information
1 parent
856c641
commit 647ea51
Showing
5 changed files
with
31 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,10 +21,6 @@ Author: Matthias Weiss, [email protected] | |
#include <iostream> | ||
#include <iterator> | ||
|
||
statement_list_parsert statement_list_parser; | ||
|
||
extern char *yystatement_listtext; | ||
|
||
/// Searches for the name of the TIA module inside of its root | ||
/// expression. | ||
/// \param root: Expression that includes the element's name as a | ||
|
@@ -337,13 +333,8 @@ void statement_list_parsert::add_function(const exprt &function) | |
|
||
bool statement_list_parsert::parse() | ||
{ | ||
return yystatement_listparse() != 0; | ||
} | ||
|
||
int yystatement_listerror(const std::string &error) | ||
{ | ||
statement_list_parser.parse_error(error, yystatement_listtext); | ||
return 0; | ||
statement_list_scanner_init(*this); | ||
return yystatement_listparse(*this) != 0; | ||
} | ||
|
||
void statement_list_parsert::clear() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,9 +16,10 @@ Author: Matthias Weiss, [email protected] | |
|
||
#include "statement_list_parse_tree.h" | ||
|
||
class statement_list_parsert; | ||
/// Defined in statement_list_y.tab.cpp. Main function for the parse process | ||
/// generated by bison, performs all necessary steps to fill the parse tree. | ||
int yystatement_listparse(); | ||
int yystatement_listparse(statement_list_parsert &); | ||
|
||
/// Responsible for starting the parse process and to translate the result into | ||
/// a statement_list_parse_treet. This parser works by using the expression | ||
|
@@ -34,6 +35,12 @@ int yystatement_listparse(); | |
class statement_list_parsert : public parsert | ||
{ | ||
public: | ||
/// Constructor | ||
explicit statement_list_parsert(message_handlert &message_handler) | ||
: parsert(message_handler) | ||
{ | ||
} | ||
|
||
/// Starts the parsing process and saves the result inside of this instance's | ||
/// parse tree. | ||
/// \return False if successful. | ||
|
@@ -71,9 +78,6 @@ class statement_list_parsert : public parsert | |
statement_list_parse_treet parse_tree; | ||
}; | ||
|
||
/// Instance of the parser, used by other modules. | ||
extern statement_list_parsert statement_list_parser; | ||
|
||
/// Forwards any errors that are encountered during the parse process. This | ||
/// function gets called by the generated files of flex and bison. | ||
/// \param error: Error message. | ||
|
@@ -82,6 +86,6 @@ int yystatement_listerror(const std::string &error); | |
|
||
/// Defined in scanner.l. This function initialises the scanner by setting | ||
/// debug flags (if present) and its initial state. | ||
void statement_list_scanner_init(); | ||
void statement_list_scanner_init(statement_list_parsert &); | ||
|
||
#endif // CPROVER_STATEMENT_LIST_STATEMENT_LIST_PARSER_H |