aboutsummaryrefslogtreecommitdiff
path: root/build2/token.cxx
blob: a80ff44be67f01a7383f265086a067b2822470a5 (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
// file      : build2/token.cxx -*- C++ -*-
// copyright : Copyright (c) 2014-2016 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::assign:         os << "="; break;
    case token_type::prepend:        os << "=+"; break;
    case token_type::append:         os << "+="; break;
    case token_type::equal:          os << "=="; break;
    case token_type::not_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;
  }
}