|
|
d24e34 |
Index: b/tests/test-bison-yylloc/main.c
|
|
|
d24e34 |
===================================================================
|
|
|
d24e34 |
--- a/tests/test-bison-yylloc/main.c
|
|
|
d24e34 |
+++ b/tests/test-bison-yylloc/main.c
|
|
|
d24e34 |
@@ -24,8 +24,6 @@
|
|
|
2d5c4a |
#include "parser.h"
|
|
|
2d5c4a |
#include "scanner.h"
|
|
|
2d5c4a |
|
|
|
2d5c4a |
-extern int testparse(yyscan_t);
|
|
|
2d5c4a |
-
|
|
|
2d5c4a |
int main ( int argc, char** argv )
|
|
|
2d5c4a |
{
|
|
|
2d5c4a |
yyscan_t scanner;
|
|
|
d24e34 |
Index: b/tests/test-bison-yylloc/parser.y
|
|
|
d24e34 |
===================================================================
|
|
|
d24e34 |
--- a/tests/test-bison-yylloc/parser.y
|
|
|
d24e34 |
+++ b/tests/test-bison-yylloc/parser.y
|
|
|
2d5c4a |
@@ -21,6 +21,8 @@
|
|
|
2d5c4a |
* PURPOSE.
|
|
|
2d5c4a |
*/
|
|
|
2d5c4a |
|
|
|
2d5c4a |
+%parse-param { void* scanner }
|
|
|
2d5c4a |
+
|
|
|
2d5c4a |
/*
|
|
|
2d5c4a |
How to compile:
|
|
|
2d5c4a |
bison --defines --output-file="parser.c" --name-prefix="test" parser.y
|
|
|
2d5c4a |
@@ -32,10 +34,8 @@
|
|
|
2d5c4a |
#include "config.h"
|
|
|
2d5c4a |
|
|
|
2d5c4a |
#define YYERROR_VERBOSE 1
|
|
|
2d5c4a |
-#define YYPARSE_PARAM scanner
|
|
|
2d5c4a |
#define YYLEX_PARAM scanner
|
|
|
2d5c4a |
|
|
|
2d5c4a |
-int yyerror(char* msg);
|
|
|
2d5c4a |
extern int testget_lineno(void*);
|
|
|
2d5c4a |
|
|
|
2d5c4a |
|
|
|
2d5c4a |
@@ -89,7 +89,7 @@ line:
|
|
|
2d5c4a |
|
|
|
2d5c4a |
%%
|
|
|
2d5c4a |
|
|
|
2d5c4a |
-int yyerror(char* msg) {
|
|
|
2d5c4a |
+int yyerror(void* scanner, char* msg) {
|
|
|
2d5c4a |
fprintf(stderr,"%s\n",msg);
|
|
|
2d5c4a |
return 0;
|
|
|
2d5c4a |
}
|
|
|
d24e34 |
Index: b/tests/test-bison-yylval/main.c
|
|
|
d24e34 |
===================================================================
|
|
|
d24e34 |
--- a/tests/test-bison-yylval/main.c
|
|
|
d24e34 |
+++ b/tests/test-bison-yylval/main.c
|
|
|
2d5c4a |
@@ -24,8 +24,6 @@
|
|
|
2d5c4a |
#include "parser.h"
|
|
|
2d5c4a |
#include "scanner.h"
|
|
|
2d5c4a |
|
|
|
2d5c4a |
-extern int testparse(yyscan_t);
|
|
|
2d5c4a |
-
|
|
|
2d5c4a |
int main ( int argc, char** argv )
|
|
|
2d5c4a |
{
|
|
|
2d5c4a |
yyscan_t scanner;
|
|
|
d24e34 |
Index: b/tests/test-bison-yylval/parser.y
|
|
|
d24e34 |
===================================================================
|
|
|
d24e34 |
--- a/tests/test-bison-yylval/parser.y
|
|
|
d24e34 |
+++ b/tests/test-bison-yylval/parser.y
|
|
|
2d5c4a |
@@ -25,6 +25,7 @@
|
|
|
2d5c4a |
How to compile:
|
|
|
2d5c4a |
bison --defines --output-file="parser.c" --name-prefix="test" parser.y
|
|
|
2d5c4a |
*/
|
|
|
2d5c4a |
+%parse-param { void* scanner }
|
|
|
2d5c4a |
%{
|
|
|
2d5c4a |
#include <stdio.h>
|
|
|
2d5c4a |
#include <stdlib.h>
|
|
|
2d5c4a |
@@ -32,11 +33,8 @@
|
|
|
2d5c4a |
#include "config.h"
|
|
|
2d5c4a |
|
|
|
2d5c4a |
#define YYERROR_VERBOSE 1
|
|
|
2d5c4a |
-#define YYPARSE_PARAM scanner
|
|
|
2d5c4a |
#define YYLEX_PARAM scanner
|
|
|
2d5c4a |
|
|
|
2d5c4a |
-int yyerror(char* msg);
|
|
|
2d5c4a |
-
|
|
|
2d5c4a |
|
|
|
2d5c4a |
/* A dummy function. A check against seg-faults in yylval->str. */
|
|
|
2d5c4a |
int process_text(char* s) {
|
|
|
2d5c4a |
@@ -76,7 +74,7 @@ starttag: LT TAGNAME GT { process_
|
|
|
2d5c4a |
endtag: LTSLASH TAGNAME GT { process_text($2);free($2);} ;
|
|
|
2d5c4a |
%%
|
|
|
2d5c4a |
|
|
|
2d5c4a |
-int yyerror(char* msg) {
|
|
|
2d5c4a |
+int yyerror(void* scanner, char* msg) {
|
|
|
2d5c4a |
fprintf(stderr,"%s\n",msg);
|
|
|
2d5c4a |
return 0;
|
|
|
2d5c4a |
}
|