Branch: refs/heads/master Author: Colomban Wendling ban@herbesfolles.org Committer: Colomban Wendling ban@herbesfolles.org Date: Tue, 24 Dec 2013 18:30:04 UTC Commit: a7884ee2f8b746e70cc2d71cf898a4d5a95172e0 https://github.com/geany/geany/commit/a7884ee2f8b746e70cc2d71cf898a4d5a95172...
Log Message: ----------- JavaScript: fix parsing of files starting with a shebang
Closes #1016.
Modified Paths: -------------- tagmanager/ctags/js.c tests/ctags/Makefile.am tests/ctags/shebang.js tests/ctags/shebang.js.tags
Modified: tagmanager/ctags/js.c 16 files changed, 16 insertions(+), 0 deletions(-) =================================================================== @@ -501,6 +501,22 @@ static void readToken (tokenInfo *const token) break; }
+ case '#': + /* skip shebang in case of e.g. Node.js scripts */ + if (token->lineNumber > 1) + token->type = TOKEN_UNDEFINED; + else if ((c = fileGetc ()) != '!') + { + fileUngetc (c); + token->type = TOKEN_UNDEFINED; + } + else + { + skipToCharacter ('\n'); + goto getNextChar; + } + break; + default: if (! isIdentChar (c)) token->type = TOKEN_UNDEFINED;
Modified: tests/ctags/Makefile.am 1 files changed, 1 insertions(+), 0 deletions(-) =================================================================== @@ -203,6 +203,7 @@ test_sources = \ regexp.js \ secondary_fcn_name.js \ semicolon.f90 \ + shebang.js \ signature.cpp \ simple.bas \ simple.cbl \
Modified: tests/ctags/shebang.js 3 files changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -0,0 +1,3 @@ +#!/usr/bin/end nodejs + +function f(){}
Modified: tests/ctags/shebang.js.tags 2 files changed, 2 insertions(+), 0 deletions(-) =================================================================== @@ -0,0 +1,2 @@ +# format=tagmanager +fÌ16Ö0
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).