[geany/geany] c54c3a: Added new method findMatchingToken() to skip over blocks of code. Updated parseSwitch() to use the new method.
dfishburn
git-noreply at xxxxx
Mon Nov 24 00:48:04 UTC 2014
Branch: refs/heads/master
Author: dfishburn <dfishburn at c5d04d22-be80-434c-894e-aa346cc9e8e8>
Committer: Colomban Wendling <ban at herbesfolles.org>
Date: Mon, 24 Nov 2014 00:48:04 UTC
Commit: c54c3ad5e815d16e3b48f3c477465627808aadee
https://github.com/geany/geany/commit/c54c3ad5e815d16e3b48f3c477465627808aadee
Log Message:
-----------
Added new method findMatchingToken() to skip over blocks of code. Updated parseSwitch() to use the new method.
Updated tests/ctags/ui5.ui.controller.js with code that broke the switch statement.
git-svn-id: https://svn.code.sf.net/p/ctags/code/trunk@809 c5d04d22-be80-434c-894e-aa346cc9e8e8
Modified Paths:
--------------
tagmanager/ctags/js.c
tests/ctags/ui5.controller.js
tests/ctags/ui5.controller.js.tags
Modified: tagmanager/ctags/js.c
35 lines changed, 27 insertions(+), 8 deletions(-)
===================================================================
@@ -674,10 +674,35 @@ static void findCmdTerm (tokenInfo *const token)
}
}
+static void findMatchingToken (tokenInfo *const token, tokenType begin_token, tokenType end_token)
+{
+ int nest_level = 0;
+
+ if ( ! isType (token, end_token))
+ {
+ nest_level++;
+ while (! (isType (token, end_token) && (nest_level == 0)))
+ {
+ readToken (token);
+ if (isType (token, begin_token))
+ {
+ nest_level++;
+ }
+ if (isType (token, end_token))
+ {
+ if (nest_level > 0)
+ {
+ nest_level--;
+ }
+ }
+ }
+ }
+}
+
static void parseSwitch (tokenInfo *const token)
{
/*
- * switch (expression){
+ * switch (expression) {
* case value1:
* statement;
* break;
@@ -701,13 +726,7 @@ static void parseSwitch (tokenInfo *const token)
if (isType (token, TOKEN_OPEN_CURLY))
{
- /*
- * This will be either a function or a class.
- * We can only determine this by checking the body
- * of the function. If we find a "this." we know
- * it is a class, otherwise it is a function.
- */
- parseBlock (token, token);
+ findMatchingToken (token, TOKEN_OPEN_CURLY, TOKEN_CLOSE_CURLY);
}
}
Modified: tests/ctags/ui5.controller.js
8 lines changed, 8 insertions(+), 0 deletions(-)
===================================================================
@@ -1,5 +1,13 @@
sap.ui.controller("app.my_form", {
+ successfulRequest: function(data) {
+ switch( data.mParameters.headers.SAAP_SERVICE ) {
+ case SAAP_SERVICE.APPROVAL_DETAIL:
+ if (thisForm.getController().mApproval) {
+ }
+ }
+ },
+
onInit : function () {
this.selectListView = null;
sap.ui.getCore().byId("id_createButton").setEnabled(true);
Modified: tests/ctags/ui5.controller.js.tags
1 lines changed, 1 insertions(+), 0 deletions(-)
===================================================================
@@ -3,3 +3,4 @@ onInit
refreshForm�128�sap.app.my_form�0
refreshSettlements�128�sap.app.my_form�0
setRefreshed�128�sap.app.my_form�0
+successfulRequest�128�app.my_form�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