1
1
%{
2
2
3
3
// #define YYDEBUG 1
4
- #define PARSER (* jsil_parser)
4
+ #define PARSER jsil_parser
5
5
6
6
#include " jsil_parser.h"
7
7
8
- int yyjsillex ();
9
- extern char *yyjsiltext ;
8
+ int yyjsillex (unsigned *, void * );
9
+ char *yyjsilget_text ( void *) ;
10
10
11
- static jsil_parsert *jsil_parser;
12
- int yyjsilparse (void );
13
- int yyjsilparse (jsil_parsert &_jsil_parser)
11
+ int yyjsilerror (
12
+ jsil_parsert &jsil_parser,
13
+ void *scanner,
14
+ const std::string &error)
14
15
{
15
- jsil_parser = &_jsil_parser;
16
- return yyjsilparse ();
17
- }
18
-
19
- int yyjsilerror (const std::string &error)
20
- {
21
- jsil_parser->parse_error (error, yyjsiltext);
16
+ jsil_parser.parse_error (error, yyjsilget_text (scanner));
22
17
return 0 ;
23
18
}
24
19
@@ -44,9 +39,23 @@ int yyjsilerror(const std::string &error)
44
39
#pragma warning(disable:4702)
45
40
#endif
46
41
47
- /* ** token declaration **************************************************/
42
+ // yynerrs may never be used. Will be fixed when bison > 3.8.2 is released (see
43
+ // http://git.savannah.gnu.org/cgit/bison.git/commit/?id=a166d5450e3f47587b98f6005f9f5627dbe21a5b)
44
+ #ifdef __clang__
45
+ # pragma clang diagnostic ignored "-Wunused-but-set-variable"
46
+ #endif
48
47
%}
49
48
49
+ // Should be "%define api.pure full" instead of "%pure-parser", but macOS ships
50
+ // bison 2.3, which doesn't yet support this. We have to invoke bison with
51
+ // -Wno-deprecated on all platforms other than macOS.
52
+ %pure-parser
53
+ %parse-param {jsil_parsert &jsil_parser}
54
+ %parse-param {void *scanner}
55
+ %lex-param {void *scanner}
56
+
57
+ /* ** token declaration **************************************************/
58
+
50
59
/* ** special scanner reports ***/
51
60
52
61
%token TOK_SCANNER_ERROR /* used by scanner to report errors */
0 commit comments