in src/parser/token.h [100:221]
std::string ToString(const TokenType& token_type) {
switch (token_type) {
case TokenType::kCommentStart:
return "CommentStart";
case TokenType::kCommentEnd:
return "CommentEnd";
case TokenType::kLineComment:
return "LineComment";
case TokenType::kComment:
return "Comment";
case TokenType::kWhitespace:
return "WhiteSpace";
case TokenType::kNewline:
return "Newline";
case TokenType::kStringLiteral:
return "StringLiteral";
case TokenType::kIdentifier:
return "Identifier";
case TokenType::kLocal:
return "Local";
case TokenType::kGlobal:
return "Global";
case TokenType::kGraph:
return "Graph";
case TokenType::kOp:
return "Op";
case TokenType::kOpenParen:
return "OpenParen";
case TokenType::kCloseParen:
return "CloseParen";
case TokenType::kAtSymbol:
return "AtSymbol";
case TokenType::kPercent:
return "Percent";
case TokenType::kComma:
return "Comma";
case TokenType::kColon:
return "Colon";
case TokenType::kSemicolon:
return "Semicolon";
case TokenType::kPeriod:
return "Period";
case TokenType::kEqual:
return "Equal";
case TokenType::kInteger:
return "Integer";
case TokenType::kFloat:
return "Float";
case TokenType::kPlus:
return "Plus";
case TokenType::kStar:
return "Star";
case TokenType::kMinus:
return "Minus";
case TokenType::kDivision:
return "Division";
case TokenType::kRAngle:
return "RAngle";
case TokenType::kLAngle:
return "LAngle";
case TokenType::kRCurly:
return "RCurly";
case TokenType::kLCurly:
return "LCurly";
case TokenType::kRSquare:
return "RSquare";
case TokenType::kLSquare:
return "LSquare";
case TokenType::kBang:
return "Bang";
case TokenType::kUnderscore:
return "Underscore";
case TokenType::kAt:
return "At";
case TokenType::kLet:
return "Let";
case TokenType::kIf:
return "If";
case TokenType::kElse:
return "Else";
case TokenType::kFn:
return "Fn";
case TokenType::kDefn:
return "Defn";
case TokenType::kTypeDef:
return "TypeDef";
case TokenType::kExtern:
return "Extern";
case TokenType::kMatch:
return "Match";
case TokenType::kPartialMatch:
return "PartialMatch";
case TokenType::kQuestion:
return "Question";
case TokenType::kBoolean:
return "Boolean";
case TokenType::kMetadata:
return "Metadata";
case TokenType::kMetaReference:
return "MetaReference";
case TokenType::kFreeVar:
return "FreeVar";
case TokenType::kVersion:
return "Version";
case TokenType::kRef:
return "Ref";
case TokenType::kRefRead:
return "RefRead";
case TokenType::kRefWrite:
return "RefWrite";
case TokenType::kUnknown:
return "Unknown";
case TokenType::kEndOfFile:
return "EndOfFile";
case TokenType::kNull:
return "Null";
// Older compilers warn even though the above code is exhaustive.
default:
LOG(FATAL) << "unreachable code";
return "";
}
}