aboutsummaryrefslogtreecommitdiff
path: root/build/token.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'build/token.cxx')
-rw-r--r--build/token.cxx34
1 files changed, 34 insertions, 0 deletions
diff --git a/build/token.cxx b/build/token.cxx
new file mode 100644
index 0000000..33d30a8
--- /dev/null
+++ b/build/token.cxx
@@ -0,0 +1,34 @@
+// file : build/token.cxx -*- C++ -*-
+// copyright : Copyright (c) 2014-2015 Code Synthesis Tools CC
+// license : MIT; see accompanying LICENSE file
+
+#include <build/token>
+
+#include <ostream>
+
+using namespace std;
+
+namespace build
+{
+ 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::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.name (); break;
+ }
+
+ return os;
+ }
+}