alec

Abstraction 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)


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