aboutsummaryrefslogtreecommitdiff
path: root/odb/cxx-lexer.hxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2010-11-28 13:56:07 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2010-11-28 13:56:07 +0200
commit6c876cf3280ba63d6077656476c2fc692e4bb1ff (patch)
tree446394e681571e5bd59310a5cfc43ea3f69f364e /odb/cxx-lexer.hxx
parent886f5c5511a3b8291fafd7fe1435916a7c993cf0 (diff)
Qualify all unqualified name components in pointer types
This this necessary since they may not resolve in the typedef that we generate in namespace odb.
Diffstat (limited to 'odb/cxx-lexer.hxx')
-rw-r--r--odb/cxx-lexer.hxx45
1 files changed, 45 insertions, 0 deletions
diff --git a/odb/cxx-lexer.hxx b/odb/cxx-lexer.hxx
new file mode 100644
index 0000000..107f92b
--- /dev/null
+++ b/odb/cxx-lexer.hxx
@@ -0,0 +1,45 @@
+// file : odb/cxx-lexer.hxx
+// author : Boris Kolpackov <boris@codesynthesis.com>
+// copyright : Copyright (c) 2009-2010 Code Synthesis Tools CC
+// license : GNU GPL v3; see accompanying LICENSE file
+
+#ifndef ODB_CXX_LEXER_HXX
+#define ODB_CXX_LEXER_HXX
+
+#include <odb/gcc.hxx>
+
+#include <string>
+
+// A C++ keyword. This is an extension to libcpp token types.
+//
+#define CPP_KEYWORD ((cpp_ttype) (N_TTYPES + 1))
+
+// A thin wrapper around cpp_reader for lexing C++ code fragments.
+//
+class cxx_lexer
+{
+public:
+ cxx_lexer ();
+ ~cxx_lexer ();
+
+public:
+ struct invalid_input {};
+
+ void
+ start (std::string const&);
+
+ cpp_ttype
+ next (std::string& token);
+
+public:
+ static char const* token_spelling[N_TTYPES + 1];
+
+private:
+ std::string data_;
+ std::string buf_;
+ line_maps line_map_;
+ cpp_reader* reader_;
+ cpp_callbacks* callbacks_;
+};
+
+#endif // ODB_CXX_LEXER_HXX