Marijn Haverbeke
a1d2561cfa
Restore patch 9f7cb552648829796ab4d6836d08246e95f16b9d to original shape
...
And make loose parser handle stray class semicolons
Issue #190
2015-01-20 12:02:30 +01:00
Marijn Haverbeke
3e513fc6a8
Kill finishNodeAt in acorn_loose as well
...
Issue #200
2015-01-17 22:22:26 +01:00
Ingvar Stepanyan
6dee98d1b9
Adapt ES6 template handling to new tokenizer.
...
Avoid need for:
* extra `templates` array in favor of new `tokContext`;
* special location handling for first & last template elements;
* separate `_templateContinued` token in favor of same `_template`.
Adds:
* token types for backQuote and dollarBraceL instead of skipping them
so they can be handled (i.e. highlighted differently).
2015-01-17 22:21:22 +01:00
Marijn Haverbeke
0f55a53a7d
[loose parser] Fetch token before comment when tokenizer raises unterminated comment error
...
Closes #197
2015-01-13 22:18:55 +01:00
Marijn Haverbeke
1b8069e48c
Restore onToken functionality for loose parser
2015-01-13 09:53:42 +01:00
Ingvar Stepanyan
bc2e01aa03
Allow static as method name in class ( fixes #192 ).
...
Add uncommitted tests for #191 .
2015-01-09 15:31:01 +02:00
Ingvar Stepanyan
4d4a76588c
Parse assignment patterns in-place in certain contexts.
...
* Parsing assignables without extra transform step when possible (speed-up).
* Added support for shorthand defaults in such certain contexts (issue #181 ).
2015-01-08 20:19:48 +02:00
Marijn Haverbeke
0897901f1f
Slight cleanup of '/' disambiguation
...
Issue #189
2015-01-06 11:03:50 +01:00
Marijn Haverbeke
b6b085ac8e
Make tokenizer independent of parser (with regards to '/' disambiguation)
...
Issue #189
2015-01-06 10:58:52 +01:00
Marijn Haverbeke
459a169262
Make tests pass again for loose parser
...
Issue #181
2015-01-04 22:34:42 +01:00
Ingvar Stepanyan
0084ac14ae
Fixed #186 .
2014-12-30 13:42:37 +02:00
Ingvar Stepanyan
e37c07248e
Added optional support for hashbang directives.
...
Fixes #180 .
2014-12-17 19:58:38 +02:00
Marijn Haverbeke
97f4e9a026
[loose parser] Make unclosed objects / lists span to the start of the next node
...
That way, whitespace at their end is considered part of them,
and Tern can recognize when the cursor is inside of them.
2014-12-17 11:53:20 +01:00
Marijn Haverbeke
75b58c07d4
[loose parser] Improve autoclosing of expression lists
2014-12-15 17:32:38 +01:00
Marijn Haverbeke
6915519498
Give TemplateElements a narrower range
...
Issue #169
2014-12-11 17:44:45 +01:00
Marijn Haverbeke
91e5ac0fdd
Make loose parser parse template strings
2014-12-11 14:30:24 +01:00
Marijn Haverbeke
249e6961f8
Make tests pass for loose parser
...
Define Program node extent to be the whole program, make
both parser and the tests conform to this.
Fix a bunch of bugs in the loose parser's handling of corner
cases.
Issue #151
2014-11-12 17:05:19 +01:00
Ingvar Stepanyan
96ccdb05fa
Web-driver support for loose parser + small fixes.
...
* Added support for acorn_loose and grouped log to web-driver.
* Removed unused copy-pasted `parseTemplate` from loose parser.
* Throw non-SyntaxError errors immediately (as those are generic).
2014-11-12 16:19:16 +01:00
Ingvar Stepanyan
6bf8311061
Loose: fix #33 .
2014-11-12 16:19:16 +01:00
Ingvar Stepanyan
2419de74dc
Loose: Fix regex after tokenizer changes in #144 .
2014-11-12 16:19:16 +01:00
Ingvar Stepanyan
fc2e96fa01
Loose: respect optional semicolons in break/continue/class/import/export.
2014-11-12 16:19:16 +01:00
Ingvar Stepanyan
d4565fed53
Loose: ES6 import, export.
...
Removed "kind" from tests for ES6 import/export as it's
left only for backward compatibility.
2014-11-12 16:19:15 +01:00
Ingvar Stepanyan
4647f966eb
Loose: don't silently skip missed elements in expr list.
2014-11-12 16:19:15 +01:00
Ingvar Stepanyan
aa96edf769
Loose: support for-of without var.
2014-11-12 16:19:15 +01:00
Ingvar Stepanyan
1589a959fa
Loose: yield support.
2014-11-12 16:19:15 +01:00
Ingvar Stepanyan
bdce88c184
Loose: for-of statement.
2014-11-12 16:19:15 +01:00
Ingvar Stepanyan
992fc0503d
Loose: arrow functions.
2014-11-12 16:19:15 +01:00
Ingvar Stepanyan
ede10a079c
Loose: class support.
2014-11-12 16:19:15 +01:00
Ingvar Stepanyan
c6b6ef389e
Loose: Remove own tabSize initialization in favor of defaultOptions.
2014-11-12 16:19:15 +01:00
Ingvar Stepanyan
9cdc6809ce
Loose: fix pattern+defaults case in function params.
2014-11-12 16:19:15 +01:00
Ingvar Stepanyan
b46b53e149
Loose: implement object methods; expose processed options from acorn.
2014-11-12 16:19:15 +01:00
Ingvar Stepanyan
dda90580df
Loose: Added support for shorthand properties.
2014-11-12 16:19:15 +01:00
Ingvar Stepanyan
963a26e46f
Loose: Added support for let and const.
...
Fixes #146 .
2014-11-12 16:19:15 +01:00
Ingvar Stepanyan
4879af22d1
Loose: Added support for assignment patterns to expression and variables.
2014-11-12 16:19:15 +01:00
Ingvar Stepanyan
eba8a5646c
Loose: added support for holes in arrays (but disallows trailing comma).
2014-11-12 16:19:14 +01:00
Ingvar Stepanyan
a14a5c8192
Loose: Added support for rest parameters.
...
Includes correction of mistype ".." vs "...".
2014-11-12 16:19:14 +01:00
Ingvar Stepanyan
11ecb20e9e
Loose: ES6 function params support.
2014-11-12 16:19:14 +01:00
Ingvar Stepanyan
61d2067b2b
Loose: Added ParenthesizedExpression.
2014-11-12 16:19:13 +01:00
Marijn Haverbeke
437ce2d9be
[loose parser] Ignore shebang lines
...
Closes marijnh/tern#408
2014-10-21 12:35:06 +02:00
Mike Rennie
ad69446c0a
Make parse_dammit honour the 'ranges' option
...
Closes #140
2014-10-21 12:14:18 +02:00
Marijn Haverbeke
bdee9e8195
Make locations in loose parser consistent with those in regular parser
...
Issue #136
2014-10-08 12:35:57 +02:00
Marijn Haverbeke
49680b1c60
[loose parser] Take brace-line indentation into account for objlit closing heuristic
2014-09-22 15:15:12 +02:00
Marijn Haverbeke
39fa62e90f
[loose parser] Be slightly more agressive about heuristically closing object literals
2014-09-22 15:03:54 +02:00
Marijn Haverbeke
12cbfed34f
[loose parser] Don't omit unfinished object literal properties
2014-09-22 14:46:41 +02:00
Marijn Haverbeke
6c854ad221
[loose parser] Be more careful about calling resetTo
...
It will try to eat whitespace, and can thus raise an unterminated comment exception
Issue #375
2014-09-05 15:31:15 +02:00
Max Schaefer
1ca2115294
Remove unused local variables.
2014-08-21 18:10:48 +02:00
Marijn Haverbeke
69cadaa1e9
Add basic ES6 support in util/walk.js
2014-08-14 13:23:03 +02:00
Ingvar Stepanyan
ef045b9718
Remove copyToken from acorn_loose (not needed anymore).
2014-07-31 14:33:40 +03:00
Conrad Irwin
2de16b8cb0
[loose parser] Fix interpretation of f."
...
Before this the ast produced by parse_dammit crashed in the following
code, as Uglify correctly noticed that f."" is invalid.
sample = 'f."';
loose = require('acorn/acorn_loose');
uglify = require('uglify-js');
out = new uglify.OutputStream();
ast = loose.parse_dammit(sample);
ast = uglify.AST_Node.from_mozilla_ast(ast);
ast.print(out);
// TypeError: Cannot call method 'toString' of undefined
// member_exp.computed = false && member_exp.property == ""
console.log(out.toString());
After this the round-tripped AST looks like: `t.✖;"";`, which is
consistent with how `foo.{` is parsed.
I also considered making it parse as t[""], but as this only turns up in
the wild when people try to use multiline strings, I felt it was better
to be obviously wrong.
2014-04-17 23:03:18 +02:00
Marijn Haverbeke
4869ccfa55
Prevent loose parser from tripping on invalid regexps
...
Issue #39
2014-03-25 17:45:58 +01:00