diff options
Diffstat (limited to 'modules/CIAO/CCF/CCF/CompilerElements/PreprocessorToken.cpp')
-rw-r--r-- | modules/CIAO/CCF/CCF/CompilerElements/PreprocessorToken.cpp | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/modules/CIAO/CCF/CCF/CompilerElements/PreprocessorToken.cpp b/modules/CIAO/CCF/CCF/CompilerElements/PreprocessorToken.cpp new file mode 100644 index 00000000000..5f3e629243e --- /dev/null +++ b/modules/CIAO/CCF/CCF/CompilerElements/PreprocessorToken.cpp @@ -0,0 +1,57 @@ +// file : CCF/CompilerElements/PreprocessorToken.cpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#include "CCF/CompilerElements/PreprocessorToken.hpp" + +namespace CCF +{ + namespace CompilerElements + { + namespace CPP + { + Token const Token::eos; + + Token:: + Token (char c, unsigned long line) + : c_ (traits::to_int_type (c)), line_ (line) + { + } + + Token:: + Token () + : c_ (traits::eof ()), line_ (0) + { + } + + Token:: + operator char () const throw (EOS) + { + if (*this == eos) throw EOS (); + + return traits::to_char_type (c_); + } + + + unsigned long Token:: + line () const throw (EOS) + { + if (*this == eos) throw EOS (); + + return line_; + } + + bool + operator== (Token const& a, Token const& b) + { + return a.c_ == b.c_; + } + + bool + operator!= (Token const& a, Token const& b) + { + return a.c_ != b.c_; + } + } + } +} |