Branch: refs/heads/master Author: Colomban Wendling ban@herbesfolles.org Committer: Colomban Wendling ban@herbesfolles.org Date: Mon, 24 Jun 2013 18:27:22 UTC Commit: 8b11f9b0efc32cd3da892b6e464cd9d1355543ec https://github.com/geany/geany/commit/8b11f9b0efc32cd3da892b6e464cd9d1355543...
Log Message: ----------- SQL: generalize support for SQL Server square brackets quoting
This fixes test case tests/ctags/bug1944150.sql.
Modified Paths: -------------- tagmanager/ctags/sql.c tests/ctags/bug1944150.sql.tags
Modified: tagmanager/ctags/sql.c 92 files changed, 44 insertions(+), 48 deletions(-) =================================================================== @@ -688,6 +688,26 @@ static void readToken (tokenInfo *const token) }
/* + * reads an indentifier, possibly quoted: + * identifier + * "identifier" + * [identifier] + */ +static void readIdentifier (tokenInfo *const token) +{ + readToken (token); + if (isType (token, TOKEN_OPEN_SQUARE)) + { + tokenInfo *const close_square = newToken (); + + readToken (token); + /* eat close swuare */ + readToken (close_square); + deleteToken (close_square); + } +} + +/* * Token parsing functions */
@@ -1616,14 +1636,14 @@ static void parsePackage (tokenInfo *const token) * CREATE OR REPLACE PACKAGE BODY owner.pkg_name AS */ tokenInfo *const name = newToken (); - readToken (name); + readIdentifier (name); if (isKeyword (name, KEYWORD_body)) { /* * Ignore the BODY tag since we will process * the body or prototypes in the same manner */ - readToken (name); + readIdentifier (name); } /* Check for owner.pkg_name */ while (! isKeyword (token, KEYWORD_is)) @@ -1631,7 +1651,7 @@ static void parsePackage (tokenInfo *const token) readToken (token); if ( isType(token, TOKEN_PERIOD) ) { - readToken (name); + readIdentifier (name); } } if (isKeyword (token, KEYWORD_is)) @@ -1673,13 +1693,7 @@ static void parseTable (tokenInfo *const token) */
/* This could be a database, owner or table name */ - readToken (name); - if (isType (name, TOKEN_OPEN_SQUARE)) - { - readToken (name); - /* Read close square */ - readToken (token); - } + readIdentifier (name); readToken (token); if (isType (token, TOKEN_PERIOD)) { @@ -1689,35 +1703,17 @@ static void parseTable (tokenInfo *const token) * referenced with a blank owner: * dbname..tablename */ - readToken (name); - if (isType (name, TOKEN_OPEN_SQUARE)) - { - readToken (name); - /* Read close square */ - readToken (token); - } + readIdentifier (name); /* Check if a blank name was provided */ if (isType (name, TOKEN_PERIOD)) { - readToken (name); - if (isType (name, TOKEN_OPEN_SQUARE)) - { - readToken (name); - /* Read close square */ - readToken (token); - } + readIdentifier (name); } readToken (token); if (isType (token, TOKEN_PERIOD)) { /* This can only be the table name */ - readToken (name); - if (isType (name, TOKEN_OPEN_SQUARE)) - { - readToken (name); - /* Read close square */ - readToken (token); - } + readIdentifier (name); readToken (token); } } @@ -1757,21 +1753,21 @@ static void parseIndex (tokenInfo *const token) * create bitmap index "i6" on t1(c1) */
- readToken (name); + readIdentifier (name); readToken (token); if (isType (token, TOKEN_PERIOD)) { - readToken (name); + readIdentifier (name); readToken (token); } if ( isKeyword (token, KEYWORD_on) && (isType (name, TOKEN_IDENTIFIER) || isType (name, TOKEN_STRING) ) ) { - readToken (owner); + readIdentifier (owner); readToken (token); if (isType (token, TOKEN_PERIOD)) { - readToken (owner); + readIdentifier (owner); readToken (token); } addToScope(name, owner->string); @@ -1794,11 +1790,11 @@ static void parseEvent (tokenInfo *const token) * create event "dba"."e4" handler begin end; */
- readToken (name); + readIdentifier (name); readToken (token); if (isType (token, TOKEN_PERIOD)) { - readToken (name); + readIdentifier (name); } while (! (isKeyword (token, KEYWORD_handler) || (isType (token, TOKEN_SEMICOLON))) ) @@ -1840,11 +1836,11 @@ static void parseTrigger (tokenInfo *const token) * create trigger "tr6" begin end; */
- readToken (name); + readIdentifier (name); readToken (token); if (isType (token, TOKEN_PERIOD)) { - readToken (name); + readIdentifier (name); readToken (token); }
@@ -1910,11 +1906,11 @@ static void parsePublication (tokenInfo *const token) * create publication "dba"."pu4" () */
- readToken (name); + readIdentifier (name); readToken (token); if (isType (token, TOKEN_PERIOD)) { - readToken (name); + readIdentifier (name); readToken (token); } if (isType (token, TOKEN_OPEN_PAREN)) @@ -1944,7 +1940,7 @@ static void parseService (tokenInfo *const token) * CALL sp_Something(); */
- readToken (name); + readIdentifier (name); readToken (token); if (isKeyword (token, KEYWORD_type)) { @@ -1967,10 +1963,10 @@ static void parseDomain (tokenInfo *const token) * CREATE DOMAIN|DATATYPE [AS] your_name ...; */
- readToken (name); + readIdentifier (name); if (isKeyword (name, KEYWORD_is)) { - readToken (name); + readIdentifier (name); } readToken (token); if (isType (name, TOKEN_IDENTIFIER) || @@ -2009,7 +2005,7 @@ static void parseVariable (tokenInfo *const token) * drop variable @varname3; */
- readToken (name); + readIdentifier (name); readToken (token); if ( (isType (name, TOKEN_IDENTIFIER) || isType (name, TOKEN_STRING)) && !isType (token, TOKEN_SEMICOLON) ) @@ -2033,7 +2029,7 @@ static void parseSynonym (tokenInfo *const token) * drop variable @varname3; */
- readToken (name); + readIdentifier (name); readToken (token); if ( (isType (name, TOKEN_IDENTIFIER) || isType (name, TOKEN_STRING)) && isKeyword (token, KEYWORD_for) ) @@ -2057,11 +2053,11 @@ static void parseView (tokenInfo *const token) * drop variable @varname3; */
- readToken (name); + readIdentifier (name); readToken (token); if (isType (token, TOKEN_PERIOD)) { - readToken (name); + readIdentifier (name); readToken (token); } if ( isType (token, TOKEN_OPEN_PAREN) )
Modified: tests/ctags/bug1944150.sql.tags 2 files changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -1,2 +1,2 @@ # format=tagmanager -cash_trade_comment.�65536�0 +cash_trade_comment.tr_d_cash_trade_comment�65536�0
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).