#include <iostream>
#include "token.hpp" namespace LambdaCalc { const char* const 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 |