A regular expression like str.replace(/\//g, "-"); (that is: replace all forward slashes with "-") inside a function definition breaks the function list in the symbols sidebar.
The function with the regex and all following functions vanish from the sidebar.
A regex like str.replace(/(\/)/g, "-") works. So the problem is that there is nothing but (one or more) slashes in the regex.
Geany 0.21 (svn >= 5888) Windows XP, german
(kompiliert am Aug 16 2011 oder später)
test.js to show the error with javascript regex
SciTE 2.01 and SciTE 2.29 properly highlight the regular expression.
PSPad 4.5.4 (another Scintilla based editor) properly shows the function list.
Geany 0.19 svn >= 4375 also breaks the function list.
The regular expression definitely is valid.
I can confirm this on windows 7 with geany 0.21
@nick: The reason why this happens is because the JS parser don't recognize regexp, and then treats "//" in it as a single-line comment start. Doing so eats the closing brace at the end of the line, thus making the parser search it 'til the end of file.
A proper fix would probably be to properly read the regex, though I'm not sure how do to so (e.g. it needs to differentiate division from re start, etc.).
@ban: I've attached a simple fix that works (fix-js-regex-escape.diff), but I don't know if it causes other problems. Single line comments still seem to be ignored AFAICT. Let me know if this is OK.
@nick: I don't know JS very well, but yes I think this will fix (or workaround) the exact problem the reporter had since a "/" must be escaped in a RE. However, it won't catch other syntactic starts in a RE, e.g. strings: str.replace(/"/, """) will still confuse the parser.
Actually it'd need probably a "real" (or partial at least) RE parser to catch all cases, because even the regex /[//]/ is perfectly valid. OK, it's stupid, but totally acceptable syntactically. Not sure it worth it though.
FWIW, both "upstream" Exuberant Ctags and Anjuta's fork have completely different, presumably improved, JS parsers. I think Anjuta-tags is even using a "real" Flex/Bison parser generator. I'm not sure you hard it would be to use either of their solutions.
For reference:
http://ctags.svn.sourceforge.net/viewvc/ctags/trunk/jscript.c?revision=763&view=markup
http://git.gnome.org/browse/anjuta/tree/plugins/symbol-db/anjuta-tags/jscript.c
@codebrainz: I updated js.c from CTags SVN jscript.c early this afternoon. It still doesn't parse regexes, but we now have many other fixes.
@ban: You're right that a proper fix needs to parse regexes - I won't commit my diff for this reason.
If anyone feels like filing a CTags bug for JS regex support, please go ahead.
Now fixed in Git, thanks for reporting.