Branch: refs/heads/master Author: Colomban Wendling ban@herbesfolles.org Committer: Colomban Wendling ban@herbesfolles.org Date: Tue, 25 Sep 2012 14:47:42 Commit: 5df551b1ce7d2192f8ddec8eda6da4ac05662969 https://github.com/geany/geany/commit/5df551b1ce7d2192f8ddec8eda6da4ac056629...
Log Message: ----------- JavaScript parser: fix parsing non-method properties
If a property value had more than one token, the parser choked on it and failed to parse further properties of the object. Fix that by properly skipping the property's value. If that value is a sub-object, parse it recursively.
Closes #3470609.
Modified Paths: -------------- tagmanager/ctags/js.c
Modified: tagmanager/ctags/js.c 41 files changed, 34 insertions(+), 7 deletions(-) =================================================================== @@ -1007,15 +1007,42 @@ static boolean parseMethods (tokenInfo *const token, tokenInfo *const class) } else { + vString * saveScope = vStringNew (); + boolean has_child_methods = FALSE; + + /* skip whatever is the value */ + while (! isType (token, TOKEN_COMMA) && + ! isType (token, TOKEN_CLOSE_CURLY)) + { + if (isType (token, TOKEN_OPEN_CURLY)) + { + vStringCopy (saveScope, token->scope); + addToScope (token, class->string); + has_child_methods = parseMethods (token, name); + vStringCopy (token->scope, saveScope); + readToken (token); + } + else if (isType (token, TOKEN_OPEN_PAREN)) + { + skipArgumentList (token); + } + else if (isType (token, TOKEN_OPEN_SQUARE)) + { + skipArrayList (token); + } + else + { + readToken (token); + } + } + vStringDelete (saveScope); + has_methods = TRUE; addToScope (name, class->string); - makeJsTag (name, JSTAG_PROPERTY); - - /* - * Read the next token, if a comma - * we must loop again - */ - readToken (token); + if (has_child_methods) + makeJsTag (name, JSTAG_CLASS); + else + makeJsTag (name, JSTAG_PROPERTY); } } }
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: TBD).