0001
0002 static struct resword {
0003 const char *name;
0004 int token;
0005 } keywords[] = {
0006 { "__GENKSYMS_EXPORT_SYMBOL", EXPORT_SYMBOL_KEYW },
0007 { "__asm", ASM_KEYW },
0008 { "__asm__", ASM_KEYW },
0009 { "__attribute", ATTRIBUTE_KEYW },
0010 { "__attribute__", ATTRIBUTE_KEYW },
0011 { "__const", CONST_KEYW },
0012 { "__const__", CONST_KEYW },
0013 { "__extension__", EXTENSION_KEYW },
0014 { "__inline", INLINE_KEYW },
0015 { "__inline__", INLINE_KEYW },
0016 { "__signed", SIGNED_KEYW },
0017 { "__signed__", SIGNED_KEYW },
0018 { "__typeof", TYPEOF_KEYW },
0019 { "__typeof__", TYPEOF_KEYW },
0020 { "__volatile", VOLATILE_KEYW },
0021 { "__volatile__", VOLATILE_KEYW },
0022 { "__builtin_va_list", VA_LIST_KEYW },
0023
0024 { "__int128", BUILTIN_INT_KEYW },
0025 { "__int128_t", BUILTIN_INT_KEYW },
0026 { "__uint128_t", BUILTIN_INT_KEYW },
0027
0028
0029 { "_Bool", BOOL_KEYW },
0030 { "__restrict", RESTRICT_KEYW },
0031 { "__restrict__", RESTRICT_KEYW },
0032 { "restrict", RESTRICT_KEYW },
0033 { "asm", ASM_KEYW },
0034
0035
0036 { "_Static_assert", STATIC_ASSERT_KEYW },
0037
0038
0039
0040
0041
0042
0043 { "auto", AUTO_KEYW },
0044 { "char", CHAR_KEYW },
0045 { "const", CONST_KEYW },
0046 { "double", DOUBLE_KEYW },
0047 { "enum", ENUM_KEYW },
0048 { "extern", EXTERN_KEYW },
0049 { "float", FLOAT_KEYW },
0050 { "inline", INLINE_KEYW },
0051 { "int", INT_KEYW },
0052 { "long", LONG_KEYW },
0053 { "register", REGISTER_KEYW },
0054 { "short", SHORT_KEYW },
0055 { "signed", SIGNED_KEYW },
0056 { "static", STATIC_KEYW },
0057 { "struct", STRUCT_KEYW },
0058 { "typedef", TYPEDEF_KEYW },
0059 { "typeof", TYPEOF_KEYW },
0060 { "union", UNION_KEYW },
0061 { "unsigned", UNSIGNED_KEYW },
0062 { "void", VOID_KEYW },
0063 { "volatile", VOLATILE_KEYW },
0064 };
0065
0066 #define NR_KEYWORDS (sizeof(keywords)/sizeof(struct resword))
0067
0068 static int is_reserved_word(register const char *str, register unsigned int len)
0069 {
0070 int i;
0071 for (i = 0; i < NR_KEYWORDS; i++) {
0072 struct resword *r = keywords + i;
0073 int l = strlen(r->name);
0074 if (len == l && !memcmp(str, r->name, len))
0075 return r->token;
0076 }
0077 return -1;
0078 }