changeset 174:8b0ffe9b933d

enum first try
author kono
date Wed, 26 Nov 2003 22:08:31 +0900
parents 3b33c7daae95
children f4dcfb3e2c2c
files Changes mc-parse.c mc.h
diffstat 3 files changed, 31 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/Changes	Wed Nov 26 18:55:37 2003 +0900
+++ b/Changes	Wed Nov 26 22:08:31 2003 +0900
@@ -3568,3 +3568,4 @@
 
 なんか、知らないけど、やっぱり全部実装しないとだめなのね。
 
+あと、const int かな。
--- a/mc-parse.c	Wed Nov 26 18:55:37 2003 +0900
+++ b/mc-parse.c	Wed Nov 26 22:08:31 2003 +0900
@@ -49,6 +49,7 @@
 static int postequ(int s1, int s2);
 static int rvalue(int e);
 static int sdecl(int s);
+static int edecl(int s);
 static int skipspc(void);
 static int strop(int e);
 static int typeid(int s);
@@ -288,6 +289,7 @@
     reserve("float",FLOAT);
     reserve("double",DOUBLE);
     reserve("inline",INLINE);
+    reserve("enum",ENUM);
 
     gpc=glineno=0;
     gfree=ilabel=1;
@@ -481,6 +483,9 @@
 	t= sym;
 	getsym();
 	break;
+    case ENUM:
+	t=edecl(sym);
+	break;
     case STRUCT:
     case UNION:
 	t=sdecl(sym);
@@ -1172,6 +1177,22 @@
     return type0;
 }
 
+static int
+edecl(int s)
+{
+    int smode;
+    smode=mode;
+    if (getsym() == IDENT) {
+	if (getsym() == LC) {
+	} else {
+	}
+    } else if(sym==LC) {
+    }
+    else error(DCERR);
+    mode=smode;
+    return type;
+}
+
 static void
 code_decl(NMTBL *n)
 {
--- a/mc.h	Wed Nov 26 18:55:37 2003 +0900
+++ b/mc.h	Wed Nov 26 22:08:31 2003 +0900
@@ -60,15 +60,16 @@
 #define CODE	(-44)
 #define ENVIRONMENT	(-45)
 #define DEFINED	(-46)
-#define KONST	(-47)
-#define FMACRO	(-48)
-#define LMACRO	(-49)
-#define DOTS	(-50)
+#define ENUM	(-47)
+#define KONST	(-48)
+#define FMACRO	(-49)
+#define LMACRO	(-50)
+#define DOTS	(-51)
 
-#define FLOAT	(-51)
-#define DOUBLE	(-52)
-#define LONGLONG	(-53)
-#define ULONGLONG	(-54)
+#define FLOAT	(-52)
+#define DOUBLE	(-53)
+#define LONGLONG	(-54)
+#define ULONGLONG	(-55)
 
 /* reserved word end */