39 Commits

Author SHA1 Message Date
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
Marijn Haverbeke
38179fd855 Fix node boundaries for unexpected regular expressions
Closes #33
2013-02-28 19:28:20 +01:00
Marijn Haverbeke
87a6a5a8cd Clean up readNumber, fix parsing of '2.+2'
Issue #9
2013-01-30 16:38:31 +01:00
keeyipchan
44f7aff2b7 Add testAssert() for arbitrary tests; fix skinLineComments() passing off-by-1 character to onComment(slice(.., end)) 2013-01-27 10:09:06 +01:00
Marijn Haverbeke
cc5971f617 Formatting 2013-01-04 09:37:21 +01:00
Arian Stolwijk
f6e0182a3a Fixes sourceFile option.
When setting the .prototype.source the sourceFile variable is undefined, and
setting the sourceFile option doesn't change the .source property on the
prototype anymore.

By setting the .source property inside the node_loc_t constructor, the correct
sourceFile is set in the loc object.
2013-01-04 09:32:43 +01:00
Marijn Haverbeke
d36c70bbbf Add missing labels.pop() to allow re-using labels in a block
Issue #15
2012-11-22 10:11:00 +01:00
Marijn Haverbeke
5c44c13465 Make sure readInt doesn't try to read past len, if given
Issue #15
2012-11-22 10:07:19 +01:00
Marijn Haverbeke
5771c8b4b2 Add missing semicolon() calls to debugger and throw statement parsers
Issue #5
2012-11-22 09:48:01 +01:00
Marijn Haverbeke
74536b9eb7 Remove test that raised error from the JS engine's RegExp parser 2012-11-21 14:38:21 +01:00
Marijn Haverbeke
905124c291 Assign parenthesized expressions a range that includes the parens
This way, composite expressions that they are part of won't get bogus
unsyntactic substrings as their range (i.e. in '(1)+1', the binop expression
would span '1)+1').

Closes #14
2012-11-18 21:17:49 +01:00
Marijn Haverbeke
6b52dc8a84 Disallow newline after throw
Closes #11
2012-10-18 15:50:07 +02:00
Marijn Haverbeke
daefc220da Require a semicolon after do/while 2012-10-17 23:09:15 +02:00
Marijn Haverbeke
e3514627a4 Add funky newlines to nonASCIIwhitespace 2012-10-17 23:02:48 +02:00
Marijn Haverbeke
96d911a30f Properly parse 10. as a valid number
Closes #9
2012-10-12 23:34:11 +02:00
Marijn Haverbeke
0590d12240 Accept \0 in strings in strict mode
Closes #3
2012-10-03 22:18:52 +02:00
Marijn Haverbeke
0820a593a6 Handle break-to-labeled-non-loop
Closes #1
2012-10-03 10:25:53 +02:00
Marijn Haverbeke
5db60dcac9 Conform to Moz spec with regards to loc properties 2012-10-02 18:01:32 +02:00
Marijn Haverbeke
32e62f1cfc Partial parser comments 2012-10-02 10:14:57 +02:00
Marijn Haverbeke
03d95cda2c Make tests runnable under node 2012-09-24 11:50:03 +02:00
Marijn Haverbeke
587c790f7b Add esprima-derived tests, trivial benchmark 2012-09-24 11:42:01 +02:00