-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjitlexer.h
More file actions
35 lines (28 loc) · 785 Bytes
/
jitlexer.h
File metadata and controls
35 lines (28 loc) · 785 Bytes
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
#ifndef __JITSCANNER_HPP__
#define __JITSCANNER_HPP__
/* FlexLexer.h doesn't use a normal header guard */
#ifndef yyFlexLexerOnce
#include <FlexLexer.h>
#endif
#include "parser.tab.hpp"
namespace nanjit {
class Scanner : public yyFlexLexer {
nanjit::BisonParser::semantic_type *yylval;
nanjit::BisonParser::location_type *yylloc;
public:
Scanner(std::istream *in) : yyFlexLexer(in), yylval(NULL), yylloc(NULL) {};
/* Replace yylex with a version bison can use */
int yylex(nanjit::BisonParser::semantic_type *lval,
nanjit::BisonParser::location_type *loc)
{
yylval = lval;
yylloc = loc;
return yylex();
yylval = NULL;
yylloc = NULL;
}
private:
int yylex();
};
}
#endif /* __JITSCANNER_HPP__ */