identifier: Remove TOKEN_N_TYPES from enum token_type.
authorBen Pfaff <blp@cs.stanford.edu>
Sun, 30 May 2021 22:49:42 +0000 (15:49 -0700)
committerBen Pfaff <blp@cs.stanford.edu>
Sun, 30 May 2021 22:50:57 +0000 (15:50 -0700)
src/data/identifier.c
src/data/identifier.h

index e3b33a3382a75953b82d4a28be7793c0fa36fc9e..07c7675bd5a3000cf3742c85505bf68b2174ebd3 100644 (file)
@@ -46,7 +46,6 @@ token_type_to_name (enum token_type type)
 #define TOKEN_TYPE(TYPE) case T_##TYPE: return #TYPE;
       TOKEN_TYPES
 #undef TOKEN_TYPE
-    case TOKEN_N_TYPES:
     default:
       return "unknown token type";
     }
@@ -144,9 +143,6 @@ token_type_to_string (enum token_type token)
 
     case T_EXP:
       return "**";
-
-    case TOKEN_N_TYPES:
-      NOT_REACHED ();
     }
 
   NOT_REACHED ();
index 1fc63b4808f44e7e07ba3a92696f340f338d6922..abb16d5645904b5b93e72097f05839dd9b00f09c 100644 (file)
@@ -66,10 +66,13 @@ enum token_type
   {
 #define TOKEN_TYPE(TYPE) T_##TYPE,
     TOKEN_TYPES
-    TOKEN_N_TYPES
 #undef TOKEN_TYPE
   };
 
+#define TOKEN_TYPE(TYPE) + 1
+enum { TOKEN_N_TYPES = TOKEN_TYPES };
+#undef TOKEN_TYPE
+
 const char *token_type_to_name (enum token_type);
 const char *token_type_to_string (enum token_type);