File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11%{
22/* C++ string header, for string ops below */
33#include < string>
4+
45/* Implementation of yyFlexScanner */
56#include " mc_scanner.hpp"
7+ #undef YY_DECL
8+ #define YY_DECL int MC::MC_Scanner::yylex (MC::MC_Parser::semantic_type *lval)
69
710/* typedef to make the returns for the tokens shorter */
811typedef MC::MC_Parser::token token;
@@ -25,6 +28,10 @@ typedef MC::MC_Parser::token token;
2528%option c++
2629
2730%%
31+ %{ // Code executed at the beginning of yylex
32+ yylval = lval;
33+ %}
34+
2835[a -z ] {
2936 return ( token::LOWER );
3037 }
Original file line number Diff line number Diff line change @@ -15,16 +15,11 @@ class MC_Scanner : public yyFlexLexer{
1515 MC_Scanner (std::istream *in) : yyFlexLexer(in),
1616 yylval ( nullptr ){};
1717
18- int yylex (MC::MC_Parser::semantic_type *lval)
19- {
20- yylval = lval;
21- return ( yylex () );
22- }
23-
18+ int yylex (MC::MC_Parser::semantic_type *lval);
19+ // YY_DECL defined in mc_lexer.l
20+ // Method body created by flex in mc_lexer.yy.cc
2421
2522private:
26- /* hide this one from public view */
27- int yylex ();
2823 /* yyval ptr */
2924 MC::MC_Parser::semantic_type *yylval;
3025};
You can’t perform that action at this time.
0 commit comments