SF.net SVN: geany: [903] trunk

eht16 at users.sourceforge.net eht16 at xxxxx
Wed Oct 18 20:11:13 UTC 2006


Revision: 903
          http://svn.sourceforge.net/geany/?rev=903&view=rev
Author:   eht16
Date:     2006-10-18 13:11:05 -0700 (Wed, 18 Oct 2006)

Log Message:
-----------
Use "::" as context separator only for C++, otherwise use ".".
Detect module declarations in D and put them in the symbol list.

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/src/treeviews.c
    trunk/src/utils.c
    trunk/tagmanager/c.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2006-10-18 19:35:42 UTC (rev 902)
+++ trunk/ChangeLog	2006-10-18 20:11:05 UTC (rev 903)
@@ -1,3 +1,10 @@
+2006-10-18  Enrico Tröger  <enrico.troeger at uvena.de>
+
+ * src/utils.c, src/treeviews.c, tagmanager/c.c:
+   Use "::" as context separator only for C++, otherwise use ".".
+   Detect module declarations in D and put them in the symbol list.
+
+
 2006-10-18  Nick Treleaven  <nick.treleaven at btinternet.com>
 
  * src/build.c, src/build.h, src/ui_utils.h, src/ui_utils.c,
@@ -6,6 +13,7 @@
    Move build menu related functions and callbacks to build.c.
    Renamed ui_update_build_menu -> build_menu_update.
 
+
 2006-10-17  Nick Treleaven  <nick.treleaven at btinternet.com>
 
  * src/callbacks.c, src/filetypes.h, src/ui_utils.c:

Modified: trunk/src/treeviews.c
===================================================================
--- trunk/src/treeviews.c	2006-10-18 19:35:42 UTC (rev 902)
+++ trunk/src/treeviews.c	2006-10-18 20:11:05 UTC (rev 903)
@@ -180,7 +180,12 @@
 			break;
 		}
 		case GEANY_FILETYPES_JAVA:
+		case GEANY_FILETYPES_D:
 		{
+			// use singular because one file can only belong to one Package / Module
+			gchar *namespace_name = (doc_list[idx].file_type->id == GEANY_FILETYPES_D) ?
+									 _("Module") : _("Package");
+			
 			gtk_tree_store_append(doc_list[idx].tag_store, &(tv.tag_function), NULL);
 			gtk_tree_store_set(doc_list[idx].tag_store, &(tv.tag_function), 0, _("Methods"), -1);
 			gtk_tree_store_append(doc_list[idx].tag_store, &(tv.tag_class), NULL);
@@ -194,7 +199,7 @@
 			//gtk_tree_store_append(doc_list[idx].tag_store, &(tv.tag_variable), NULL);
 			//gtk_tree_store_set(doc_list[idx].tag_store, &(tv.tag_variable), 0, _("Variables"), -1);
 			gtk_tree_store_append(doc_list[idx].tag_store, &(tv.tag_namespace), NULL);
-			gtk_tree_store_set(doc_list[idx].tag_store, &(tv.tag_namespace), 0, _("Packages"), -1);
+			gtk_tree_store_set(doc_list[idx].tag_store, &(tv.tag_namespace), 0, namespace_name, -1);
 			gtk_tree_store_append(doc_list[idx].tag_store, &(tv.tag_other), NULL);
 			gtk_tree_store_set(doc_list[idx].tag_store, &(tv.tag_other), 0, _("Other"), -1);
 			break;

Modified: trunk/src/utils.c
===================================================================
--- trunk/src/utils.c	2006-10-18 19:35:42 UTC (rev 902)
+++ trunk/src/utils.c	2006-10-18 20:11:05 UTC (rev 903)
@@ -232,8 +232,12 @@
 				else utf8_name = tag->name;
 				if ((tag->atts.entry.scope != NULL) && isalpha(tag->atts.entry.scope[0]))
 				{
+					// context separator
+					gchar *cosep = (doc_list[idx].file_type->id == GEANY_FILETYPES_CPP) ? "::" : ".";
+					
 					symbol = g_new0(GeanySymbol, 1);
-					symbol->str = g_strdup_printf("%s::%s [%ld]", tag->atts.entry.scope, utf8_name, tag->atts.entry.line);
+					symbol->str = g_strdup_printf("%s%s%s [%ld]", tag->atts.entry.scope, cosep,
+																utf8_name, tag->atts.entry.line);
 					symbol->type = tag->type;
 					symbol->line = tag->atts.entry.line;
 					tag_names = g_list_prepend(tag_names, symbol);

Modified: trunk/tagmanager/c.c
===================================================================
--- trunk/tagmanager/c.c	2006-10-18 19:35:42 UTC (rev 902)
+++ trunk/tagmanager/c.c	2006-10-18 20:11:05 UTC (rev 903)
@@ -67,7 +67,7 @@
     KEYWORD_IMPLEMENTS, KEYWORD_IMPORT, KEYWORD_INLINE, KEYWORD_INT,
     KEYWORD_INTERFACE,
     KEYWORD_LONG,
-    KEYWORD_MUTABLE,
+    KEYWORD_MUTABLE, KEYWORD_MODULE,
     KEYWORD_NAMESPACE, KEYWORD_NEW, KEYWORD_NATIVE,
     KEYWORD_OPERATOR, KEYWORD_OVERLOAD,
     KEYWORD_PACKAGE, KEYWORD_PRIVATE, KEYWORD_PROTECTED, KEYWORD_PUBLIC,
@@ -127,6 +127,7 @@
     DECL_FUNCTION,
     DECL_IGNORE,		/* non-taggable "declaration" */
     DECL_INTERFACE,
+    DECL_MODULE,
     DECL_NAMESPACE,
     DECL_NOMANGLE,		/* C++ name demangling block */
     DECL_PACKAGE,
@@ -302,6 +303,7 @@
     { "int",		KEYWORD_INT,		{ 1, 1, 1 } },
     { "interface",	KEYWORD_INTERFACE,	{ 0, 0, 1 } },
     { "long",		KEYWORD_LONG,		{ 1, 1, 1 } },
+    { "module",		KEYWORD_MODULE,		{ 0, 1, 0 } },
     { "mutable",	KEYWORD_MUTABLE,	{ 0, 1, 0 } },
     { "namespace",	KEYWORD_NAMESPACE,	{ 0, 1, 0 } },
     { "native",		KEYWORD_NATIVE,		{ 0, 0, 1 } },
@@ -809,8 +811,8 @@
 	case DECL_CLASS:	type = TAG_CLASS;	break;
 	case DECL_ENUM:		type = TAG_ENUM;	break;
 	case DECL_FUNCTION:	type = TAG_FUNCTION;	break;
-	case DECL_INTERFACE:	type = TAG_INTERFACE;	break;
-	case DECL_NAMESPACE:	type = TAG_NAMESPACE;	break;
+	case DECL_INTERFACE:type = TAG_INTERFACE;	break;
+	case DECL_NAMESPACE:type = TAG_NAMESPACE;	break;
 	case DECL_STRUCT:	type = TAG_STRUCT;	break;
 	case DECL_UNION:	type = TAG_UNION;	break;
 
@@ -1143,6 +1145,8 @@
 	makeTag (nameToken, st, TRUE, TAG_TYPEDEF);
     else if (st->declaration == DECL_PACKAGE)
 	makeTag (nameToken, st, FALSE, TAG_PACKAGE);
+    else if (st->declaration == DECL_MODULE) // handle modules in D as namespaces
+	makeTag (nameToken, st, FALSE, TAG_NAMESPACE);
     else if (isValidTypeSpecifier (st->declaration))
     {
 	if (isMember (st))
@@ -1343,7 +1347,10 @@
     Assert (isType (token, TOKEN_KEYWORD));
     readPackageName (token, skipToNonWhite ());
     token->type = TOKEN_NAME;
-    st->declaration = DECL_PACKAGE;
+    if (isLanguage (Lang_d))
+		st->declaration = DECL_MODULE;
+	else
+		st->declaration = DECL_PACKAGE;
     st->gotName = TRUE;
     st->haveQualifyingName = TRUE;
 }
@@ -1541,6 +1548,7 @@
 	case KEYWORD_LONG:	st->declaration = DECL_BASE;		break;
 	case KEYWORD_NAMESPACE: st->declaration = DECL_NAMESPACE;	break;
 	case KEYWORD_OPERATOR:	readOperator (st);			break;
+	case KEYWORD_MODULE:	readPackage (st);			break;
 	case KEYWORD_PACKAGE:	readPackage (st);			break;
 	case KEYWORD_PRIVATE:	setAccess (st, ACCESS_PRIVATE);		break;
 	case KEYWORD_PROTECTED:	setAccess (st, ACCESS_PROTECTED);	break;


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the Commits mailing list