-
Notifications
You must be signed in to change notification settings - Fork 270
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
assembler_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. The scanner is now fully reentrant.
- Loading branch information
1 parent
09dca35
commit 17471e9
Showing
12 changed files
with
67 additions
and
55 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,12 +8,26 @@ Author: Daniel Kroening, [email protected] | |
|
||
#include "assembler_parser.h" | ||
|
||
assembler_parsert assembler_parser; | ||
char *yyassemblerget_text(void *); | ||
|
||
extern char *yyassemblertext; | ||
|
||
int yyassemblererror(const std::string &error) | ||
int yyassemblererror( | ||
assembler_parsert &assembler_parser, | ||
void *scanner, | ||
const std::string &error) | ||
{ | ||
assembler_parser.parse_error(error, yyassemblertext); | ||
assembler_parser.parse_error(error, yyassemblerget_text(scanner)); | ||
return 0; | ||
} | ||
|
||
int yyassemblerlex_init_extra(assembler_parsert *, void **); | ||
int yyassemblerlex(void *); | ||
int yyassemblerlex_destroy(void *); | ||
|
||
bool assembler_parsert::parse() | ||
{ | ||
void *scanner; | ||
yyassemblerlex_init_extra(this, &scanner); | ||
yyassemblerlex(scanner); | ||
yyassemblerlex_destroy(scanner); | ||
return false; | ||
} |
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 |
---|---|---|
|
@@ -14,9 +14,8 @@ Author: Daniel Kroening, [email protected] | |
|
||
#include <list> | ||
|
||
int yyassemblerlex(); | ||
int yyassemblererror(const std::string &error); | ||
void assembler_scanner_init(); | ||
class assembler_parsert; | ||
int yyassemblererror(assembler_parsert &, void *, const std::string &error); | ||
|
||
class assembler_parsert:public parsert | ||
{ | ||
|
@@ -37,24 +36,18 @@ class assembler_parsert:public parsert | |
instructions.push_back(instructiont()); | ||
} | ||
|
||
assembler_parsert() | ||
explicit assembler_parsert(message_handlert &message_handler) | ||
: parsert(message_handler) | ||
{ | ||
} | ||
|
||
virtual bool parse() | ||
{ | ||
yyassemblerlex(); | ||
return false; | ||
} | ||
bool parse() override; | ||
|
||
virtual void clear() | ||
{ | ||
parsert::clear(); | ||
instructions.clear(); | ||
// assembler_scanner_init(); | ||
} | ||
}; | ||
|
||
extern assembler_parsert assembler_parser; | ||
|
||
#endif // CPROVER_ASSEMBLER_ASSEMBLER_PARSER_H |
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
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
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