mirror of https://git.wuffs.org/MWCC
194 lines
3.2 KiB
C
194 lines
3.2 KiB
C
#ifndef COMPILER_TOKENS_H
|
|
#define COMPILER_TOKENS_H
|
|
|
|
#include "compiler/common.h"
|
|
|
|
#ifdef __MWERKS__
|
|
#pragma options align=mac68k
|
|
#endif
|
|
|
|
#define TKD_OPERATOR 328
|
|
#define TKD_TEMPLATE 332
|
|
#define TKD_IDENTIFIER -3
|
|
#define TKD_COLON_COLON 372
|
|
|
|
typedef enum EToken {
|
|
TK_INTCONST = -1,
|
|
TK_FLOATCONST = -2,
|
|
TK_IDENTIFIER = -3,
|
|
TK_STRING = -4,
|
|
TK_STRING_WIDE = -5,
|
|
TK_NEG6 = -6,
|
|
TK_NEG7 = -7,
|
|
TK_AUTO = 256,
|
|
TK_REGISTER,
|
|
TK_STATIC,
|
|
TK_EXTERN,
|
|
TK_TYPEDEF,
|
|
TK_INLINE,
|
|
TK_VOID,
|
|
TK_CHAR,
|
|
TK_SHORT,
|
|
TK_INT,
|
|
TK_LONG,
|
|
TK_FLOAT,
|
|
TK_DOUBLE,
|
|
TK_SIGNED,
|
|
TK_UNSIGNED,
|
|
TK_STRUCT,
|
|
TK_UNION,
|
|
TK_ENUM,
|
|
TK_CLASS,
|
|
TK_UNK_113,
|
|
TK_UNK_114,
|
|
TK_UNK_115,
|
|
TK_UNK_116,
|
|
TK_UNK_117,
|
|
TK_UNK_118,
|
|
TK_UNK_119,
|
|
TK_UNK_11A,
|
|
TK_UU_VECTOR,
|
|
TK_UU_TYPEOF_UU,
|
|
TK_BOOL,
|
|
TK_WCHAR_T,
|
|
TK_U_COMPLEX,
|
|
TK_U_IMAGINARY,
|
|
TK_TYPENAME,
|
|
TK_CONST,
|
|
TK_VOLATILE,
|
|
TK_PASCAL,
|
|
TK_UU_DECLSPEC,
|
|
TK_UU_STDCALL,
|
|
TK_UU_CDECL,
|
|
TK_UU_FASTCALL,
|
|
TK_UU_FAR,
|
|
TK_EXPLICIT,
|
|
TK_MUTABLE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STAR,
|
|
TK_COLON_COLON,
|
|
TK_AT_INTERFACE,
|
|
TK_AT_IMPLEMENTATION,
|
|
TK_AT_PROTOCOL,
|
|
TK_AT_END,
|
|
TK_AT_PRIVATE,
|
|
TK_AT_PROTECTED,
|
|
TK_AT_PUBLIC,
|
|
TK_AT_CLASS,
|
|
TK_AT_SELECTOR,
|
|
TK_AT_ENCODE,
|
|
TK_AT_DEFS,
|
|
TK_SELF,
|
|
TK_SUPER,
|
|
TK_NEW_ARRAY,
|
|
TK_DELETE_ARRAY,
|
|
TK_UU_ALIGNOF_UU,
|
|
TK_RESTRICT,
|
|
TK_UU_ATTRIBUTE_UU,
|
|
TK_UU_UUIDOF
|
|
} EToken;
|
|
|
|
typedef struct FileOffsetInfo {
|
|
CPrepFileInfo *file;
|
|
SInt32 tokenline;
|
|
SInt32 tokenoffset;
|
|
Boolean is_inline;
|
|
} FileOffsetInfo;
|
|
|
|
typedef union TData {
|
|
HashNameNode *tkidentifier;
|
|
CInt64 tkintconst;
|
|
Float tkfloatconst;
|
|
struct {
|
|
char *data;
|
|
SInt32 size;
|
|
} tkstring;
|
|
} TData;
|
|
|
|
struct TStreamElement {
|
|
SInt16 tokentype;
|
|
SInt16 subtype;
|
|
CPrepFileInfo *tokenfile;
|
|
SInt32 tokenoffset;
|
|
SInt32 tokenline;
|
|
TData data;
|
|
};
|
|
|
|
// this is actually called TokenStream
|
|
struct TStream {
|
|
SInt32 tokens;
|
|
TStreamElement *firsttoken;
|
|
};
|
|
|
|
#endif
|
|
|
|
#ifdef __MWERKS__
|
|
#pragma options align=reset
|
|
#endif
|