Diff of /tagmanager/ctags/ruby.c [faeeaf] .. [f1e88c]  Maximize  Restore

  Switch to side-by-side view

--- a/tagmanager/ctags/ruby.c
+++ b/tagmanager/ctags/ruby.c
@@ -287,6 +287,9 @@
 	while ((line = fileReadLine ()) != NULL)
 	{
 		const unsigned char *cp = line;
+		/* if we expect a separator after a while, for, or until statement
+		 * separators are "do", ";" or newline */
+		boolean expect_separator = FALSE;
 
 		if (canMatch (&cp, "=begin"))
 		{
@@ -318,9 +321,14 @@
 		*   puts("hello") \
 		*       unless <exp>
 		*/
-		if (canMatch (&cp, "case") || canMatch (&cp, "for") ||
-			canMatch (&cp, "if") || canMatch (&cp, "unless") ||
+		if (canMatch (&cp, "for") || canMatch (&cp, "until") ||
 			canMatch (&cp, "while"))
+		{
+			expect_separator = TRUE;
+			enterUnnamedScope ();
+		}
+		else if (canMatch (&cp, "case") || canMatch (&cp, "if") ||
+				 canMatch (&cp, "unless"))
 		{
 			enterUnnamedScope ();
 		}
@@ -362,9 +370,16 @@
 				*/
 				break;
 			}
-			else if (canMatch (&cp, "begin") || canMatch (&cp, "do"))
+			else if (canMatch (&cp, "begin"))
 			{
 				enterUnnamedScope ();
+			}
+			else if (canMatch (&cp, "do"))
+			{
+				if (! expect_separator)
+					enterUnnamedScope ();
+				else
+					expect_separator = FALSE;
 			}
 			else if (canMatch (&cp, "end") && stringListCount (nesting) > 0)
 			{
@@ -383,6 +398,11 @@
 				if (*cp == '"')
 				    cp++; /* skip the last found '"' */
 			}
+			else if (*cp == ';')
+			{
+				++cp;
+				expect_separator = FALSE;
+			}
 			else if (*cp != '\0')
 			{
 				do

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks