in src/parser/token.h [223:344]
std::string Pretty(const TokenType& token_type) {
switch (token_type) {
case TokenType::kCommentStart:
return "`/*`";
case TokenType::kCommentEnd:
return "`*/`";
case TokenType::kLineComment:
return "`//`";
case TokenType::kComment:
return "comment";
case TokenType::kWhitespace:
return "whitespace";
case TokenType::kNewline:
return "newline";
case TokenType::kStringLiteral:
return "string literal";
case TokenType::kIdentifier:
return "identifier";
case TokenType::kLocal:
return "local variable";
case TokenType::kGlobal:
return "global variable";
case TokenType::kGraph:
return "graph variable";
case TokenType::kOp:
return "operator";
case TokenType::kOpenParen:
return "`(`";
case TokenType::kCloseParen:
return "`)`";
case TokenType::kAtSymbol:
return "`@`";
case TokenType::kPercent:
return "`%`";
case TokenType::kComma:
return "`,`";
case TokenType::kColon:
return "`:`";
case TokenType::kSemicolon:
return "`;`";
case TokenType::kPeriod:
return "`.`";
case TokenType::kEqual:
return "`=`";
case TokenType::kInteger:
return "integer";
case TokenType::kFloat:
return "float";
case TokenType::kPlus:
return "`+`";
case TokenType::kStar:
return "`*`";
case TokenType::kMinus:
return "`-`";
case TokenType::kDivision:
return "`/`";
case TokenType::kRAngle:
return "`<`";
case TokenType::kLAngle:
return "`>`";
case TokenType::kRCurly:
return "`}`";
case TokenType::kLCurly:
return "`{`";
case TokenType::kRSquare:
return "`]`";
case TokenType::kLSquare:
return "`[`";
case TokenType::kBang:
return "`!`";
case TokenType::kUnderscore:
return "`_`";
case TokenType::kAt:
return "`@`";
case TokenType::kLet:
return "`let`";
case TokenType::kIf:
return "`if`";
case TokenType::kElse:
return "`else`";
case TokenType::kFn:
return "`fn`";
case TokenType::kDefn:
return "`def`";
case TokenType::kTypeDef:
return "`type`";
case TokenType::kExtern:
return "`extern`";
case TokenType::kBoolean:
return "boolean";
case TokenType::kMetadata:
return "metadata section";
case TokenType::kMetaReference:
return "`meta`";
case TokenType::kFreeVar:
return "`free_var`";
case TokenType::kMatch:
return "`match`";
case TokenType::kPartialMatch:
return "`match?`";
case TokenType::kQuestion:
return "`?`";
case TokenType::kRef:
return "`ref`";
case TokenType::kRefRead:
return "`ref_read`";
case TokenType::kRefWrite:
return "`ref_write`";
case TokenType::kUnknown:
return "unknown";
case TokenType::kEndOfFile:
return "end of file";
case TokenType::kNull:
return "null";
case TokenType::kVersion:
return "version attribute";
// Older compilers warn even though the above code is exhaustive.
default:
LOG(FATAL) << "unreachable code";
return "";
}
}