SF.net SVN: geany:[5295] trunk

ntrel at users.sourceforge.net ntrel at xxxxx
Fri Oct 15 12:17:22 UTC 2010


Revision: 5295
          http://geany.svn.sourceforge.net/geany/?rev=5295&view=rev
Author:   ntrel
Date:     2010-10-15 12:17:22 +0000 (Fri, 15 Oct 2010)

Log Message:
-----------
Ignore D /+ +/ comments.

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/tagmanager/get.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2010-10-08 19:32:06 UTC (rev 5294)
+++ trunk/ChangeLog	2010-10-15 12:17:22 UTC (rev 5295)
@@ -1,3 +1,9 @@
+2010-10-15  Nick Treleaven  <nick(dot)treleaven(at)btinternet(dot)com>
+
+ * tagmanager/get.c:
+   Ignore D /+ +/ comments.
+
+
 2010-10-08  Nick Treleaven  <nick(dot)treleaven(at)btinternet(dot)com>
 
  * src/stash.c:

Modified: trunk/tagmanager/get.c
===================================================================
--- trunk/tagmanager/get.c	2010-10-08 19:32:06 UTC (rev 5294)
+++ trunk/tagmanager/get.c	2010-10-15 12:17:22 UTC (rev 5295)
@@ -33,7 +33,7 @@
 /*
 *   DATA DECLARATIONS
 */
-typedef enum { COMMENT_NONE, COMMENT_C, COMMENT_CPLUS } Comment;
+typedef enum { COMMENT_NONE, COMMENT_C, COMMENT_CPLUS, COMMENT_D } Comment;
 
 enum eCppLimits {
 	MaxCppNestingLevel = 20,
@@ -444,6 +444,8 @@
 		comment = COMMENT_C;
 	else if (next == '/')
 		comment = COMMENT_CPLUS;
+	else if (next == '+')
+		comment = COMMENT_D;
 	else
 	{
 		fileUngetc (next);
@@ -495,6 +497,33 @@
 	return c;
 }
 
+/* Skips over a D style comment.
+ * Really we should match nested /+ comments. At least they're less common.
+ */
+int skipOverDComment (void)
+{
+	int c = fileGetc ();
+
+	while (c != EOF)
+	{
+		if (c != '+')
+			c = fileGetc ();
+		else
+		{
+			const int next = fileGetc ();
+
+			if (next != '/')
+				c = next;
+			else
+			{
+				c = SPACE;  /* replace comment with space */
+				break;
+			}
+		}
+	}
+	return c;
+}
+
 /*  Skips to the end of a string, returning a special character to
  *  symbolically represent a generic string.
  */
@@ -614,6 +643,8 @@
 					if (c == NEWLINE)
 						fileUngetc (c);
 				}
+				else if (comment == COMMENT_D)
+					c = skipOverDComment ();
 				else
 					Cpp.directive.accept = FALSE;
 				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