1
      2
      3
      4
      5
      6
      7
      8
      9
     10
     11
     12
     13
     14
     15
     16
     17
     18
     19
     20
     21
#include <iostream>
#include "token.hpp"

namespace LambdaCalc {

   const charconst Token::symname[DEFINE+1] = {
      "ERROR""END""IDENT""LAMBDA""LPAREN",
      "RPAREN""INTEGER""IF""DEFINE"
   };

   std::ostream& operator<<(std::ostream& out, const Token& token) {
      out << Token::symname[token.symbol];
      if (token.symbol == Token::IDENT && token.identifier.length() > 0) {
  outsp;  out << " (" tokenlt; tokidentifierier << ")";
      } else if (token.symbol == Token::INTEGER) {
  outsp;  out << " (" tokenlt; tokintegerger << ")";
      }
      return out;
   }

// namespace LambdaCalc