fixed scanner.hpp
This commit is contained in:
parent
0018a97b1e
commit
05ba6f6e7f
4 changed files with 18 additions and 9 deletions
|
|
@ -1,4 +1,5 @@
|
|||
#include "../build/parser.hpp"
|
||||
#include "../src/scanner.hpp"
|
||||
|
||||
int main()
|
||||
{
|
||||
|
|
|
|||
7
src/scanner.cpp
Normal file
7
src/scanner.cpp
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
#include "../src/scanner.hpp"
|
||||
|
||||
int scanner_lex(yy::parser::semantic_type *yylval)
|
||||
{
|
||||
static Scanner scanner(&std::cin);
|
||||
return scanner.lex(yylval);
|
||||
}
|
||||
|
|
@ -1,4 +1,10 @@
|
|||
#pragma once
|
||||
|
||||
// fucking piece of shit flex, doesn't even have proper macro directives
|
||||
#ifndef yyFlexLexer
|
||||
#include <FlexLexer.h>
|
||||
#endif
|
||||
|
||||
#include "../build/parser.hpp"
|
||||
#include <string>
|
||||
|
||||
|
|
@ -9,8 +15,6 @@ class Scanner : public yyFlexLexer
|
|||
public:
|
||||
Scanner(std::istream *in) : yyFlexLexer(in) {}
|
||||
|
||||
int yylex();
|
||||
|
||||
int lex(yy::parser::semantic_type *yylval)
|
||||
{
|
||||
this->yylval = yylval;
|
||||
|
|
@ -18,11 +22,8 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
virtual int yylex();
|
||||
yy::parser::semantic_type *yylval;
|
||||
};
|
||||
|
||||
int scanner_lex(yy::parser::semantic_type *yylval)
|
||||
{
|
||||
static Scanner scanner(&std::cin);
|
||||
return scanner.lex(yylval);
|
||||
}
|
||||
int scanner_lex(yy::parser::semantic_type *yylval);
|
||||
Loading…
Add table
Add a link
Reference in a new issue