76 Commits

Author SHA1 Message Date
Colomban Wendling
02bc3b3638 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
2014-12-02 15:02:39 +01:00
Colomban Wendling
55b4b867f3 javascript: Don't use invalid syntax in a test case
A regex is not a valid JavaScript property name, and the test case was
not meant to specifically check for handling of invalid syntax but
rather valid regex syntax with embedded quotes.
2014-11-24 03:50:00 +01:00
Colomban Wendling
5793694134 javascript: Add support for the let keyword
`let` is not yet part of the current ECMAScript standard but is part of
the ECMAScript 6 draft and is supported by Mozilla, and people already
use it in some contexts.

Also, the current ECMAScript standard marks `let` as a "considered
reserved word" (7.6.1.2), so it is already a reserved keyword in strict
mode.

See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/let
2014-11-24 03:00:27 +01:00
Colomban Wendling
ef8c40f1e4 javascript: Add support for the const keyword
`const` is not yet part of the current ECMAScript standard but is
part of the ECMAScript 6 draft and is supported by popular engines
including Mozilla and WebKit, and people already use it.

See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/const
2014-11-24 02:59:08 +01:00
Colomban Wendling
b85d754610 javascript: Improve support for unterminated statements
Add support for implicit semicolons so many unterminated statements'
end are properly recognized.

The implementation doesn't follow the ECMAScript standard because doing
so requires to recognize precise grammar of all constructs, and the
parser doesn't currently work this way.  So instead it uses some
heuristics that should work most of the time and only consider implicit
semicolons where they would be explicitly relevant to avoid most false-
positives.  See the extensive comment in `readTokenFull()` for details.

In practice, this mostly fixes handling of files using unterminated
variable assignations like the following:

    var v1 = 0
    var v2 = 1
    // ...
    function f1() {
        // ...
    }

In such situations the parser used not to be able to really tell where
the variable assignation would end and would not recognize any
statement before the next semicolon or closing curly brace at the same
level.  In practice, it wouldn't have emitted any tag for this example,
not even `v1` as it generates tags when reaching the statement's end.
2014-11-24 02:57:38 +01:00
Colomban Wendling
f2b368e2cc javascript: Report function signature 2014-11-24 02:55:44 +01:00
Colomban Wendling
f65dec49e7 javascript: Fix more handling of class-related unterminated statements 2014-11-24 02:48:55 +01:00
Colomban Wendling
9c84a91bb3 javascript: Fix scope inside nested blocks (if/else/while/for/etc.) 2014-11-24 02:45:22 +01:00
Colomban Wendling
7e6215661e javascript: Fix handling some class-related unterminated statements 2014-11-24 02:43:29 +01:00
Colomban Wendling
5a1a22d930 javascript: Properly handle nested unknown blocks
Properly match open curly braces when parsing a statement not to
possibly get fooled by unexpected nested blocks, e.g. after a
`switch`'s `case` or a label.

This mostly reverts c54c3ad5e815d16e3b48f3c477465627808aadee and
replaces it with a more correct and complete solution.
2014-11-24 02:41:57 +01:00
Colomban Wendling
f158f5d362 javascript: Fix scope after some constructs 2014-11-24 02:41:17 +01:00
dfishburn
c54c3ad5e8 Added new method findMatchingToken() to skip over blocks of code. Updated parseSwitch() to use the new method.
Updated tests/ctags/ui5.ui.controller.js with code that broke the switch statement.

git-svn-id: https://svn.code.sf.net/p/ctags/code/trunk@809 c5d04d22-be80-434c-894e-aa346cc9e8e8
2014-11-24 01:48:04 +01:00
dfishburn
52d2d73527 Udated jscript to be able to parse SAPUI5 controller and view files.
Added test case tests/ctags/ui5.controller.js

git-svn-id: https://svn.code.sf.net/p/ctags/code/trunk@808 c5d04d22-be80-434c-894e-aa346cc9e8e8
2014-11-24 01:39:36 +01:00
Colomban Wendling
f765463af0 Import new CSS parser from fishman-ctags
Some highlights:
* Fixes handling of comments
* Adds support for attribute and namespace selectors
* Adds support for @supports blocks
* Fixes tag type for many selectors
* Adds support for pseudo-classes with arguments
2014-11-11 02:01:41 +01:00
Colomban Wendling
2072797283 Import CSS test cases from fishman-ctags 2014-11-11 01:59:12 +01:00
Colomban Wendling
0ed236db30 TM: Fix some test results after sort changes from 90944c77 2014-11-08 18:13:13 +01:00
Colomban Wendling
8341228ffa JavaScript: fix handling of parentheses around an rvalue
Properly skip parentheses around an rvalue, and then properly recognize
the surrounded value.  This allows to properly recognize e.g. rvalue
`({...})` as an object, or `(function(){})` as a function.  As the
implementation is tolerant regarding garbage after the statement,
function expressions called straight away (`(function(){})()`) are
implicitly supported.

This however removes support for the following invalid JavaScript
syntax that was previously supported as a function/method declaration:

	var func = () {}

This syntax is not present in the ECMA standard nor is supported by
popular JavaScript engines.

See:
 * http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf
   section 13, "Function Definition"
 * http://ecma262-5.com/ELS5_HTML.htm#Section_13
 * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions_and_function_scope#Defining_functions
2014-08-04 00:23:13 +02:00
Colomban Wendling
35e8fbbe28 JavaScript: fix handling of various missing semicolons in loops 2014-08-03 23:24:33 +02:00
Colomban Wendling
3ff01aeeb3 JavaScript: recognize assignation to a parenthesized expression 2014-08-03 19:07:59 +02:00
Colomban Wendling
b596aa14e8 JavaScript: don't choke when returning object literals 2014-08-03 16:57:26 +02:00
Colomban Wendling
bc9b2fa444 JavaScript: don't choke on array lists 2014-08-03 16:52:11 +02:00
SiegeLord
58f0a20bcc Rust: Update test sources to be valid Rust code. 2014-07-29 11:20:56 -04:00
SiegeLord
d9e569398a Rust: Add new comment handling test. 2014-07-29 11:14:34 -04:00
SiegeLord
cf9385c6d4 Rust: Add test for character literals. 2014-07-29 10:55:15 -04:00
SiegeLord
fba9d19ec7 Rust: Add a test for the new string lexer. 2014-07-29 09:34:04 -04:00
Colomban Wendling
d8aaa59f9a Python: fix parsing of variables assigned to triple quoted strings
Fixes #262.
2014-05-12 21:52:03 +02:00
Colomban Wendling
1514993a6a Fix generating distcheck on clean sources
There is no point in runner.sh depending on the generated Geany
executable, and this breaks running `make distcheck` before building
the sources, as the Geany executable doesn't exist yet.
2014-04-13 18:07:17 +02:00
SiegeLord
e4c6aa3d9c Rust: Add a test for leading 'priv'. 2014-04-02 13:42:30 -04:00
SiegeLord
e89c4af47c Rust: Add some more syntax examples to the CTags test file.
Also, made it compile again.
2014-04-02 13:05:57 -04:00
SiegeLord
2a80759a3a Rust: Update ctags tests.
Also, make them compile again with the Rust compiler.
2014-04-01 21:37:03 -04:00
Adam Hirst
5965b5ebd3 Fortran: add a few more test cases 2014-02-23 20:16:29 +01:00
Colomban Wendling
d8954bbf67 Fortran: add support for "len" and "kind" qualifiers
Test cases contributed by Adam Hirst, thanks.
2014-02-23 20:13:36 +01:00
Colomban Wendling
ed1dc50062 Fortran: allow keywords as names
Allow keywords for names of modules, programs, types, interfaces,
structures and enums.

Test case contributed by Adam Hirst, thanks.
2014-02-23 20:11:00 +01:00
Colomban Wendling
e47d45eb28 Fortran: fix handling of preprocessor directives on the first line
Fix a race initialization leading to incorrect handling of preprocessor
directives on the first input line.

Test case contributed by Adam Hirst, thanks.
2014-02-23 20:10:35 +01:00
Colomban Wendling
ef4c72501e Fortran: generate fake tags for anonymous structures, interfaces and enums
This allows both to show those anonymous elements, as well as giving a
parent to their children, fixing display in the symbols tree.
2014-02-23 20:02:55 +01:00
Colomban Wendling
9520e7f7d7 Fortran: parse Fortran 2003 enums
Allow for not-yet-standard enum naming using `:: name` syntax, see
http://docs.cray.com/books/S-3692-51/html-S-3692-51/z970507905n9123.html

Test cases contributed by Adam Hirst, thanks.
2014-02-23 20:01:30 +01:00
Colomban Wendling
329b2cb401 Fortran: don't generate tags for interface content 2014-02-23 19:38:34 +01:00
Colomban Wendling
5a67a4f64c Fortran: report interfaces 2014-02-18 19:33:39 +01:00
Colomban Wendling
29336ffed0 Fortran: display components 2014-02-18 19:11:47 +01:00
Colomban Wendling
362a5cc654 Fortran: properly report scope for programs, subroutines and types
To do this we change the internal types to only use types matched by
symbols_get_current_scope().  This is a bit of a hack, but the tag
types were already questionable and simply mapped to ones the
TagManager know.

This however merges Functions and Subroutines under the same top-level
item in the symbol list.
2014-02-18 19:04:37 +01:00
Colomban Wendling
7d76063282 Fortran: fix handling of pointer association operator
Test case contributed by Adam Hirst, thanks.

Closes #1030.
2014-02-17 23:17:35 +01:00
Adam Hirst
1c0fa99e1d Support F2003 array syntax and F2008 coarrays
Fortran 2003 allows '[' and ']' as array constructors in addition to
the legacy '(/' and '/)'. Fortran 2008 allows '[]' as part of a
CODIMENSION specifier, which can either be `codimension[]` in
the type-spec; or as either `variable[]` or `variable()[]` in
the entry-spec.

Credit to Colomban Wendling for the skipOverSquares logic, and
treating `codimension` as a special-case.

Last part of bug #1023.
2014-02-15 15:48:31 +01:00
Colomban Wendling
497bfaed46 Fortran: fix line continuation inside comments
Fix improperly handling '&' at the end of the first comment line after
a non-comment line as a line continuation.

Part of bug #1023.
2014-02-15 00:33:05 +01:00
Adam Hirst
e1b115ee52 Added tests for the inclusion of ASSOCIATE in the tag manager 2014-02-14 19:31:08 +01:00
Enrico Tröger
09c2315bc4 Change expected tag kind for Python imports in tests since the parser has changed
This fixes the tests which failed because I changed the parsing yesterday to
classify Python as externvars and not as namespace tags anymore.
2014-02-09 09:26:36 +01:00
Colomban Wendling
d40932ce4d C++: mitigate matching error on generics containing an expression
Mitigate parse error with generics like `foo<X<Y> x;` by avoiding
matching past a semicolon (";") or open curly brace ("{"), which
can't be part of the generic.  This isn't a proper fix, but mitigates
the impact of such constructs.
2014-01-23 14:17:43 +01:00
SiegeLord
416c3daecc Clean up Rust ctag tests and make them more comprehensive 2014-01-14 12:50:38 -05:00
Colomban Wendling
370666865b Add Rust tests to the makefile 2014-01-14 12:50:38 -05:00
dobkeratops
09cb24c7c7 Add Rust ctag tests 2014-01-14 12:50:38 -05:00
Colomban Wendling
a7884ee2f8 JavaScript: fix parsing of files starting with a shebang
Closes #1016.
2013-12-24 19:30:04 +01:00