diff --git a/demo/autocomplete.html b/demo/autocomplete.html index 36c31cdfe..e4b206d1a 100644 --- a/demo/autocomplete.html +++ b/demo/autocomplete.html @@ -61,10 +61,9 @@

Esprima

  • - Documentation + Documentation
  • diff --git a/demo/collector.html b/demo/collector.html index 5e91bd6c6..e21a64661 100644 --- a/demo/collector.html +++ b/demo/collector.html @@ -61,10 +61,9 @@

    Esprima

  • - Documentation + Documentation
  • diff --git a/demo/functiontrace.html b/demo/functiontrace.html index 323c14218..01cc58da9 100644 --- a/demo/functiontrace.html +++ b/demo/functiontrace.html @@ -61,10 +61,9 @@

    Esprima

  • - Documentation + Documentation
  • diff --git a/demo/highlight.html b/demo/highlight.html index 6d7dea488..2f5e53e47 100644 --- a/demo/highlight.html +++ b/demo/highlight.html @@ -61,10 +61,9 @@

    Esprima

  • - Documentation + Documentation
  • diff --git a/demo/index.html b/demo/index.html index 89a416e4b..ab630fe06 100644 --- a/demo/index.html +++ b/demo/index.html @@ -60,10 +60,9 @@

    Esprima

  • - Documentation + Documentation
  • diff --git a/demo/minify.html b/demo/minify.html index 0911fb509..c8551582c 100644 --- a/demo/minify.html +++ b/demo/minify.html @@ -61,10 +61,9 @@

    Esprima

  • - Documentation + Documentation
  • diff --git a/demo/parse.html b/demo/parse.html index c813cca8a..792dce335 100644 --- a/demo/parse.html +++ b/demo/parse.html @@ -74,10 +74,9 @@

    Esprima

  • - Documentation + Documentation
  • diff --git a/demo/precedence.html b/demo/precedence.html index 1c790d097..92fef903f 100644 --- a/demo/precedence.html +++ b/demo/precedence.html @@ -99,10 +99,9 @@

    Esprima

  • - Documentation + Documentation
  • diff --git a/demo/rename.html b/demo/rename.html index 1bf8e4213..feb394947 100644 --- a/demo/rename.html +++ b/demo/rename.html @@ -61,10 +61,9 @@

    Esprima

  • - Documentation + Documentation
  • diff --git a/demo/rewrite.html b/demo/rewrite.html index cf2cbbd90..ea04d349b 100644 --- a/demo/rewrite.html +++ b/demo/rewrite.html @@ -61,10 +61,9 @@

    Esprima

  • - Documentation + Documentation
  • diff --git a/demo/validate.html b/demo/validate.html index fa0d1b132..0bd2884ba 100644 --- a/demo/validate.html +++ b/demo/validate.html @@ -61,10 +61,9 @@

    Esprima

  • - Documentation + Documentation
  • diff --git a/doc/changes.html b/doc/changes.html index 3e61c3e6d..de85fd24d 100644 --- a/doc/changes.html +++ b/doc/changes.html @@ -73,10 +73,9 @@

    Esprima

  • - Documentation + Documentation
  • diff --git a/doc/compatibility.html b/doc/compatibility.html index 6fa69dc4e..011b546ff 100644 --- a/doc/compatibility.html +++ b/doc/compatibility.html @@ -6,6 +6,7 @@ Esprima: Compatibility + @@ -73,10 +74,9 @@

    Esprima

  • - Documentation + Documentation
  • @@ -96,37 +96,7 @@

    Compatibility Information

    - -

    Browser Implementation Compatibility

    - -

    In a certain specific case, Esprima intentially does not throw an exception (indicating - a parsing error) although the input being parsed contains an invalid syntax. - This is to achieve implementation compatibility with major web browsers. - For further details, refer to the official - ECMAScript 2015 - Language Specification, Section B.3.3 on Block-Level Function - Declarations Web Legacy Compatibility Semantics:

    - -
    - Prior to ECMAScript 2015, the ECMAScript specification did not define the occurrence of - a FunctionDeclaration as an element of a Block statement’s StatementList. - However, support for that form of FunctionDeclaration was an allowable extension and most - browser-hosted ECMAScript implementations permitted them. -
    - -

    This is illustrated in the following simple example:

    - -
    -var syntax = esprima.parse('if (x) function y() {}');
    -
    - -

    In the above example, Esprima returns a syntax tree for the code - (see the result).

    - -

    According to the specification, declaring a function inside the block - of an If statement is not possible. Yet, this is permitted in web browsers - such as Firefox, Chrome, and many others.

    - +

    Please read the documentation on Browser Compatibility.

    diff --git a/doc/es6.html b/doc/es6.html index 700b38b5b..1f8580931 100644 --- a/doc/es6.html +++ b/doc/es6.html @@ -73,10 +73,9 @@

    Esprima

  • - Documentation + Documentation
  • @@ -97,185 +96,11 @@

    ECMAScript 6 with Esprima

    -

    From version 2.0, Esprima starts to support new features in ECMAScript 6.

    - -

    Arrow Function

    - -

    Since: version 2.0. Specification: section 14.2.

    - -

    Example code snippet:

    - -
    -array.map(x => x * x)
    -
    - - -

    The corresponding syntax tree:

    - -
    -{
    -    "type": "Program",
    -    "body": [
    -        {
    -            "type": "ExpressionStatement",
    -            "expression": {
    -                "type": "CallExpression",
    -                "callee": {
    -                    "type": "MemberExpression",
    -                    "computed": false,
    -                    "object": {
    -                        "type": "Identifier",
    -                        "name": "array"
    -                    },
    -                    "property": {
    -                        "type": "Identifier",
    -                        "name": "map"
    -                    }
    -                },
    -                "arguments": [
    -                    {
    -                        "type": "ArrowFunctionExpression",
    -                        "id": null,
    -                        "params": [
    -                            {
    -                                "type": "Identifier",
    -                                "name": "x"
    -                            }
    -                        ],
    -                        "defaults": [],
    -                        "body": {
    -                            "type": "BinaryExpression",
    -                            "operator": "*",
    -                            "left": {
    -                                "type": "Identifier",
    -                                "name": "x"
    -                            },
    -                            "right": {
    -                                "type": "Identifier",
    -                                "name": "x"
    -                            }
    -                        },
    -                        "rest": null,
    -                        "generator": false,
    -                        "expression": true
    -                    }
    -                ]
    -            }
    -        }
    -    ]
    -}
    -
    - -

    Default Parameter Value

    - -

    Since: version 2.0. Specification: section 14.1.

    - -

    Example code snippet:

    - -
    -function answer(x = 42) { say(x); }
    -
    - -

    The corresponding syntax tree:

    - -
    -{
    -    "type": "Program",
    -    "body": [
    -        {
    -            "type": "FunctionDeclaration",
    -            "id": {
    -                "type": "Identifier",
    -                "name": "answer"
    -            },
    -            "params": [
    -                {
    -                    "type": "Identifier",
    -                    "name": "x"
    -                }
    -            ],
    -            "defaults": [
    -                {
    -                    "type": "Literal",
    -                    "value": 42,
    -                    "raw": "42"
    -                }
    -            ],
    -            "body": {
    -                "type": "BlockStatement",
    -                "body": [
    -                    {
    -                        "type": "ExpressionStatement",
    -                        "expression": {
    -                            "type": "CallExpression",
    -                            "callee": {
    -                                "type": "Identifier",
    -                                "name": "say"
    -                            },
    -                            "arguments": [
    -                                {
    -                                    "type": "Identifier",
    -                                    "name": "x"
    -                                }
    -                            ]
    -                        }
    -                    }
    -                ]
    -            },
    -            "rest": null,
    -            "generator": false,
    -            "expression": false
    -        }
    -    ]
    -}
    -
    - -

    Unicode Code Point Escape Sequence

    -

    Since: version 2.0. Specification: section 11.8.4.

    - -

    Example code snippet:

    - -
    -x = '\u{41}'
    -
    - -

    The corresponding syntax tree:

    - -
    -{
    -    "type": "Program",
    -    "body": [
    -        {
    -            "type": "ExpressionStatement",
    -            "expression": {
    -                "type": "AssignmentExpression",
    -                "operator": "=",
    -                "left": {
    -                    "type": "Identifier",
    -                    "name": "x"
    -                },
    -                "right": {
    -                    "type": "Literal",
    -                    "value": "A",
    -                    "raw": "'\\u{41}'"
    -                }
    -            }
    -        }
    -    ]
    -}
    -
    +

    Please read the documentation on the Syntax Tree Format.

    -

    Note: Partial ES6 support also exists in the experimental harmony branch. However, this branch has never been officially released and the features are not documented.

    diff --git a/doc/index.html b/doc/index.html index c264b8ea4..758565c49 100644 --- a/doc/index.html +++ b/doc/index.html @@ -6,6 +6,7 @@ Esprima Documentation + @@ -73,10 +74,9 @@

    Esprima

  • - Documentation + Documentation
  • diff --git a/doc/videos.html b/doc/videos.html index 8d74f3ae1..f47acf5b6 100644 --- a/doc/videos.html +++ b/doc/videos.html @@ -60,10 +60,9 @@

    Esprima

  • - Documentation + Documentation
  • diff --git a/index.html b/index.html index c7af24b03..b14575efd 100644 --- a/index.html +++ b/index.html @@ -71,10 +71,9 @@

    Esprima

  • - Documentation + Documentation
  • diff --git a/test/benchmarks.html b/test/benchmarks.html index 7ff0be128..544c905c5 100644 --- a/test/benchmarks.html +++ b/test/benchmarks.html @@ -60,10 +60,9 @@

    Esprima

  • - Documentation + Documentation
  • diff --git a/test/ci.html b/test/ci.html index 924632972..c048c80f9 100644 --- a/test/ci.html +++ b/test/ci.html @@ -60,10 +60,9 @@

    Esprima

  • - Documentation + Documentation
  • diff --git a/test/compare.html b/test/compare.html index 092913c61..638120972 100644 --- a/test/compare.html +++ b/test/compare.html @@ -71,10 +71,9 @@

    Esprima

  • - Documentation + Documentation
  • diff --git a/test/coverage.html b/test/coverage.html index b0885d2f7..69147ee1a 100644 --- a/test/coverage.html +++ b/test/coverage.html @@ -62,10 +62,9 @@

    Esprima

  • - Documentation + Documentation
  • diff --git a/test/index.html b/test/index.html index dd5456e39..4609d5458 100644 --- a/test/index.html +++ b/test/index.html @@ -61,10 +61,9 @@

    Esprima

  • - Documentation + Documentation
  • diff --git a/test/module.html b/test/module.html index 58d9cad8a..8b9e067bc 100644 --- a/test/module.html +++ b/test/module.html @@ -60,10 +60,9 @@

    Esprima

  • - Documentation + Documentation