File tree 2 files changed +17
-2
lines changed
2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change 10
10
// / Jsil Language
11
11
12
12
#include " jsil_parser.h"
13
+
14
+ int jsil_parsert::instance_count = 0 ;
Original file line number Diff line number Diff line change @@ -26,17 +26,27 @@ class jsil_parsert:public parsert
26
26
explicit jsil_parsert (message_handlert &message_handler)
27
27
: parsert(message_handler)
28
28
{
29
+ // Simplistic check that we don't attempt to do reentrant parsing as the
30
+ // Bison-generated parser has global state.
31
+ PRECONDITION (++instance_count == 1 );
32
+ }
33
+
34
+ jsil_parsert (const jsil_parsert &) = delete ;
35
+
36
+ ~jsil_parsert () override
37
+ {
38
+ --instance_count;
29
39
}
30
40
31
41
jsil_parse_treet parse_tree;
32
42
33
- virtual bool parse () override
43
+ bool parse () override
34
44
{
35
45
jsil_scanner_init (*this );
36
46
return yyjsilparse (*this ) != 0 ;
37
47
}
38
48
39
- virtual void clear () override
49
+ void clear () override
40
50
{
41
51
parsert::clear ();
42
52
parse_tree.clear ();
@@ -47,6 +57,9 @@ class jsil_parsert:public parsert
47
57
48
58
// internal state of the scanner
49
59
std::string string_literal;
60
+
61
+ protected:
62
+ static int instance_count;
50
63
};
51
64
52
65
#endif // CPROVER_JSIL_JSIL_PARSER_H
You can’t perform that action at this time.
0 commit comments