Skip to content

Commit 124fb2b

Browse files
committed
Remove the need for a static function to call scanner.yylex
1 parent 146e351 commit 124fb2b

1 file changed

Lines changed: 3 additions & 21 deletions

File tree

mc_parser.yy

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,7 @@
1212
}
1313
}
1414

15-
%lex-param { MC_Scanner &scanner }
1615
%parse-param { MC_Scanner &scanner }
17-
18-
%lex-param { MC_Driver &driver }
1916
%parse-param { MC_Driver &driver }
2017

2118
%code{
@@ -25,12 +22,9 @@
2522

2623
/* include for all driver functions */
2724
#include "mc_driver.hpp"
28-
29-
/* this is silly, but I can't figure out a way around */
30-
static int yylex(MC::MC_Parser::semantic_type *yylval,
31-
MC::MC_Scanner &scanner,
32-
MC::MC_Driver &driver);
33-
25+
26+
#undef yylex
27+
#define yylex scanner.yylex
3428
}
3529

3630
/* token types */
@@ -75,15 +69,3 @@ MC::MC_Parser::error( const std::string &err_message )
7569
{
7670
std::cerr << "Error: " << err_message << "\n";
7771
}
78-
79-
80-
/* include for access to scanner.yylex */
81-
#include "mc_scanner.hpp"
82-
static int
83-
yylex( MC::MC_Parser::semantic_type *yylval,
84-
MC::MC_Scanner &scanner,
85-
MC::MC_Driver &driver )
86-
{
87-
return( scanner.yylex(yylval) );
88-
}
89-

0 commit comments

Comments
 (0)