#ifndef TDL_LEXER_H #define TDL_LEXER_H #ifndef YY_DECL #define YY_DECL \ delphin::TdlParser::token_type \ delphin::TdlLexer::lex( \ delphin::TdlParser::semantic_type *yylval, \ delphin::TdlParser::location_type *yylloc) #endif #ifndef __FLEX_LEXER_H #define yyFlexLexer TdlFlexLexer #include #undef yyFlexLexer #endif #include #include #include "tdl-parser.hpp" #define MAX_INCLUDE_DEPTH 10 namespace delphin { class TdlLexer : public TdlFlexLexer { public: TdlLexer(std::istream *arg_yyin = 0, std::ostream *arg_yyout = 0); virtual ~TdlLexer(); virtual TdlParser::token_type lex(TdlParser::semantic_type *yylval, TdlParser::location_type *yylloc); void set_debug(bool b); bool push_includefile(std::string &fname, TdlParser::location_type *loc); private: struct yy_buffer_state *include_stack[MAX_INCLUDE_DEPTH]; TdlParser::location_type *location_stack[MAX_INCLUDE_DEPTH]; std::vector includefnames; int include_stack_ptr; // std::ifstream currentstream; std::ifstream *currentstream; TdlParser::token_type check_keywords(const char *val); }; } #endif