javascript: Improve string literals handling
commit02bc3b36387671061ed61dba4cdd31f843c44ed3
authorColomban Wendling <ban@herbesfolles.org>
Tue, 2 Dec 2014 00:32:09 +0000 (2 01:32 +0100)
committerColomban Wendling <ban@herbesfolles.org>
Tue, 2 Dec 2014 14:02:39 +0000 (2 15:02 +0100)
tree3d62c9fa5fb6f07a324082045930427fb793be25
parent69a15cf2c1c8def91ffd7bc51ca8a1bfd2df563d
javascript: Improve string literals handling

1. Don't include the newline itself in a line continuation construct.
   This fixes generation of e.g. properties with embedded line
   continuations.
2. Don't continue parsing strings past an unescaped newline (as naked
   newlines are invalid inside strings).  This avoids parsing the whole
   remaining file as a string in case of broken input.  It is both
   useful to better support partly written files and to avoid loading a
   whole malformed file in memory while reading it as a string.

See section 7.8.4 "String Literals" of ECMA-262:
http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf
tagmanager/ctags/js.c
tests/ctags/Makefile.am
tests/ctags/js-broken-strings.js [new file with mode: 0644]
tests/ctags/js-broken-strings.js.tags [new file with mode: 0644]
tests/ctags/js-string-continuation.js [new file with mode: 0644]
tests/ctags/js-string-continuation.js.tags [new file with mode: 0644]