12158 Commits

Author SHA1 Message Date
Ingvar Stepanyan
2db14fbb08 Checking argument names clash in strict mode for arrow functions.
Some more testFail message fixes.
2014-07-29 14:41:08 +02:00
Ingvar Stepanyan
47c4196d41 Some testFail message fixes. 2014-07-29 14:41:08 +02:00
Ingvar Stepanyan
16b9ba5db0 Fixed parsing x => 1, 2 like expressions. 2014-07-29 14:41:08 +02:00
Ingvar Stepanyan
757545a612 Basic ES6 Arrow Expressions support.
Added Property type to ObjectExpression properties.
Reserved ES6 properties in Property type.
2014-07-29 14:41:08 +02:00
Ingvar Stepanyan
12ac95732d Added ES6-specific Function properties. 2014-07-29 14:41:08 +02:00
Ingvar Stepanyan
839338b270 Added octal and binary number support; added ES6 version checks. 2014-07-29 14:41:08 +02:00
Ingvar Stepanyan
a31bad6773 ES6 Unicode Code Point Escape Sequence support. 2014-07-29 14:41:08 +02:00
Ingvar Stepanyan
47587e6e9b Turned on location tracking for harmony tests. 2014-07-29 14:41:08 +02:00
Ingvar Stepanyan
88e355a6ae Converted esprima's harmony tests. 2014-07-29 14:41:08 +02:00
Ingvar Stepanyan
937350dd84 Updated esprima and added harmonytest.js from ariya/esprima@2bb17ef9a4. 2014-07-29 14:41:08 +02:00
Marijn Haverbeke
7ac7d8fa5e Add an AUTHORS list 2014-07-29 14:33:33 +02:00
Marijn Haverbeke
14bd14088a Remove bogus copy-pasted chunk from LICENSE 2014-07-29 12:37:36 +02:00
Johannes Herr
3d35d067a8 Removed some dead code in parseThrowStatement 2014-07-24 15:51:00 +02:00
Marijn Haverbeke
3d444e8eca Update docco output for df9eda514ad804258ec84ee437b88493b41be299 2014-07-15 18:35:09 +02:00
Mathias Bynens
df9eda514a Add a script that generates the regular expressions for identifiers 2014-07-15 18:33:01 +02:00
Marijn Haverbeke
caeaf37c31 Fix another bogus piece of code from 31e77b975ed0bf14f68f9b0f6608bbe78d694bf0 2014-06-17 11:08:12 +02:00
Marijn Haverbeke
c1b2742ee7 Bump version number post 0.6 2014-06-06 22:42:22 +02:00
Marijn Haverbeke
4435013900 Mark version 0.6.0 2014-06-06 22:42:03 +02:00
impinball
29feccf3cd Split up parseStatement()
It was purely interpreted by the V8 engine. Splitting it up allows the
individual pieces to be optimized, so less is interpreted.
2014-06-06 12:40:32 +02:00
Marijn Haverbeke
55b507b715 Note partial es6 support in docs 2014-06-06 12:11:20 +02:00
Artem Govorov
1e5bfc2c55 ecma 6 partial support: let and const 2014-06-06 12:10:09 +02:00
Marijn Haverbeke
3a34f7ba8c Add note about browser compatibility to README
Closes #105
2014-06-04 22:51:05 +02:00
Marijn Haverbeke
7f0f07e1f9 Check duplicate argument names for rest params
Issue #79
2014-05-28 23:24:10 +02:00
PlNG
dccd45528a Minor: Remove unused argument from readToken_slash
Possible dev relic.

readToken_slash currently does not have any arguments and does not appear to look at arguments. All existing tests pass after removal of extraneous argument while calling readToken_slash.
2014-05-28 22:27:41 +02:00
Marijn Haverbeke
5dcd50447b Clean up previous patch
Issue #100
2014-05-15 10:38:28 +02:00
impinball
31e77b975e Add option: --
Had a few bugs in the initial patch request (#98) as well...

Also, fixed the help() command to print to stderr on nonzero exit statuses given.
2014-05-15 10:32:32 +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
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
Charles Hughes
6f41a2215d Updates license year 2014-03-25 17:50:49 +01:00
Marijn Haverbeke
4869ccfa55 Prevent loose parser from tripping on invalid regexps
Issue #39
2014-03-25 17:45:58 +01:00
Marijn Haverbeke
93124c9eb8 Don't export Node from loose parser, reuse existing Node's proto
Issue #92
2014-03-25 17:31:03 +01:00
Marijn Haverbeke
e5439847fd Rename remaining *_t constructors to something sane 2014-03-25 17:29:17 +01:00
David Bonnet
7b9a46710d Renamed node_t to Node and exported it
This is to let programmers extend the Node object with utility methods
2014-03-25 17:23:30 +01:00
Marijn Haverbeke
e282ee4c01 Bump version number post-0.5 2014-03-12 17:32:17 +01:00
Marijn Haverbeke
a09455d2bf Mark version 0.5 2014-03-12 17:25:55 +01:00
Peter Rust
954ddac8b9 [walker] Supply ancestors to visitor functions 2014-02-28 17:53:39 +01: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
716ade22fb Add allowReturnOutsideFunction option
Issue #86
2014-02-14 09:55:05 +01:00
Marijn Haverbeke
d55b6dee4a Update lastEnd in tokenizer interface
The hack for parsing --> depends on it.

Closes #84
2014-01-17 10:09:15 +01:00
Marijn Haverbeke
d973261940 [loose parser] Make sure VariableDeclaration nodes have at least one decl
Closes marijnh/tern#255
2013-12-09 17:55:16 +01:00
Marijn Haverbeke
e6ff440e9f [walker] Handle catch scopes more accurately in scopeVisitor 2013-11-28 16:56:14 +01:00
Marijn Haverbeke
b1623b10c1 Note non-reentrancy of parser in onComment docs
Closes #80
2013-11-20 10:59:12 +01:00
Marijn Haverbeke
baaa16cee7 Make sure syntax errors in regular expressions raise conforming exceptions
Just letting the error from new RegExp through creates an exception missing the
pos/loc/raisedAt properties.

Issue #82
Issue #81
2013-11-20 10:56:28 +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
cb79f13d3d [README] Search/replace gone bad 2013-11-04 16:53:28 +01:00
Marijn Haverbeke
6be7a84649 Work around broken Markdown implementation on github
Not that I can blame anyone for making mistakes implementing a
poorly specified mess like markdown.
2013-11-04 16:52:34 +01:00
Marijn Haverbeke
5ec47cf80d Rewrite README 2013-11-04 16:43:07 +01:00
Aparajita Fishman
3b05fcf16c docco is wonderful, but it isn't exactly the most concise way of figuring out how to use acorn. Here's a real README.
Fixed a typo in the options comments.
2013-11-04 15:39:22 +01:00
Marijn Haverbeke
456f099cbe Bump version for added option 2013-10-15 13:12:07 +02:00
Marijn Haverbeke
356e0be759 Add directSourceFile option 2013-10-15 13:08:56 +02:00