X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fdata%2Fidentifier.h;h=dcbce970cda97168ab96a22c3e51660d33efc763;hb=3d188ce69f19490938b8e961f289a050f648f39d;hp=7f2f904239167f1c5c4200a570621dd7d83cf66a;hpb=fe8dc2171009e90d2335f159d05f7e6660e24780;p=pspp diff --git a/src/data/identifier.h b/src/data/identifier.h index 7f2f904239..dcbce970cd 100644 --- a/src/data/identifier.h +++ b/src/data/identifier.h @@ -21,52 +21,64 @@ #include #include #include "libpspp/str.h" +#include "gl/verify.h" #define TOKEN_TYPES \ - TOKEN_TYPE(ID) /* Identifier. */ \ - TOKEN_TYPE(POS_NUM) /* Positive number. */ \ - TOKEN_TYPE(NEG_NUM) /* Negative number. */ \ - TOKEN_TYPE(STRING) /* Quoted string. */ \ - TOKEN_TYPE(STOP) /* End of input. */ \ + TOKEN_TYPE(STOP) /* End of input. */ \ \ - TOKEN_TYPE(ENDCMD) /* . */ \ - TOKEN_TYPE(PLUS) /* + */ \ - TOKEN_TYPE(DASH) /* - */ \ - TOKEN_TYPE(ASTERISK) /* * */ \ - TOKEN_TYPE(SLASH) /* / */ \ - TOKEN_TYPE(EQUALS) /* = */ \ - TOKEN_TYPE(LPAREN) /* ( */ \ - TOKEN_TYPE(RPAREN) /* ) */ \ - TOKEN_TYPE(LBRACK) /* [ */ \ - TOKEN_TYPE(RBRACK) /* ] */ \ - TOKEN_TYPE(COMMA) /* , */ \ + TOKEN_TYPE(ID) /* Identifier. */ \ + TOKEN_TYPE(POS_NUM) /* Positive number. */ \ + TOKEN_TYPE(NEG_NUM) /* Negative number. */ \ + TOKEN_TYPE(STRING) /* Quoted string. */ \ \ - TOKEN_TYPE(AND) /* AND */ \ - TOKEN_TYPE(OR) /* OR */ \ - TOKEN_TYPE(NOT) /* NOT */ \ + TOKEN_TYPE(ENDCMD) /* . */ \ + TOKEN_TYPE(PLUS) /* + */ \ + TOKEN_TYPE(DASH) /* - */ \ + TOKEN_TYPE(ASTERISK) /* * */ \ + TOKEN_TYPE(SLASH) /* / */ \ + TOKEN_TYPE(EQUALS) /* = */ \ + TOKEN_TYPE(LPAREN) /* (*/ \ + TOKEN_TYPE(RPAREN) /* ) */ \ + TOKEN_TYPE(LBRACK) /* [ */ \ + TOKEN_TYPE(RBRACK) /* ] */ \ + TOKEN_TYPE(LCURLY) /* { */ \ + TOKEN_TYPE(RCURLY) /* } */ \ + TOKEN_TYPE(COMMA) /* , */ \ + TOKEN_TYPE(SEMICOLON) /* ; */ \ + TOKEN_TYPE(COLON) /* : */ \ \ - TOKEN_TYPE(EQ) /* EQ */ \ - TOKEN_TYPE(GE) /* GE or >= */ \ - TOKEN_TYPE(GT) /* GT or > */ \ - TOKEN_TYPE(LE) /* LE or <= */ \ - TOKEN_TYPE(LT) /* LT or < */ \ - TOKEN_TYPE(NE) /* NE or ~= */ \ + TOKEN_TYPE(AND) /* AND */ \ + TOKEN_TYPE(OR) /* OR */ \ + TOKEN_TYPE(NOT) /* NOT */ \ \ - TOKEN_TYPE(ALL) /* ALL */ \ - TOKEN_TYPE(BY) /* BY */ \ - TOKEN_TYPE(TO) /* TO */ \ - TOKEN_TYPE(WITH) /* WITH */ \ + TOKEN_TYPE(EQ) /* EQ */ \ + TOKEN_TYPE(GE) /* GE or >= */ \ + TOKEN_TYPE(GT) /* GT or > */ \ + TOKEN_TYPE(LE) /* LE or <= */ \ + TOKEN_TYPE(LT) /* LT or < */ \ + TOKEN_TYPE(NE) /* NE or ~= */ \ \ - TOKEN_TYPE(EXP) /* ** */ - + TOKEN_TYPE(ALL) /* ALL */ \ + TOKEN_TYPE(BY) /* BY */ \ + TOKEN_TYPE(TO) /* TO */ \ + TOKEN_TYPE(WITH) /* WITH */ \ + \ + TOKEN_TYPE(EXP) /* ** */ \ + \ + TOKEN_TYPE(MACRO_ID) /* Identifier starting with '!'. */ \ + TOKEN_TYPE(MACRO_PUNCT) /* Miscellaneous punctuator. */ /* Token types. */ enum token_type { #define TOKEN_TYPE(TYPE) T_##TYPE, TOKEN_TYPES - TOKEN_N_TYPES #undef TOKEN_TYPE }; +verify(T_STOP == 0); + +#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);