mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-02-26 15:59:04 +00:00
121 lines
5.2 KiB
Text
121 lines
5.2 KiB
Text
|
%{
|
||
|
#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_atomic_exchange, KW___BUILTIN_ATOMIC_EXCHANGE
|
||
|
__builtin_compare_and_swap, KW___BUILTIN_COMPARE_AND_SWAP
|
||
|
__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
|