70 Commits

Author SHA1 Message Date
Sebastian McKenzie
0ca73d2474 add comment attachment to the parser and remove dead acorn options 2015-07-21 01:13:07 +01:00
Sebastian McKenzie
2007469305 remove dead babylon code 2015-07-15 18:07:13 +01:00
Sebastian McKenzie
b21db8a37e finish removal of ecmaVersion option 2015-07-15 16:41:32 +01:00
Sebastian McKenzie
e9d0e55c39 sync tests with upstream acorn 2015-07-14 15:15:36 +01:00
Sebastian McKenzie
423d8c510d Begin transition of Babel to a more scalable architecture, async flow to allow for RPC and better build system for multiple packages 2015-07-11 12:39:54 +01:00
Sebastian McKenzie
ddd173a4b3 restructure testing infrastructure to be more modular 2015-03-28 01:21:48 +11:00
Logan Smyth
01b39d67f0 Merge acorn 1.0.0 (formerly 'update to modular acorn' in original history). 2016-03-14 22:47:51 -07:00
Logan Smyth
16e8224ce6 Merge acorn 0.12.1 and acorn-babel (formerly "embed acorn" in the original git history). 2016-03-14 22:39:24 -07:00
Marijn Haverbeke
a45172e044 Unify checkLVal and checkFunctionParam 2015-03-19 13:42:26 +01:00
Marijn Haverbeke
ba750b253b Replace strictSemicolons and allowTrailingCommas with onInsertedSemicolon and onTrailingComma 2015-03-12 22:02:41 +01:00
Ingvar Stepanyan
34050d3917 Support for for (const ...).
Fixes #213.

Also changes API to pass token type to `parseVar` to reduce string comparison ops.
2015-03-10 11:36:15 +02:00
Marijn Haverbeke
891d5d07dd Allow braced \u escapes in identifiers
We still can't properly recognize code points as ES6-style
identifier chars.

Issue #214
2015-03-04 15:37:26 +01: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
cb94a0851c Add regex comparison to test driver. 2015-01-23 13:50:01 +02:00
Ingvar Stepanyan
e6f1e1027e Fix dividing function expression.
Fixes #204.
2015-01-23 13:17:03 +02:00
Ingvar Stepanyan
d1f95ece42 Revert "Disallow parentheses in lvalue except as in computed keys or default values."
This reverts commit 85087f2a0951f60ca035ca6d785e4bab6d96d8f7.
Fixes #193.
2015-01-12 20:31:38 +02:00
Ingvar Stepanyan
85087f2a09 Disallow parentheses in lvalue except as in computed keys or default values. 2015-01-08 23:00:22 +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
e271168cf6 Make onToken only fire for actual final tokens
Issue #189
2015-01-04 22:27:03 +01:00
Ingvar Stepanyan
e37c07248e Added optional support for hashbang directives.
Fixes #180.
2014-12-17 19:58:38 +02:00
Ingvar Stepanyan
51bc64a558 Update tests for #158 2014-11-19 20:23:38 +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
ac8bdc608d Allow specifying expected comments/tokens arrays with onComment/onToken.
Allows to avoid both custom `testAssert` and adding extra arguments in `test`.
2014-11-12 16:19:14 +01:00
Ingvar Stepanyan
6d64834352 Removed manual onComment test in favor of new argument. 2014-11-12 16:19:14 +01:00
Sebastian McKenzie
f48503cd31 add unicode flag support to regex 2014-10-27 10:51:23 +01:00
Max Schaefer
d525c45644 Add option for representing parenthesized expressions in the AST. 2014-10-13 12:19:39 +02:00
Marijn Haverbeke
3603f7d0b1 Adjust start positions of parenthesized expressions to not include parentheses
Issue #136
2014-10-08 11:52:49 +02:00
r-e-d
f3e759cd03 Strict mode incorrectly reset after function 2014-09-30 11:45:20 +02:00
Max Schaefer
015a0e90bc Only accept for-of loops in ECMA6 mode. 2014-09-29 11:27:14 +02:00
Ingvar Stepanyan
10553cbced Make token format compatible with Esprima and Mozilla-styled locations.
* Tokens are now instances of single exported constructor Token.
* Token objects are compatible with Esprima (only `type` format is different).
* Added token.loc in format of node.loc (Mozilla).
* Deprecated token.startLoc & token.endLoc.
* Updated comment generation example.

Also added ability to pass arrays in `onToken`/`onComment` where
tokens/comments will be collected in Esprima's format so you can
simply pass those arrays to `escodegen.attachComments`.

Updated docs and comment attachment example.
2014-09-08 12:20:08 +02:00
Max Schaefer
a246bf83d0 Do not throw syntax error if strict mode function has same name as one of its parameters. 2014-09-05 15:59:57 +02:00
Max Schaefer
7da3b6f1fd Fix start position for HTML comments and add tests. 2014-09-05 15:53:36 +02:00
Ingvar Stepanyan
1bf8c1420f Added example for comments attachment.
* Fixed `onToken` & `tokenize` to return `startLoc` & `endLoc`
in token object only when `options.locations` is `true`.
* Fixed `onToken` tests.
* Added example for generating comments with escodegen.
2014-07-31 14:01:39 +03:00
Ingvar Stepanyan
be11e04383 Added onToken support. 2014-07-31 14:01:39 +03:00
Ingvar Stepanyan
dd37866fdb Added backward-compatible test that object properties have type of "Property".
(Better fix for Constellation/estraverse#4, Constellation/escodegen#80 and similar bugs)
2014-07-29 14:41:10 +02:00
Ingvar Stepanyan
648f3159cc Added for (..of..) support and guard against for (let var=.. in|of ..) loops. 2014-07-29 14:41:09 +02:00
Ingvar Stepanyan
47c4196d41 Some testFail message fixes. 2014-07-29 14:41:08 +02:00
Ingvar Stepanyan
88e355a6ae Converted esprima's harmony tests. 2014-07-29 14:41:08 +02:00
Artem Govorov
1e5bfc2c55 ecma 6 partial support: let and const 2014-06-06 12:10:09 +02:00
Brandon Mills
5552e866f9 Support rest parameters
http://wiki.ecmascript.org/doku.php?id=harmony:rest_parameters
The final parameter to a function is a rest parameter if it is
prefixed by "...". FunctionExpression and FunctionDeclaration
nodes have a new "rest" property that is null if there is no
rest parameter, or contains an Identifer for the parameter.
https://developer.mozilla.org/en-US/docs/SpiderMonkey/Parser_API#Functions

Implemented by adding a new token, `_ellipsis`, which consists of
three dots. Modified the body of parseFunction to allow a single
rest parameter at the end of an argument list. Both the token and
the rest parameter require `options.ecmaVersion` >= 6, otherwise
three dots are tokenized as three dots.
2014-05-08 07:46:47 +02:00
Marijn Haverbeke
5bd50cce6f Don't complain about reserved words in property name position
Also add forbidReserved: "everywhere" support.

Issue #85
2014-02-14 11:27:48 +01:00
Marijn Haverbeke
dd456e3ad5 Fix bug causing comments after 'use strict' to be handled twice
Closes #76
2013-11-11 11:25:59 +01:00
Marijn Haverbeke
22c3161b6e Fix wrong end position for VariableDeclaration nodes
It should include the semicolon.

Closes #67
2013-10-02 20:39:51 +02:00
Marijn Haverbeke
b998d5e22d Add support for bizarro <!-- and --> behavior
Issue #62
2013-09-06 10:52:04 +02:00
Marijn Haverbeke
6659f7a033 Fix special case to handle regexps that start with =
Closes #55
2013-08-28 10:35:21 +02:00
Marijn Haverbeke
6113324cd2 Fix bug with parsing slash after operator-keyword property
Closes #53
2013-08-25 15:01:20 +02:00
Marijn Haverbeke
38f0e80547 Include diacritical combining marks in identifier character set
Closes marijn/tern#157
2013-05-21 09:07:50 +02:00
Marijn Haverbeke
62bc3641af Use a single .handler property on TryStatements
As the wiki page for the spec currently seems to prescribe.
2013-04-02 09:30:35 +02:00
Marijn Haverbeke
54e78b7035 Properly back up line state when re-reading a token on strict mode
Issue #38
2013-03-25 15:10:55 +01:00