%{ #include "libc/str/str.h" #include "third_party/chibicc/kw.h" %} %compare-strncmp %language=ANSI-C %readonly-tables %struct-type %define lookup-function-name LookupKw struct thatispacked KwSlot { char *name; unsigned char code; }; %% if, KW_IF struct, KW_STRUCT return, KW_RETURN case, KW_CASE static, KW_STATIC void, KW_VOID char, KW_CHAR else, KW_ELSE for, KW_FOR do, KW_DO sizeof, KW_SIZEOF unsigned, KW_UNSIGNED long, KW_LONG while, KW_WHILE union, KW_UNION switch, KW_SWITCH double, KW_DOUBLE const, KW_CONST float, KW_FLOAT short, KW_SHORT signed, KW_SIGNED break, KW_BREAK enum, KW_ENUM continue, KW_CONTINUE include, KW_INCLUDE ifdef, KW_IFDEF ifndef, KW_IFNDEF define, KW_DEFINE defined, KW_DEFINED asm, KW_ASM default, KW_DEFAULT auto, KW_AUTO register, KW_REGISTER __attribute__, KW___ATTRIBUTE__ _Noreturn, KW__NORETURN elif, KW_ELIF endif, KW_ENDIF error, KW_ERROR extern, KW_EXTERN goto, KW_GOTO include_next, KW_INCLUDE_NEXT inline, KW_INLINE int, KW_INT line, KW_LINE pragma, KW_PRAGMA restrict, KW_RESTRICT strchr, KW_STRCHR strlen, KW_STRLEN strpbrk, KW_STRPBRK strstr, KW_STRSTR typedef, KW_TYPEDEF typeof, KW_TYPEOF undef, KW_UNDEF volatile, KW_VOLATILE _Alignas, KW__ALIGNAS _Alignof, KW__ALIGNOF _Atomic, KW__ATOMIC _Bool, KW__BOOL _Generic, KW__GENERIC _Static_assert, KW__STATIC_ASSERT _Thread_local, KW__THREAD_LOCAL __VA_OPT__, KW___VA_OPT__ __alignof__, KW___ALIGNOF__ __asm__, KW___ASM__ __inline, KW_INLINE __int128, KW___INT128 __restrict, KW_RESTRICT __restrict__, KW_RESTRICT __thread, KW__THREAD_LOCAL __typeof, KW_TYPEOF __builtin_add_overflow, KW___BUILTIN_ADD_OVERFLOW __builtin_assume_aligned, KW___BUILTIN_ASSUME_ALIGNED __builtin_constant_p, KW___BUILTIN_CONSTANT_P __builtin_expect, KW___BUILTIN_EXPECT __builtin_ffs, KW___BUILTIN_FFS __builtin_ffsl, KW___BUILTIN_FFSL __builtin_ffsll, KW___BUILTIN_FFSLL __builtin_fpclassify, KW___BUILTIN_FPCLASSIFY __builtin_mul_overflow, KW___BUILTIN_MUL_OVERFLOW __builtin_neg_overflow, KW___BUILTIN_NEG_OVERFLOW __builtin_offsetof, KW___BUILTIN_OFFSETOF __builtin_popcount, KW___BUILTIN_POPCOUNT __builtin_popcountl, KW___BUILTIN_POPCOUNTL __builtin_popcountll, KW___BUILTIN_POPCOUNTLL __builtin_reg_class, KW___BUILTIN_REG_CLASS __builtin_strchr, KW___BUILTIN_STRCHR __builtin_strlen, KW___BUILTIN_STRLEN __builtin_strpbrk, KW___BUILTIN_STRPBRK __builtin_strstr, KW___BUILTIN_STRSTR __builtin_sub_overflow, KW___BUILTIN_SUB_OVERFLOW __builtin_types_compatible_p, KW___BUILTIN_TYPES_COMPATIBLE_P "(", KW_LP ")", KW_RP "{", KW_LB "}", KW_RB "+", KW_PLUS "-", KW_MINUS "&", KW_AMP "*", KW_STAR "!", KW_EXCLAIM "~", KW_TILDE "++", KW_INCREMENT "--", KW_DECREMENT "&&", KW_LOGAND "||", KW_LOGOR "->", KW_ARROW ".", KW_DOT __atomic_load, KW___ATOMIC_LOAD __atomic_load_n, KW___ATOMIC_LOAD_N __atomic_store, KW___ATOMIC_STORE __atomic_store_n, KW___ATOMIC_STORE_N __atomic_clear, KW___ATOMIC_CLEAR __atomic_fetch_add, KW___ATOMIC_FETCH_ADD __atomic_fetch_sub, KW___ATOMIC_FETCH_SUB __atomic_fetch_and, KW___ATOMIC_FETCH_AND __atomic_fetch_xor, KW___ATOMIC_FETCH_XOR __atomic_fetch_or, KW___ATOMIC_FETCH_OR __atomic_test_and_set, KW___ATOMIC_TEST_AND_SET __sync_lock_test_and_set, KW___SYNC_LOCK_TEST_AND_SET __sync_lock_release, KW___SYNC_LOCK_RELEASE __builtin_ia32_movntdq, KW___BUILTIN_IA32_MOVNTDQ __builtin_ia32_pmovmskb128, KW___BUILTIN_IA32_PMOVMSKB128 __atomic_compare_exchange_n, KW___ATOMIC_COMPARE_EXCHANGE_N __atomic_exchange_n, KW___ATOMIC_EXCHANGE_N