summaryrefslogtreecommitdiff
path: root/trunk/CIAO/CCF/CCF/CompilerElements/PreprocessorToken.hpp
blob: 5c82076a01c55dbf0279f188e09aebd02671cd27 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
// file      : CCF/CompilerElements/PreprocessorToken.hpp
// author    : Boris Kolpackov <boris@dre.vanderbilt.edu>
// cvs-id    : $Id$

#ifndef CCF_COMPILER_ELEMENTS_PREPROCESSOR_TOKEN_HPP
#define CCF_COMPILER_ELEMENTS_PREPROCESSOR_TOKEN_HPP

#include <string>

//@@ It is probably a good idea to move preprocessor into a
//   separate library.
//

namespace CCF
{
  namespace CompilerElements
  {
    namespace CPP
    {
      class Token
      {
      public:
        static Token const eos;

      public:
        Token (char c, unsigned long line);

        class EOS {};

        operator char () const throw (EOS);

        unsigned long
        line () const throw (EOS);

        friend bool
        operator== (Token const& a, Token const& b);

        friend bool
        operator!= (Token const& a, Token const& b);

      private:
        // Constructs eos token.
        //
        Token ();

      private:
        typedef
        std::char_traits<char>
        traits;

        traits::int_type c_;
        unsigned long line_;
      };
    }
  }
}

#endif  // CCF_COMPILER_ELEMENTS_PREPROCESSOR_TOKEN_HPP