[geany/geany] 52d2d7: Udated jscript to be able to parse SAPUI5 controller and view files.
dfishburn
git-noreply at xxxxx
Mon Nov 24 00:39:36 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:39:36 UTC
Commit: 52d2d735272b2d9298aedbf202ed1853b840ada9
https://github.com/geany/geany/commit/52d2d735272b2d9298aedbf202ed1853b840ada9
Log Message:
-----------
Udated jscript to be able to parse SAPUI5 controller and view files.
Added test case tests/ctags/ui5.controller.js
git-svn-id: https://svn.code.sf.net/p/ctags/code/trunk@808 c5d04d22-be80-434c-894e-aa346cc9e8e8
Modified Paths:
--------------
tagmanager/ctags/js.c
tests/ctags/Makefile.am
tests/ctags/ui5.controller.js
tests/ctags/ui5.controller.js.tags
Modified: tagmanager/ctags/js.c
55 lines changed, 55 insertions(+), 0 deletions(-)
===================================================================
@@ -69,6 +69,7 @@ typedef enum eKeywordId {
KEYWORD_try,
KEYWORD_catch,
KEYWORD_finally,
+ KEYWORD_sap,
KEYWORD_return
} keywordId;
@@ -158,6 +159,7 @@ static const keywordDesc JsKeywordTable [] = {
{ "try", KEYWORD_try },
{ "catch", KEYWORD_catch },
{ "finally", KEYWORD_finally },
+ { "sap", KEYWORD_sap },
{ "return", KEYWORD_return }
};
@@ -169,6 +171,7 @@ static const keywordDesc JsKeywordTable [] = {
static void parseFunction (tokenInfo *const token);
static boolean parseBlock (tokenInfo *const token, tokenInfo *const parent);
static boolean parseLine (tokenInfo *const token, boolean is_inside_class);
+static void parseUI5 (tokenInfo *const token);
static boolean isIdentChar (const int c)
{
@@ -1629,6 +1632,56 @@ static boolean parseStatement (tokenInfo *const token, boolean is_inside_class)
return is_terminated;
}
+static void parseUI5 (tokenInfo *const token)
+{
+ tokenInfo *const name = newToken ();
+ boolean is_inside_class = FALSE;
+ /*
+ * SAPUI5 is built on top of jQuery.
+ * It follows a standard format:
+ * sap.ui.controller("id.of.controller", {
+ * method_name : function... {
+ * },
+ *
+ * method_name : function ... {
+ * }
+ * }
+ *
+ * Handle the parsing of the initial controller (and the
+ * same for "view") and then allow the methods to be
+ * parsed as usual.
+ */
+
+ readToken (token);
+
+ if (isType (token, TOKEN_PERIOD))
+ {
+ readToken (token);
+ while (! isType (token, TOKEN_OPEN_PAREN) )
+ {
+ readToken (token);
+ }
+ readToken (token);
+
+ if (isType (token, TOKEN_STRING))
+ {
+ copyToken(name, token);
+ readToken (token);
+ }
+
+ if (isType (token, TOKEN_COMMA))
+ readToken (token);
+
+ do
+ {
+ parseMethods (token, name);
+ } while (! isType (token, TOKEN_CLOSE_CURLY) );
+ }
+cleanUp:
+ deleteToken (name);
+
+}
+
static boolean parseLine (tokenInfo *const token, boolean is_inside_class)
{
boolean is_terminated = TRUE;
@@ -1691,6 +1744,8 @@ static void parseJsFile (tokenInfo *const token)
if (isType (token, TOKEN_KEYWORD) && token->keyword == KEYWORD_function)
parseFunction (token);
+ else if (isType (token, TOKEN_KEYWORD) && token->keyword == KEYWORD_sap)
+ parseUI5 (token);
else
parseLine (token, FALSE);
} while (TRUE);
Modified: tests/ctags/Makefile.am
1 lines changed, 1 insertions(+), 0 deletions(-)
===================================================================
@@ -258,6 +258,7 @@ test_sources = \
test_input2.rs \
traffic_signal.v \
traits.php \
+ ui5.controller.js \
union.f \
value.f \
whitespaces.php \
Modified: tests/ctags/ui5.controller.js
23 lines changed, 23 insertions(+), 0 deletions(-)
===================================================================
@@ -0,0 +1,23 @@
+sap.ui.controller("app.my_form", {
+
+ onInit : function () {
+ this.selectListView = null;
+ sap.ui.getCore().byId("id_createButton").setEnabled(true);
+ },
+
+ refreshForm : function (AUFNR) {
+ if (AUFNR && AUFNR !== '') {
+ this.objId = this.oView.sId;
+ }
+ return;
+ },
+
+ refreshSettlements : function (AUFNR) {
+ },
+
+ setRefreshed : function (value) {
+ this.refreshed = value;
+ },
+});
+
+
Modified: tests/ctags/ui5.controller.js.tags
5 lines changed, 5 insertions(+), 0 deletions(-)
===================================================================
@@ -0,0 +1,5 @@
+# format=tagmanager
+onInit�128�app.my_form�0
+refreshForm�128�sap.app.my_form�0
+refreshSettlements�128�sap.app.my_form�0
+setRefreshed�128�sap.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