]> www.ginac.de Git - ginac.git/blob - ginac/parser/lexer.hpp
b53d08f38d4dddf383d7499b769e21a02f58c241
[ginac.git] / ginac / parser / lexer.hpp
1 #ifndef GINAC_LEXER_HPP_
2 #define GINAC_LEXER_HPP_
3 #include <iosfwd>
4 #include <string>
5 #include <cstddef>
6 namespace GiNaC
7 {
8
9 class lexer
10 {
11         std::istream* input;
12         std::ostream* output;
13         std::ostream* error;
14         /// last character read from stream
15         int c;
16         /// identifier and number tokens are stored here
17         std::string str;
18         std::size_t line_num;
19         std::size_t column;
20         friend class parser;
21 public:
22
23         lexer(std::istream* in = 0, std::ostream* out = 0, std::ostream* err = 0);
24         ~lexer();
25
26         int gettok();
27         void switch_input(std::istream* in);
28
29         struct token_type
30         {
31                 enum
32                 {
33                         eof             = -1,
34                         identifier      = -4,
35                         number          = -5,
36                         literal         = -6
37
38                 };
39         };
40 };
41
42 } // namespace GiNaC
43
44 #endif // GINAC_LEXER_HPP_
45