identifier: New function token_type_to_string().
[pspp-builds.git] / src / data / identifier.c
index 1e149b8dc3ea9673c801be8ed7cb0010dbb546b5..498f5ea966987e38f75eba3dd105f6e112ed69f5 100644 (file)
 
 #include "gl/c-ctype.h"
 
+/* Tokens. */
+
+const char *
+token_type_to_string (enum token_type type)
+{
+  switch (type)
+    {
+#define TOKEN_TYPE(TYPE) case T_##TYPE: return #TYPE;
+      TOKEN_TYPES
+#undef TOKEN_TYPE
+    case TOKEN_N_TYPES:
+    default:
+      return "unknown token type";
+    }
+}
+
 /* Recognizing identifiers. */
 
 static bool