-
Notifications
You must be signed in to change notification settings - Fork 0
/
lex.yy.hh
48 lines (40 loc) · 1.17 KB
/
lex.yy.hh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/*
* Project 3
* Author: B10630221 Chang-Ting Kao
* Date: 2019/06/05
*/
#ifndef LEX_YY_H
#define LEX_YY_H
#ifndef __FLEX_LEXER_H
#include <FlexLexer.h>
#endif
#include "y.tab.hh"
namespace yy {
class FlexScanner : public yyFlexLexer
{
public:
/** Create a new scanner object. The streams arg_yyin and arg_yyout default
* to cin and cout, but that assignment is only made when initializing in
* yylex(). */
FlexScanner(std::istream* arg_yyin = 0, std::ostream* arg_yyout = 0,
bool arg_verbose = true, bool arg_line = true)
: yyFlexLexer(arg_yyin, arg_yyout)
{
isVerbose = arg_verbose;
showLine = arg_line;
}
/** This is the main lexing function. It is generated by flex according to
* the macro declaration YY_DECL above. The generated bison parser then
* calls this virtual function to fetch new tokens. */
virtual int yylex(
yy::BisonParser::semantic_type* yylval,
yy::BisonParser::location_type* yylloc
);
private:
// Is using verbose output or not
bool isVerbose;
// Is printing lines or not
bool showLine;
};
} // namespace yy
#endif // LEX_YY_H