[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] remove wchar_t from the reservation word list of C.
From: |
Hideki IWAMOTO |
Subject: |
Re: [PATCH] remove wchar_t from the reservation word list of C. |
Date: |
Sun, 02 Mar 2003 01:04:10 +0900 |
On Sun, 02 Mar 2003 00:27:04 +0900, Shigio Yamaguchi wrote...
> Hi,
> > > > By the way, how about using enum in order to simplify the addition
> > > > and deletion of a reservation word?
> > >
> > > I agree with you.
> > > I will rewrite these code using enum in the near future.
> >
> > Did you begin this work? If you have not begun yet, I will send a patch.
>
> It is helpful. Would you please send it to mailing list?
> Thank you very much.
* C.h,Cpp.h,java.h: rewrite using enum.
* C.c,C.h: add C99 keywords _Bool,_Complex,inline,restrict.
* Cpp.c,Cpp.h: add missing C++ keywords bool,const_cast,dynamic_cast,
export,false,reinterpret_cast,static_cast,true,typeid,wchar_t.
? gctags/.deps
? gctags/Makefile
? gctags/Makefile.in
? gctags/const.h
? gctags/gctags
? gctags/gctags.1
Index: gctags/C.c
===================================================================
RCS file: /cvsroot/global/global/gctags/C.c,v
retrieving revision 1.21
diff -u -r1.21 C.c
--- gctags/C.c 24 Feb 2003 05:03:48 -0000 1.21
+++ gctags/C.c 1 Mar 2003 12:58:29 -0000
@@ -639,6 +639,9 @@
{"%}", YACC_END},
{"__P", C___P},
{"__attribute__",C___ATTRIBUTE__},
+ {"_Bool", C__BOOL},
+ {"_Complex", C__COMPLEX},
+ {"_Imaginary", C__IMAGINARY},
{"asm", C_ASM},
{"auto", C_AUTO},
{"break", C_BREAK},
@@ -656,9 +659,11 @@
{"for", C_FOR},
{"goto", C_GOTO},
{"if", C_IF},
+ {"inline", C_INLINE},
{"int", C_INT},
{"long", C_LONG},
{"register", C_REGISTER},
+ {"restrict", C_RESTRICT},
{"return", C_RETURN},
{"short", C_SHORT},
{"signed", C_SIGNED},
Index: gctags/C.h
===================================================================
RCS file: /cvsroot/global/global/gctags/C.h,v
retrieving revision 1.7
diff -u -r1.7 C.h
--- gctags/C.h 17 Feb 2003 01:17:37 -0000 1.7
+++ gctags/C.h 1 Mar 2003 12:58:29 -0000
@@ -23,69 +23,81 @@
#define RULES 1
#define PROGRAMS 2
-#define C___P 1001
-#define C___ATTRIBUTE__ 1002
-#define C_ASM 1003
-#define C_AUTO 1004
-#define C_BREAK 1005
-#define C_CASE 1006
-#define C_CHAR 1007
-#define C_CONST 1008
-#define C_CONTINUE 1009
-#define C_DEFAULT 1010
-#define C_DO 1011
-#define C_DOUBLE 1012
-#define C_ELSE 1013
-#define C_ENUM 1014
-#define C_EXTERN 1015
-#define C_FLOAT 1016
-#define C_FOR 1017
-#define C_GOTO 1018
-#define C_IF 1019
-#define C_INT 1020
-#define C_LONG 1021
-#define C_REGISTER 1022
-#define C_RETURN 1023
-#define C_SHORT 1024
-#define C_SIGNED 1025
-#define C_SIZEOF 1026
-#define C_STATIC 1027
-#define C_STRUCT 1028
-#define C_SWITCH 1029
-#define C_TYPEDEF 1030
-#define C_UNION 1031
-#define C_UNSIGNED 1032
-#define C_VOID 1033
-#define C_VOLATILE 1034
-#define C_WHILE 1035
-#define CP_ELIF 2001
-#define CP_ELSE 2002
-#define CP_DEFINE 2003
-#define CP_IF 2004
-#define CP_IFDEF 2005
-#define CP_IFNDEF 2006
-#define CP_INCLUDE 2007
-#define CP_PRAGMA 2008
-#define CP_SHARP 2009
-#define CP_ERROR 2010
-#define CP_UNDEF 2011
-#define CP_ENDIF 2012
-#define CP_LINE 2013
-#define CP_WARNING 2014
-#define CP_IDENT 2015
-#define CP_ASSERT 2016
-#define YACC_SEP 3001
-#define YACC_BEGIN 3002
-#define YACC_END 3003
-#define YACC_LEFT 3004
-#define YACC_NONASSOC 3005
-#define YACC_RIGHT 3006
-#define YACC_START 3007
-#define YACC_TOKEN 3008
-#define YACC_TYPE 3009
-#define YACC_UNION 3010
-#define YACC_TERM 3011
+enum {
+ CTOKEN_BASE = 1000,
+ C___P,
+ C___ATTRIBUTE__,
+ C__BOOL,
+ C__COMPLEX,
+ C__IMAGINARY,
+ C_ASM,
+ C_AUTO,
+ C_BREAK,
+ C_CASE,
+ C_CHAR,
+ C_CONST,
+ C_CONTINUE,
+ C_DEFAULT,
+ C_DO,
+ C_DOUBLE,
+ C_ELSE,
+ C_ENUM,
+ C_EXTERN,
+ C_FLOAT,
+ C_FOR,
+ C_GOTO,
+ C_IF,
+ C_INT,
+ C_INLINE,
+ C_LONG,
+ C_REGISTER,
+ C_RESTRICT,
+ C_RETURN,
+ C_SHORT,
+ C_SIGNED,
+ C_SIZEOF,
+ C_STATIC,
+ C_STRUCT,
+ C_SWITCH,
+ C_TYPEDEF,
+ C_UNION,
+ C_UNSIGNED,
+ C_VOID,
+ C_VOLATILE,
+ C_WHILE,
-#define IS_CTOKEN(c) (c > 1000 && c < 2001)
-#define IS_CPTOKEN(c) (c > 2000 && c < 3001)
-#define IS_YACCTOKEN(c) (c > 3000 && c < 4001)
+ CPTOKEN_BASE = 2000,
+ CP_ASSERT,
+ CP_DEFINE,
+ CP_ELIF,
+ CP_ELSE,
+ CP_ENDIF,
+ CP_ERROR,
+ CP_IDENT,
+ CP_IF,
+ CP_IFDEF,
+ CP_IFNDEF,
+ CP_INCLUDE,
+ CP_LINE,
+ CP_PRAGMA,
+ CP_SHARP,
+ CP_UNDEF,
+ CP_WARNING,
+
+ YACCTOKEN_BASE = 3000,
+ YACC_SEP,
+ YACC_BEGIN,
+ YACC_END,
+ YACC_LEFT,
+ YACC_NONASSOC,
+ YACC_RIGHT,
+ YACC_START,
+ YACC_TOKEN,
+ YACC_TYPE,
+ YACC_UNION,
+ YACC_TERM
+};
+
+#define IS_CTOKEN(c) ((c) > CTOKEN_BASE && (c) < CTOKEN_BASE + 1000)
+#define IS_CPTOKEN(c) ((c) > CPTOKEN_BASE && (c) < CPTOKEN_BASE + 1000)
+#define IS_YACCTOKEN(c) ((c) > YACCTOKEN_BASE && (c) < YACCTOKEN_BASE +
1000)
Index: gctags/Cpp.c
===================================================================
RCS file: /cvsroot/global/global/gctags/Cpp.c,v
retrieving revision 1.19
diff -u -r1.19 Cpp.c
--- gctags/Cpp.c 24 Feb 2003 05:03:48 -0000 1.19
+++ gctags/Cpp.c 1 Mar 2003 12:58:29 -0000
@@ -680,21 +680,26 @@
{"__attribute__",CPP___ATTRIBUTE__},
{"asm", CPP_ASM},
{"auto", CPP_AUTO},
+ {"bool", CPP_BOOL},
{"break", CPP_BREAK},
{"case", CPP_CASE},
{"catch", CPP_CATCH},
{"char", CPP_CHAR},
{"class", CPP_CLASS},
{"const", CPP_CONST},
+ {"const_cast", CPP_CONST_CAST},
{"continue", CPP_CONTINUE},
{"default", CPP_DEFAULT},
{"delete", CPP_DELETE},
{"do", CPP_DO},
{"double", CPP_DOUBLE},
+ {"dynamic_cast",CPP_DYNAMIC_CAST},
{"else", CPP_ELSE},
{"enum", CPP_ENUM},
{"explicit", CPP_EXPLICIT},
+ {"export", CPP_EXPORT},
{"extern", CPP_EXTERN},
+ {"false", CPP_FALSE},
{"float", CPP_FLOAT},
{"for", CPP_FOR},
{"friend", CPP_FRIEND},
@@ -711,25 +716,30 @@
{"protected", CPP_PROTECTED},
{"public", CPP_PUBLIC},
{"register", CPP_REGISTER},
+ {"reinterpret_cast",CPP_REINTERPRET_CAST},
{"return", CPP_RETURN},
{"short", CPP_SHORT},
{"signed", CPP_SIGNED},
{"sizeof", CPP_SIZEOF},
{"static", CPP_STATIC},
+ {"static_cast", CPP_STATIC_CAST},
{"struct", CPP_STRUCT},
{"switch", CPP_SWITCH},
{"template", CPP_TEMPLATE},
{"this", CPP_THIS},
{"throw", CPP_THROW},
+ {"true", CPP_TRUE},
{"try", CPP_TRY},
{"typedef", CPP_TYPEDEF},
{"typename", CPP_TYPENAME},
+ {"typeid", CPP_TYPEID},
{"union", CPP_UNION},
{"unsigned", CPP_UNSIGNED},
{"using", CPP_USING},
{"virtual", CPP_VIRTUAL},
{"void", CPP_VOID},
{"volatile", CPP_VOLATILE},
+ {"wchar_t", CPP_WCHAR_T},
{"while", CPP_WHILE},
};
Index: gctags/Cpp.h
===================================================================
RCS file: /cvsroot/global/global/gctags/Cpp.h,v
retrieving revision 1.6
diff -u -r1.6 Cpp.h
--- gctags/Cpp.h 17 Feb 2003 01:20:41 -0000 1.6
+++ gctags/Cpp.h 1 Mar 2003 12:58:29 -0000
@@ -19,81 +19,96 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#define CPP___P 1001
-#define CPP___ATTRIBUTE__ 1002
-#define CPP_ASM 1003
-#define CPP_AUTO 1004
-#define CPP_BREAK 1005
-#define CPP_CASE 1006
-#define CPP_CATCH 1007
-#define CPP_CHAR 1008
-#define CPP_CLASS 1009
-#define CPP_CONST 1010
-#define CPP_CONTINUE 1011
-#define CPP_DEFAULT 1012
-#define CPP_DELETE 1013
-#define CPP_DO 1014
-#define CPP_DOUBLE 1015
-#define CPP_ELSE 1016
-#define CPP_ENUM 1017
-#define CPP_EXPLICIT 1018
-#define CPP_EXTERN 1019
-#define CPP_FLOAT 1020
-#define CPP_FOR 1021
-#define CPP_FRIEND 1022
-#define CPP_GOTO 1023
-#define CPP_IF 1024
-#define CPP_INLINE 1025
-#define CPP_INT 1026
-#define CPP_LONG 1027
-#define CPP_MUTABLE 1028
-#define CPP_NAMESPACE 1029
-#define CPP_NEW 1030
-#define CPP_OPERATOR 1031
-#define CPP_PRIVATE 1033
-#define CPP_PROTECTED 1034
-#define CPP_PUBLIC 1035
-#define CPP_REGISTER 1036
-#define CPP_RETURN 1037
-#define CPP_SHORT 1038
-#define CPP_SIGNED 1039
-#define CPP_SIZEOF 1040
-#define CPP_STATIC 1041
-#define CPP_STRUCT 1042
-#define CPP_SWITCH 1043
-#define CPP_TEMPLATE 1044
-#define CPP_THIS 1045
-#define CPP_THROW 1046
-#define CPP_TRY 1047
-#define CPP_TYPEDEF 1048
-#define CPP_TYPENAME 1049
-#define CPP_UNION 1050
-#define CPP_UNSIGNED 1051
-#define CPP_USING 1052
-#define CPP_VIRTUAL 1053
-#define CPP_VOID 1054
-#define CPP_VOLATILE 1055
-#define CPP_WHILE 1056
-#define CPP_SEP 1057
+enum {
+ CPPTOKEN_BASE = 1000,
+ CPP___P,
+ CPP___ATTRIBUTE__,
+ CPP_ASM,
+ CPP_AUTO,
+ CPP_BOOL,
+ CPP_BREAK,
+ CPP_CASE,
+ CPP_CATCH,
+ CPP_CHAR,
+ CPP_CLASS,
+ CPP_CONST,
+ CPP_CONST_CAST,
+ CPP_CONTINUE,
+ CPP_DEFAULT,
+ CPP_DELETE,
+ CPP_DO,
+ CPP_DOUBLE,
+ CPP_DYNAMIC_CAST,
+ CPP_ELSE,
+ CPP_ENUM,
+ CPP_EXPLICIT,
+ CPP_EXPORT,
+ CPP_EXTERN,
+ CPP_FALSE,
+ CPP_FLOAT,
+ CPP_FOR,
+ CPP_FRIEND,
+ CPP_GOTO,
+ CPP_IF,
+ CPP_INLINE,
+ CPP_INT,
+ CPP_LONG,
+ CPP_MUTABLE,
+ CPP_NAMESPACE,
+ CPP_NEW,
+ CPP_OPERATOR,
+ CPP_PRIVATE,
+ CPP_PROTECTED,
+ CPP_PUBLIC,
+ CPP_REGISTER,
+ CPP_REINTERPRET_CAST,
+ CPP_RETURN,
+ CPP_SHORT,
+ CPP_SIGNED,
+ CPP_SIZEOF,
+ CPP_STATIC,
+ CPP_STATIC_CAST,
+ CPP_STRUCT,
+ CPP_SWITCH,
+ CPP_TEMPLATE,
+ CPP_THIS,
+ CPP_THROW,
+ CPP_TRUE,
+ CPP_TRY,
+ CPP_TYPEDEF,
+ CPP_TYPENAME,
+ CPP_TYPEID,
+ CPP_UNION,
+ CPP_UNSIGNED,
+ CPP_USING,
+ CPP_VIRTUAL,
+ CPP_VOID,
+ CPP_VOLATILE,
+ CPP_WCHAR_T,
+ CPP_WHILE,
+ CPP_SEP,
-#define CP_ELIF 2001
-#define CP_ELSE 2002
-#define CP_DEFINE 2003
-#define CP_IF 2004
-#define CP_IFDEF 2005
-#define CP_IFNDEF 2006
-#define CP_INCLUDE 2007
-#define CP_PRAGMA 2008
-#define CP_SHARP 2009
-#define CP_ERROR 2010
-#define CP_UNDEF 2011
-#define CP_ENDIF 2012
-#define CP_LINE 2013
-#define CP_WARNING 2014
-#define CP_IDENT 2015
-#define CP_ASSERT 2016
+ CPTOKEN_BASE = 2000,
+ CP_ASSERT,
+ CP_DEFINE,
+ CP_ELIF,
+ CP_ELSE,
+ CP_ENDIF,
+ CP_ERROR,
+ CP_IDENT,
+ CP_IF,
+ CP_IFDEF,
+ CP_IFNDEF,
+ CP_INCLUDE,
+ CP_LINE,
+ CP_PRAGMA,
+ CP_SHARP,
+ CP_UNDEF,
+ CP_WARNING
+};
+
+#define IS_CPPTOKEN(c) ((c) > CPPTOKEN_BASE && (c) < CPPTOKEN_BASE + 1000)
+#define IS_CPTOKEN(c) ((c) > CPTOKEN_BASE && (c) < CPTOKEN_BASE + 1000)
-#define IS_CPPTOKEN(c) (c > 1000 && c < 2001)
-#define IS_CPTOKEN(c) (c > 2000 && c < 3001)
#define MAXCOMPLETENAME 1024 /* max size of complete name of class
*/
#define MAXCLASSSTACK 100 /* max size of class stack */
Index: gctags/java.h
===================================================================
RCS file: /cvsroot/global/global/gctags/java.h,v
retrieving revision 1.3
diff -u -r1.3 java.h
--- gctags/java.h 5 Jul 2002 07:16:46 -0000 1.3
+++ gctags/java.h 1 Mar 2003 12:58:29 -0000
@@ -22,59 +22,62 @@
/*
* java's reserved words.
*/
-#define J_ABSTRACT 1001
-#define J_BOOLEAN 1002
-#define J_BREAK 1003
-#define J_BYTE 1004
-#define J_CASE 1005
-#define J_CATCH 1006
-#define J_CHAR 1007
-#define J_CLASS 1008
-#define J_CONST 1009
-#define J_CONTINUE 1010
-#define J_DEFAULT 1011
-#define J_DO 1012
-#define J_DOUBLE 1013
-#define J_ELSE 1014
-#define J_EXTENDS 1015
-#define J_FALSE 1016
-#define J_FINAL 1017
-#define J_FINALLY 1018
-#define J_FLOAT 1019
-#define J_FOR 1020
-#define J_GOTO 1021
-#define J_IF 1022
-#define J_IMPLEMENTS 1023
-#define J_IMPORT 1024
-#define J_INSTANCEOF 1025
-#define J_INT 1026
-#define J_INTERFACE 1027
-#define J_LONG 1028
-#define J_NATIVE 1029
-#define J_NEW 1030
-#define J_NULL 1031
-#define J_PACKAGE 1032
-#define J_PRIVATE 1033
-#define J_PROTECTED 1034
-#define J_PUBLIC 1035
-#define J_RETURN 1036
-#define J_SHORT 1037
-#define J_STATIC 1038
-#define J_SUPER 1039
-#define J_SWITCH 1040
-#define J_SYNCHRONIZED 1041
-#define J_THIS 1042
-#define J_THROW 1043
-#define J_THROWS 1044
-#define J_UNION 1045
-#define J_TRANSIENT 1046
-#define J_TRUE 1047
-#define J_TRY 1048
-#define J_VOID 1049
-#define J_VOLATILE 1050
-#define J_WHILE 1051
-#define J_STRICTFP 1052
-#define J_WIDEFP 1053
+enum {
+ JTOKEN_BASE = 1000,
+ J_ABSTRACT,
+ J_BOOLEAN,
+ J_BREAK,
+ J_BYTE,
+ J_CASE,
+ J_CATCH,
+ J_CHAR,
+ J_CLASS,
+ J_CONST,
+ J_CONTINUE,
+ J_DEFAULT,
+ J_DO,
+ J_DOUBLE,
+ J_ELSE,
+ J_EXTENDS,
+ J_FALSE,
+ J_FINAL,
+ J_FINALLY,
+ J_FLOAT,
+ J_FOR,
+ J_GOTO,
+ J_IF,
+ J_IMPLEMENTS,
+ J_IMPORT,
+ J_INSTANCEOF,
+ J_INT,
+ J_INTERFACE,
+ J_LONG,
+ J_NATIVE,
+ J_NEW,
+ J_NULL,
+ J_PACKAGE,
+ J_PRIVATE,
+ J_PROTECTED,
+ J_PUBLIC,
+ J_RETURN,
+ J_SHORT,
+ J_STATIC,
+ J_SUPER,
+ J_SWITCH,
+ J_SYNCHRONIZED,
+ J_THIS,
+ J_THROW,
+ J_THROWS,
+ J_UNION,
+ J_TRANSIENT,
+ J_TRUE,
+ J_TRY,
+ J_VOID,
+ J_VOLATILE,
+ J_WHILE,
+ J_STRICTFP,
+ J_WIDEFP
+};
#define MAXCOMPLETENAME 1024 /* max size of complete name of class
*/
#define MAXCLASSSTACK 100 /* max size of class stack */
----
Hideki IWAMOTO address@hidden