]> git.xonotic.org Git - xonotic/gmqcc.git/blobdiff - lexer.h
Make ** RIGHT associative
[xonotic/gmqcc.git] / lexer.h
diff --git a/lexer.h b/lexer.h
index 3be4c6ed9ff103dc8ab3bedf766341c1157df672..83cb62470dc53f79a4da813ae1177f7f91091d80 100644 (file)
--- a/lexer.h
+++ b/lexer.h
@@ -25,8 +25,6 @@
 
 typedef struct token_s token;
 
-#include "ast.h"
-
 struct token_s {
     int ttype;
 
@@ -77,6 +75,8 @@ enum {
     TOKEN_ATTRIBUTE_CLOSE, /* ]] */
 
     TOKEN_VA_ARGS, /* for the ftepp only */
+    TOKEN_VA_ARGS_ARRAY, /* for the ftepp only */
+    TOKEN_VA_COUNT,     /* to get the count of vaargs */
 
     TOKEN_STRINGCONST, /* not the typename but an actual "string" */
     TOKEN_CHARCONST,
@@ -101,7 +101,7 @@ typedef struct {
     int   value;
 } frame_macro;
 
-typedef struct {
+typedef struct lex_file_s {
     FILE   *file;
     const char *open_string;
     size_t      open_string_length;
@@ -111,7 +111,7 @@ typedef struct {
     size_t  line;
     size_t  sline; /* line at the start of a token */
 
-    char    peek[256];
+    int     peek[256];
     size_t  peekpos;
 
     bool    eof;
@@ -185,6 +185,7 @@ static const oper_info c_operators[] = {
     { "%",   2, opid1('%'),         ASSOC_LEFT,  13, 0 },
 
     { "+",   2, opid1('+'),         ASSOC_LEFT,  12, 0 },
+    { "**",  2, opid2('*', '*'),    ASSOC_RIGHT, 12, 0 },
     { "-",   2, opid1('-'),         ASSOC_LEFT,  12, 0 },
 
     { "<<",  2, opid2('<','<'),     ASSOC_LEFT,  11, 0 },
@@ -192,6 +193,7 @@ static const oper_info c_operators[] = {
 
     { "<",   2, opid1('<'),         ASSOC_LEFT,  10, 0 },
     { ">",   2, opid1('>'),         ASSOC_LEFT,  10, 0 },
+    { "<=>", 2, opid3('<','=','>'), ASSOC_LEFT,  10, 0 },
     { "<=",  2, opid2('<','='),     ASSOC_LEFT,  10, 0 },
     { ">=",  2, opid2('>','='),     ASSOC_LEFT,  10, 0 },
 
@@ -252,6 +254,9 @@ static const oper_info fte_operators[] = {
     { "+",   2, opid1('+'),         ASSOC_LEFT,  12, 0 },
     { "-",   2, opid1('-'),         ASSOC_LEFT,  12, 0 },
 
+    { "<<",  2, opid2('<','<'),     ASSOC_LEFT,  11, 0 },
+    { ">>",  2, opid2('>','>'),     ASSOC_LEFT,  11, 0 },
+
     { "<",   2, opid1('<'),         ASSOC_LEFT,  10, 0 },
     { ">",   2, opid1('>'),         ASSOC_LEFT,  10, 0 },
     { "<=",  2, opid2('<','='),     ASSOC_LEFT,  10, 0 },