shithub: scc

Download patch

ref: d31abf3c36b0f84085c78a35791d8a25cb941da3
parent: c076bf291eff4fa3fa0702cb971a493fc1dc1680
author: Roberto E. Vargas Caballero <[email protected]>
date: Sun Jun 10 15:12:51 EDT 2012

Unified keywords and symbols

This helps in simplify the code, using the same code for both, keywords and
symbols. After this patch the lexical is simpler, because doesn't care about
the keywords.

--- a/symbol.h
+++ b/symbol.h
@@ -8,12 +8,14 @@
 struct symbol {
 	struct type *type;
 	union {
-		struct {	/* used in usual symbols */
+		struct {
 			char *str;
-			unsigned char level;
+			union {
+				unsigned char level;/* used in usual symbols */
+				unsigned char tok;  /* used in keywords */
+			};
 		};
-		unsigned char tok; /* used in keywords */
-		short val;
+		short val;	/* used in integer constant */
 	};
 	struct symbol *next;
 	struct symbol *h_next, *h_prev;