SF.net SVN: geany: [1636] trunk

eht16 at users.sourceforge.net eht16 at xxxxx
Sat Jun 23 16:49:16 UTC 2007


Revision: 1636
          http://svn.sourceforge.net/geany/?rev=1636&view=rev
Author:   eht16
Date:     2007-06-23 09:49:15 -0700 (Sat, 23 Jun 2007)

Log Message:
-----------
Merge recent changes from CTags SVN.

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

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2007-06-22 17:34:31 UTC (rev 1635)
+++ trunk/ChangeLog	2007-06-23 16:49:15 UTC (rev 1636)
@@ -1,3 +1,8 @@
+2007-06-23  Enrico Tröger  <enrico.troeger at uvena.de>
+
+ * tagmanager/basic.c: Merge recent changes from CTags SVN.
+
+
 2007-06-22  Enrico Tröger  <enrico.troeger at uvena.de>
 
  * tagmanager/c.c, tagmanager/get.c, tagmanager/get.h:

Modified: trunk/tagmanager/basic.c
===================================================================
--- trunk/tagmanager/basic.c	2007-06-22 17:34:31 UTC (rev 1635)
+++ trunk/tagmanager/basic.c	2007-06-23 16:49:15 UTC (rev 1636)
@@ -38,6 +38,7 @@
 typedef struct {
 	char const *token;
 	BasicKind kind;
+	int skip;
 } KeyWord;
 
 static kindOption BasicKinds[] = {
@@ -50,37 +51,38 @@
 };
 
 static KeyWord blitzbasic_keywords[] = {
-	{"const", K_CONST},
-	{"global", K_VARIABLE},
-	{"dim", K_VARIABLE},
-	{"function", K_FUNCTION},
-	{"type", K_TYPE},
-	{NULL, 0}
+	{"const", K_CONST, 0},
+	{"global", K_VARIABLE, 0},
+	{"dim", K_VARIABLE, 0},
+	{"function", K_FUNCTION, 0},
+	{"type", K_TYPE, 0},
+	{NULL, 0, 0}
 };
 
 static KeyWord purebasic_keywords[] = {
-	{"newlist", K_VARIABLE},
-	{"global", K_VARIABLE},
-	{"dim", K_VARIABLE},
-	{"procedure", K_FUNCTION},
-	{"interface", K_TYPE},
-	{"structure", K_TYPE},
-	{NULL, 0}
+	{"newlist", K_VARIABLE, 0},
+	{"global", K_VARIABLE, 0},
+	{"dim", K_VARIABLE, 0},
+	{"procedure", K_FUNCTION, 0},
+	{"interface", K_TYPE, 0},
+	{"structure", K_TYPE, 0},
+	{NULL, 0, 0}
 };
 
 static KeyWord freebasic_keywords[] = {
-	{"const", K_CONST},
-	{"dim", K_VARIABLE},
-	{"common", K_VARIABLE},
-	{"function", K_FUNCTION},
-	{"sub", K_FUNCTION},
-	{"private sub", K_FUNCTION},
-	{"public sub", K_FUNCTION},
-	{"private function", K_FUNCTION},
-	{"public function", K_FUNCTION},
-	{"type", K_TYPE},
-	{"enum", K_ENUM},
-	{NULL, 0}
+	{"const", K_CONST, 0},
+	{"dim as", K_VARIABLE, 1},
+	{"dim", K_VARIABLE, 0},
+	{"common", K_VARIABLE, 0},
+	{"function", K_FUNCTION, 0},
+	{"sub", K_FUNCTION, 0},
+	{"private sub", K_FUNCTION, 0},
+	{"public sub", K_FUNCTION, 0},
+	{"private function", K_FUNCTION, 0},
+	{"public function", K_FUNCTION, 0},
+	{"type", K_TYPE, 0},
+	{"enum", K_ENUM, 0},
+	{NULL, 0, 0}
 };
 
 /*
@@ -88,7 +90,7 @@
  */
 
 /* Match the name of a tag (function, variable, type, ...) starting at pos. */
-static void extract_name (char const *pos, vString * name)
+static char const *extract_name (char const *pos, vString * name)
 {
 	while (isspace (*pos))
 		pos++;
@@ -96,29 +98,29 @@
 	for (; *pos && !isspace (*pos) && *pos != '(' && *pos != ','; pos++)
 		vStringPut (name, *pos);
 	vStringTerminate (name);
+	return pos;
 }
 
 /* Match a keyword starting at p (case insensitive). */
-static void match_keyword (const char *p, const char *keyword, BasicKind kind)
+static int match_keyword (const char *p, KeyWord const *kw)
 {
 	vString *name;
 	size_t i;
-	for (i = 0; i < strlen (keyword); i++)
+	int j;
+	for (i = 0; i < strlen (kw->token); i++)
 	{
-		if (tolower (p[i]) != keyword[i])
-			return;
+		if (tolower (p[i]) != kw->token[i])
+			return 0;
 	}
 	name = vStringNew ();
-	extract_name (p + i, name);
-	// if we have "DIM AS STRING str" we should skip "AS STRING" - eht16
-	if (strcmp(keyword, "dim") == 0 && strncasecmp (name->buffer, "as", 2) == 0)
+	p += i;
+	for (j = 0; j < 1 + kw->skip; j++)
 	{
-		char *new_start = strchr (p + i + 4, ' '); // + 4 skips " AS "
-		if (new_start != NULL)
-			extract_name (new_start + 1, name);
-	}
-	makeSimpleTag (name, BasicKinds, kind);
+    	p = extract_name (p, name);
+    }
+	makeSimpleTag (name, BasicKinds, kw->kind);
 	vStringDelete (name);
+	return 1;
 }
 
 /* Match a "label:" style label. */
@@ -167,7 +169,7 @@
 
 		/* In Basic, keywords always are at the start of the line. */
 		for (kw = keywords; kw->token; kw++)
-			match_keyword (p, kw->token, kw->kind);
+			if (match_keyword (p, kw)) break;
 
 		/* Is it a label? */
 		label (p);


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