[geany/geany] 32b971: JavaScript: fix parsing of regular expressions in a return statement

Colomban Wendling git-noreply at xxxxx
Mon Sep 23 14:52:55 UTC 2013


Branch:      refs/heads/master
Author:      Colomban Wendling <ban at herbesfolles.org>
Committer:   Colomban Wendling <ban at herbesfolles.org>
Date:        Mon, 23 Sep 2013 14:52:55 UTC
Commit:      32b971cf1cb79891956a006da8432e4f22e3d515
             https://github.com/geany/geany/commit/32b971cf1cb79891956a006da8432e4f22e3d515

Log Message:
-----------
JavaScript: fix parsing of regular expressions in a return statement


Modified Paths:
--------------
    tagmanager/ctags/js.c
    tests/ctags/regexp.js
    tests/ctags/regexp.js.tags

Modified: tagmanager/ctags/js.c
9 files changed, 5 insertions(+), 4 deletions(-)
===================================================================
@@ -68,7 +68,8 @@
 	KEYWORD_switch,
 	KEYWORD_try,
 	KEYWORD_catch,
-	KEYWORD_finally
+	KEYWORD_finally,
+	KEYWORD_return
 } keywordId;
 
 /*	Used to determine whether keyword is valid for the token language and
@@ -156,7 +157,8 @@
 	{ "switch",		KEYWORD_switch				},
 	{ "try",		KEYWORD_try					},
 	{ "catch",		KEYWORD_catch				},
-	{ "finally",	KEYWORD_finally				}
+	{ "finally",	KEYWORD_finally				},
+	{ "return",		KEYWORD_return				}
 };
 
 /*
@@ -459,7 +461,6 @@ static void readToken (tokenInfo *const token)
 						  switch (LastTokenType)
 						  {
 							  case TOKEN_CHARACTER:
-							  case TOKEN_KEYWORD:
 							  case TOKEN_IDENTIFIER:
 							  case TOKEN_STRING:
 							  case TOKEN_CLOSE_CURLY:
@@ -1643,7 +1644,7 @@ static boolean parseLine (tokenInfo *const token, boolean is_inside_class)
 				parseSwitch (token);
 				break;
 			default:
-				parseStatement (token, is_inside_class);
+				is_terminated = parseStatement (token, is_inside_class);
 				break;
 		}
 	}


Modified: tests/ctags/regexp.js
11 files changed, 11 insertions(+), 0 deletions(-)
===================================================================
@@ -2,6 +2,10 @@
  * ctags should return the following for parsing this file using:
  * ctags -f - simple.js
  * 
+ * functions:
+ *    func1
+ *    func2
+ * 
  * variables:
  *    no_re1
  *    no_re2
@@ -36,3 +40,10 @@ var re6 = /\(([a-z]*_)+/;
 var str1 = "a/b/c".replace(/\//g, '-');
 var str2 = "Hello".replace(/O/ig, 'O');
 
+function func1() {
+  return /function bug1(foo){/;
+}
+
+function func2() {
+  return /\(/;
+}


Modified: tests/ctags/regexp.js.tags
2 files changed, 2 insertions(+), 0 deletions(-)
===================================================================
@@ -1,4 +1,6 @@
 # format=tagmanager
+func1�16�0
+func2�16�0
 no_re1�16384�0
 no_re2�16384�0
 no_re3�16384�0



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Commits mailing list