DynGenPar
Dynamic Generalized Parser
flexlexertokensource.h
Go to the documentation of this file.
1 /* DynGenPar: Dynamic Generalized Parser - Flex lexer token source
2  Copyright (C) 2010 Kevin Kofler <kevin.kofler@chello.at>
3  Copyright (C) 2015 DAGOPT Optimization Technologies GmbH
4  written by Kevin Kofler <kofler@dagopt.com>
5 
6  Support by the Austrian Science Fund FWF under contract number P20631
7  is gratefully acknowledged.
8 
9  This program is free software: you can redistribute it and/or modify
10  it under the terms of the GNU General Public License as published by
11  the Free Software Foundation, either version 2 of the License, or
12  (at your option) any later version.
13 
14  This program is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU General Public License for more details.
18 
19  You should have received a copy of the GNU General Public License
20  along with this program. If not, see <http://www.gnu.org/licenses/>. */
21 
22 #ifndef DYNGENPAR_INTEGER_CATEGORIES
23 #define DYNGENPAR_INTEGER_CATEGORIES
24 #endif
25 
26 #include <FlexLexer.h>
27 #include "dyngenpar.h"
28 
29 namespace DynGenPar {
30 
32  public:
33  FlexLexerTokenSource(FlexLexer *lexer) : TokenSource(), flexLexer(lexer) {}
34  virtual ~FlexLexerTokenSource() {}
35  protected:
36  virtual Cat readToken() {
37  return flexLexer->yylex();
38  }
39  FlexLexer *flexLexer;
40 };
41 DYNGENPAR_DECLARE_TYPEINFO(FlexLexerTokenSource, Q_MOVABLE_TYPE);
42 
43 } // end namespace
QString Cat
Category type: string or integer depending on DYNGENPAR_INTEGER_CATEGORIES.
Definition: dyngenpar.h:71
virtual Cat readToken()
get the next token from the input, to be implemented by subclasses