aboutsummaryrefslogtreecommitdiff
path: root/build2/token.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'build2/token.cxx')
-rw-r--r--build2/token.cxx35
1 files changed, 35 insertions, 0 deletions
diff --git a/build2/token.cxx b/build2/token.cxx
new file mode 100644
index 0000000..b14fc00
--- /dev/null
+++ b/build2/token.cxx
@@ -0,0 +1,35 @@
+// file : build2/token.cxx -*- C++ -*-
+// copyright : Copyright (c) 2014-2015 Code Synthesis Ltd
+// license : MIT; see accompanying LICENSE file
+
+#include <build2/token>
+
+#include <ostream>
+
+using namespace std;
+
+namespace build2
+{
+ ostream&
+ operator<< (ostream& os, const token& t)
+ {
+ switch (t.type)
+ {
+ case token_type::eos: os << "<end-of-file>"; break;
+ case token_type::newline: os << "<newline>"; break;
+ case token_type::pair_separator: os << "<pair separator>"; break;
+ case token_type::colon: os << ":"; break;
+ case token_type::lcbrace: os << "{"; break;
+ case token_type::rcbrace: os << "}"; break;
+ case token_type::equal: os << "="; break;
+ case token_type::equal_plus: os << "=+"; break;
+ case token_type::plus_equal: os << "+="; break;
+ case token_type::dollar: os << "$"; break;
+ case token_type::lparen: os << "("; break;
+ case token_type::rparen: os << ")"; break;
+ case token_type::name: os << t.value; break;
+ }
+
+ return os;
+ }
+}