summaryrefslogtreecommitdiff
path: root/includes/compiler/tokens.h
diff options
context:
space:
mode:
authorAsh Wolf <ninji@wuffs.org>2022-10-25 20:30:28 +0100
committerAsh Wolf <ninji@wuffs.org>2022-10-25 20:30:28 +0100
commitd0b9848c54e6f85ab713f059dcd1ddef7e57caa6 (patch)
tree5bdb9dbf6c853780bc444dc92bf6f9fa3a95742a /includes/compiler/tokens.h
parent685f22a6a0a5403c76316a2390c021a7b0f7597d (diff)
downloadMWCC-d0b9848c54e6f85ab713f059dcd1ddef7e57caa6.tar.gz
MWCC-d0b9848c54e6f85ab713f059dcd1ddef7e57caa6.zip
a bunch of compiler stuff
Diffstat (limited to 'includes/compiler/tokens.h')
-rw-r--r--includes/compiler/tokens.h182
1 files changed, 182 insertions, 0 deletions
diff --git a/includes/compiler/tokens.h b/includes/compiler/tokens.h
new file mode 100644
index 0000000..b574a81
--- /dev/null
+++ b/includes/compiler/tokens.h
@@ -0,0 +1,182 @@
+#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_UU_VECTOR = 283,
+ TK_UU_TYPE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 TK_INCREMENT,
+ TK_DECREMENT,
+ TK_ARROW,
+ TK_ELLIPSIS,
+ TK_DOT_STAR,
+ TK_ARROW_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_UU_ALIGNOF_UU = 388,
+ TK_RESTRICT,
+ TK_UU_ATTRIBUTE_UU,
+ TK_UU_UUIDOF
+} EToken;
+
+typedef struct FileOffsetInfo {
+ CPrepFileInfo *file;
+ SInt32 offset;
+ 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;
+};
+
+struct TStream {
+ SInt32 tokens;
+ TStreamElement *firsttoken;
+};
+
+#endif
+
+#ifdef __MWERKS__
+#pragma options align=reset
+#endif