alecAbstraction Layer for Escape Codes |
git clone git://git.dimitrijedobrota.com/alec.git |
Log | Files | Refs | README | LICENSE | HACKING | CONTRIBUTING | CODE_OF_CONDUCT | BUILDING | |
driver.hpp (681B)
1 #pragma once 2 3 #include <string> 4 5 #define yyFlexLexer yy_alec_FlexLexer 6 #if !defined(yyFlexLexerOnce) 7 # include <FlexLexer.h> 8 #endif 9 10 #include "location.hpp" 11 #include "parser.hpp" 12 13 namespace alec 14 { 15 16 class driver : public yy_alec_FlexLexer 17 { 18 int m_current_line = 0; 19 20 parser::semantic_type* m_yylval = nullptr; 21 location_t* m_yylloc = nullptr; 22 23 void copy_location() 24 { 25 *m_yylloc = location_t(m_current_line, m_current_line); 26 } 27 28 public: 29 driver(std::istream& ins, const bool debug) 30 : yy_alec_FlexLexer(&ins) 31 { 32 yy_alec_FlexLexer::set_debug(static_cast<int>(debug)); 33 } 34 35 int yylex(parser::semantic_type* yylval, location_t* lloc); 36 }; 37 38 } // namespace alec