torc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
LutScanner.hpp
Go to the documentation of this file.
1 // Torc - Copyright 2011-2013 University of Southern California. All Rights Reserved.
2 // $HeadURL$
3 // $Id$
4 
5 // This program is free software: you can redistribute it and/or modify it under the terms of the
6 // GNU General Public License as published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
10 // without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
11 // the GNU General Public License for more details.
12 //
13 // You should have received a copy of the GNU General Public License along with this program. If
14 // not, see <http://www.gnu.org/licenses/>.
15 
16 /// \file
17 /// \brief Header for the LutScanner class.
18 
19 #ifndef TORC_BITSTREAM_ASSEMBLER_LUT_LUTSCANNER_HPP
20 #define TORC_BITSTREAM_ASSEMBLER_LUT_LUTSCANNER_HPP
21 
22 // Flex expects the signature of yylex to be defined in the macro YY_DECL, and
23 // the C++ parser expects it to be declared. We can factor both as follows.
24 
25 #ifndef YY_DECL
26 
27 #define YY_DECL \
28  torc::LutParser::token_type \
29  torc::LutScanner::lex( \
30  torc::LutParser::semantic_type* yylval, \
31  torc::LutParser::location_type* yylloc \
32  )
33 #endif
34 
35 #ifndef __FLEX_LEXER_H
36 #define yyFlexLexer LutFlexLexer
38 #undef yyFlexLexer
39 #endif
40 
42 
43 namespace torc {
44 
45  class LutScanner : public LutFlexLexer {
46  public:
47  // constructors
48  /// \brief Public constructor.
49  /// \details Scans the input stream for tokens, and sends any output to the output stream.
50  /// \param arg_yyin The input stream.
51  /// \param arg_yyout The output stream.
52  LutScanner(std::istream* arg_yyin = 0, std::ostream* arg_yyout = 0);
53  /// \brief Virtual destructor.
54  virtual ~LutScanner();
55  // functions
56  /// \brief Main scanning function.
58  LutParser::location_type* yylloc);
59  /// \brief Enables or disables debugging output.
60  void set_debug(bool b);
61 
62  protected:
63  // friends
64  /// \brief The Lut parser has full access to our internals.
65  friend class LutParser;
66  // members
67  /// \brief Flag to track whether we are inside a double quote.
69  /// \brief Flag to count the number of separator colons seen.
70  int colon;
71  /// \biref Last double-quoted string that we saw.
73  };
74 
75 } // namespace torc
76 
77 #endif // TORC_BITSTREAM_ASSEMBLER_LUT_LUTSCANNER_HPP
std::string last_string
Last double-quoted string that we saw.
Definition: LutScanner.hpp:72
YYSTYPE semantic_type
Symbol semantic values.
Definition: LutParser.hpp:151
A Bison parser.
Definition: LutParser.hpp:144
std::string string
LutScanner(std::istream *arg_yyin=0, std::ostream *arg_yyout=0)
Public constructor.
bool in_double_quote
Flag to track whether we are inside a double quote.
Definition: LutScanner.hpp:68
virtual ~LutScanner()
Virtual destructor.
int colon
Flag to count the number of separator colons seen.
Definition: LutScanner.hpp:70
void set_debug(bool b)
Enables or disables debugging output.
virtual LutParser::token_type lex(LutParser::semantic_type *yylval, LutParser::location_type *yylloc)
Main scanning function.