moved scanner elsehere

This commit is contained in:
bronku 2025-11-21 08:35:37 +01:00
parent 909a43114b
commit 0018a97b1e
3 changed files with 30 additions and 23 deletions

28
src/scanner.hpp Normal file
View file

@ -0,0 +1,28 @@
#pragma once
#include "../build/parser.hpp"
#include <string>
class yyFlexLexer;
class Scanner : public yyFlexLexer
{
public:
Scanner(std::istream *in) : yyFlexLexer(in) {}
int yylex();
int lex(yy::parser::semantic_type *yylval)
{
this->yylval = yylval;
return yylex();
}
private:
yy::parser::semantic_type *yylval;
};
int scanner_lex(yy::parser::semantic_type *yylval)
{
static Scanner scanner(&std::cin);
return scanner.lex(yylval);
}