95 Commits

Author SHA1 Message Date
Ingvar Stepanyan
6eb177582d Fix export default declarations.
Closes #184.
2015-01-27 16:21:41 +02:00
Ingvar Stepanyan
e4a97ab877 Finalized destructuring support in loose parser; fixed startNodeAt. 2015-01-27 15:53:16 +02:00
Ingvar Stepanyan
5d96bbd781 Simplify & fix rest argument validity checks. 2015-01-24 13:38:14 +02:00
Ingvar Stepanyan
f0569147e6 Avoid extra call and arg in parseExpression for single-expression case. 2015-01-23 21:48:33 +02:00
Ingvar Stepanyan
41ad304955 Introduce helpers for contextual keywords. 2015-01-23 21:36:16 +02:00
Ingvar Stepanyan
917de714b1 Switch from Function.{rest,defaults} to AssignmentPattern and RestElement.
Closes #182.
2015-01-23 15:29:37 +02:00
Ingvar Stepanyan
38609ae26d Closes #205. 2015-01-23 14:14:02 +02:00
Ingvar Stepanyan
2e55540bbe Fix {start,end}Loc -> loc.{start,end} in acorn_loose; remove forceRegexp. 2015-01-22 18:53:45 +02:00
Ingvar Stepanyan
caa5da6ce1 Improve spread element parsing (fix allowed contexts and error locations). 2015-01-21 23:51:40 +02:00
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