You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by da...@apache.org on 2019/12/18 18:15:49 UTC

[couchdb-esprima] branch 1.x created (now 7ce371c)

This is an automated email from the ASF dual-hosted git repository.

davisp pushed a change to branch 1.x
in repository https://gitbox.apache.org/repos/asf/couchdb-esprima.git.


      at 7ce371c  Update ChangeLog for 1.2.3.

This branch includes the following new commits:

     new 6e21781  Branch 1.x is for 1.3 development.
     new e7ec3f6  Ensure that the Program node may still have leading comments.
     new 26b3d27  Update ChangeLog for 1.2.1.
     new dae7122  Update Travis CI Node.js versions (0.8, 0.10, 0.11).
     new a900ed4  The test runner should ignore the property order in a node.
     new b224725  Fix duplicate tokens peeked by attachComments.
     new 374961f  Update ChangeLog for 1.2.2.
     new 2ce034c  Issue 546: Tests cannot be run on Windows
     new 313d012  Fix division by "this"
     new 7ce371c  Update ChangeLog for 1.2.3.

The 10 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[couchdb-esprima] 03/10: Update ChangeLog for 1.2.1.

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davisp pushed a commit to branch 1.x
in repository https://gitbox.apache.org/repos/asf/couchdb-esprima.git

commit 26b3d276204fe175550d83a15b9883180970abf4
Author: Ariya Hidayat <ar...@gmail.com>
AuthorDate: Sun May 4 11:31:06 2014 -0700

    Update ChangeLog for 1.2.1.
    
    https://code.google.com/p/esprima/issues/detail?id=514
---
 ChangeLog | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index d3a663f..35dbaf4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2014-05-04: Version 1.2.1
+
+      * Ensure that Program node may still have leading comments (issue 536)
+
 2014-04-29: Version 1.2.0
 
       * Fix semicolon handling for expression statement (issue 462, 533)


[couchdb-esprima] 09/10: Fix division by "this"

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davisp pushed a commit to branch 1.x
in repository https://gitbox.apache.org/repos/asf/couchdb-esprima.git

commit 313d012ac65d84c7aaba871925dbedad49119444
Author: Edward Faulkner <ef...@alum.mit.edu>
AuthorDate: Tue Dec 9 16:47:35 2014 -0500

    Fix division by "this"
    
    `this / 100` is legal Javascript, and a variation of it actually appears
    in moment.js.
    
    Without this fix, esprima treats it as an un-terminated regular
    expression.
    
    https://code.google.com/p/esprima/issues/detail?id=616
---
 esprima.js   |  2 +-
 test/test.js | 76 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 76 insertions(+), 2 deletions(-)

diff --git a/esprima.js b/esprima.js
index 2a60ad6..a442276 100644
--- a/esprima.js
+++ b/esprima.js
@@ -1260,7 +1260,7 @@ parseStatement: true, parseSourceElement: true */
             }
             return collectRegex();
         }
-        if (prevToken.type === 'Keyword') {
+        if (prevToken.type === 'Keyword' && prevToken.value !== 'this') {
             return collectRegex();
         }
         return scanPunctuator();
diff --git a/test/test.js b/test/test.js
index 2e5831c..f8c8636 100644
--- a/test/test.js
+++ b/test/test.js
@@ -21840,8 +21840,82 @@ var testFixture = {
             lineNumber: 1,
             column: 8,
             message: 'Error: Line 1: Invalid regular expression: missing /'
-        }
+        },
 
+        'this / 100;': [
+          {
+            "type": "Keyword",
+            "value": "this",
+            "range": [
+              0,
+              4
+            ],
+            "loc": {
+              "start": {
+                "line": 1,
+                "column": 0
+              },
+              "end": {
+                "line": 1,
+                "column": 4
+              }
+            }
+          },
+          {
+            "type": "Punctuator",
+            "value": "/",
+            "range": [
+              5,
+              6
+            ],
+            "loc": {
+              "start": {
+                "line": 1,
+                "column": 5
+              },
+              "end": {
+                "line": 1,
+                "column": 6
+              }
+            }
+          },
+          {
+            "type": "Numeric",
+            "value": "100",
+            "range": [
+              7,
+              10
+            ],
+            "loc": {
+              "start": {
+                "line": 1,
+                "column": 7
+              },
+              "end": {
+                "line": 1,
+                "column": 10
+              }
+            }
+          },
+          {
+            "type": "Punctuator",
+            "value": ";",
+            "range": [
+              10,
+              11
+            ],
+            "loc": {
+              "start": {
+                "line": 1,
+                "column": 10
+              },
+              "end": {
+                "line": 1,
+                "column": 11
+              }
+            }
+          }
+        ]
     },
 
     'API': {


[couchdb-esprima] 05/10: The test runner should ignore the property order in a node.

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davisp pushed a commit to branch 1.x
in repository https://gitbox.apache.org/repos/asf/couchdb-esprima.git

commit a900ed4988fca50ec20490177fe5e7c35775b7b6
Author: Ariya Hidayat <ar...@gmail.com>
AuthorDate: Sun May 18 22:32:41 2014 -0700

    The test runner should ignore the property order in a node.
    
    This is a backport (from master to 1.x branch) of portion of issue #530.
    
    https://code.google.com/p/esprima/issues/detail?id=544
---
 test/runner.js | 32 ++++++++++++++++++++++++++++++--
 1 file changed, 30 insertions(+), 2 deletions(-)

diff --git a/test/runner.js b/test/runner.js
index b0fa069..fe71f3d 100644
--- a/test/runner.js
+++ b/test/runner.js
@@ -71,6 +71,32 @@ function errorToObject(e) {
     };
 }
 
+function sortedObject(o) {
+    if (o === null) {
+        return o;
+    }
+    if (o instanceof Array) {
+        return o.map(sortedObject);
+    }
+    if (typeof o !== 'object') {
+        return o;
+    }
+    if (o instanceof RegExp) {
+        return o;
+    }
+    var keys = Object.keys(o);
+    var result = {
+        range: undefined,
+        loc: undefined
+    };
+    keys.forEach(function (key) {
+        if (o.hasOwnProperty(key)){
+            result[key] = sortedObject(o[key]);
+        }
+    });
+    return result;
+}
+
 function hasAttachedComment(syntax) {
     var key;
     for (key in syntax) {
@@ -125,6 +151,7 @@ function testParse(esprima, code, syntax) {
         options.source = syntax.loc.source;
     }
 
+    syntax = sortedObject(syntax);
     expected = JSON.stringify(syntax, null, 4);
     try {
         // Some variations of the options.
@@ -140,7 +167,7 @@ function testParse(esprima, code, syntax) {
                 tree.errors[i] = errorToObject(tree.errors[i]);
             }
         }
-
+        tree = sortedObject(tree);
         actual = JSON.stringify(tree, adjustRegexLiteral, 4);
 
         // Only to ensure that there is no error when using string object.
@@ -168,6 +195,7 @@ function testParse(esprima, code, syntax) {
     // Check again without any location info.
     options.range = false;
     options.loc = false;
+    syntax = sortedObject(syntax);
     expected = JSON.stringify(syntax, filter, 4);
     try {
         tree = esprima.parse(code, options);
@@ -178,7 +206,7 @@ function testParse(esprima, code, syntax) {
                 tree.errors[i] = errorToObject(tree.errors[i]);
             }
         }
-
+        tree = sortedObject(tree);
         actual = JSON.stringify(tree, filter, 4);
     } catch (e) {
         throw new NotMatchingError(expected, e.toString());


[couchdb-esprima] 08/10: Issue 546: Tests cannot be run on Windows

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davisp pushed a commit to branch 1.x
in repository https://gitbox.apache.org/repos/asf/couchdb-esprima.git

commit 2ce034c3e65e44bf370fe85e96ae9f185e0e4f42
Author: mrennie <Mi...@ca.ibm.com>
AuthorDate: Thu May 22 00:16:20 2014 -0400

    Issue 546: Tests cannot be run on Windows
    
    https://code.google.com/p/esprima/issues/detail?id=546
---
 package.json | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package.json b/package.json
index 37ebaa8..530a104 100644
--- a/package.json
+++ b/package.json
@@ -66,7 +66,7 @@
         "lint": "npm run-script check-version && npm run-script eslint && npm run-script jscs && npm run-script jslint",
         "check-version": "node tools/check-version.js",
         "eslint": "node node_modules/eslint/bin/eslint.js esprima.js",
-        "jscs": "node node_modules/.bin/jscs esprima.js",
+        "jscs": "node node_modules/jscs/bin/jscs esprima.js",
         "jslint": "node node_modules/jslint/bin/jslint.js esprima.js",
 
         "coverage": "npm run-script analyze-coverage && npm run-script check-coverage",


[couchdb-esprima] 04/10: Update Travis CI Node.js versions (0.8, 0.10, 0.11).

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davisp pushed a commit to branch 1.x
in repository https://gitbox.apache.org/repos/asf/couchdb-esprima.git

commit dae7122b22919f72f7059179d8323bd02b65115b
Author: Ariya Hidayat <ar...@gmail.com>
AuthorDate: Sun May 4 11:45:45 2014 -0700

    Update Travis CI Node.js versions (0.8, 0.10, 0.11).
    
    https://code.google.com/p/esprima/issues/detail?id=317
---
 .travis.yml | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/.travis.yml b/.travis.yml
index da1b80b..5ae5f47 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,5 +1,6 @@
 language: node_js
 node_js:
+  - 0.11
+  - 0.10
   - 0.8
-  - 0.9
 


[couchdb-esprima] 10/10: Update ChangeLog for 1.2.3.

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davisp pushed a commit to branch 1.x
in repository https://gitbox.apache.org/repos/asf/couchdb-esprima.git

commit 7ce371c844b4d14899f1b2f0e3d16b3ebf1ce821
Author: Ariya Hidayat <ar...@gmail.com>
AuthorDate: Sun Jan 18 10:13:52 2015 -0800

    Update ChangeLog for 1.2.3.
    
    https://code.google.com/p/esprima/issues/detail?id=514
---
 ChangeLog | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 8c342ff..a5c94ae 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2015-01-18: Version 1.2.3
+
+      * Fix division by this (issue 616)
+
 2014-05-18: Version 1.2.2
 
       * Fix duplicated tokens when collecting comments (issue 537)


[couchdb-esprima] 02/10: Ensure that the Program node may still have leading comments.

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davisp pushed a commit to branch 1.x
in repository https://gitbox.apache.org/repos/asf/couchdb-esprima.git

commit e7ec3f6e0d2abb2db9caa9a61dd4cafc12f4447f
Author: Ariya Hidayat <ar...@gmail.com>
AuthorDate: Sat May 3 21:20:02 2014 -0700

    Ensure that the Program node may still have leading comments.
    
    https://code.google.com/p/esprima/issues/detail?id=536
---
 esprima.js   |  7 +++++--
 test/test.js | 28 ++++++++++++++++++++++++++++
 2 files changed, 33 insertions(+), 2 deletions(-)

diff --git a/esprima.js b/esprima.js
index 5e808f6..84a5e98 100644
--- a/esprima.js
+++ b/esprima.js
@@ -1394,8 +1394,11 @@ parseStatement: true, parseSourceElement: true */
 
         processComment: function (node) {
             var lastChild, trailingComments;
-            if (typeof node.type === 'undefined' || node.type === Syntax.Program) {
-                return;
+
+            if (node.type === Syntax.Program) {
+                if (node.body.length > 0) {
+                    return;
+                }
             }
 
             peek();
diff --git a/test/test.js b/test/test.js
index cbd7b2a..5523b4a 100644
--- a/test/test.js
+++ b/test/test.js
@@ -4037,6 +4037,34 @@ var testFixture = {
             }]
         },
 
+        '// one\\n': {
+            type: 'Program',
+            body: [],
+            range: [8, 8],
+            loc: {
+                start: { line: 1, column: 8 },
+                end: { line: 1, column: 8 }
+            },
+            leadingComments: [{
+                type: 'Line',
+                value: ' one\\n',
+                range: [0, 8],
+                loc: {
+                    start: { line: 1, column: 0 },
+                    end: { line: 1, column: 8 }
+                }
+            }],
+            comments: [{
+                type: 'Line',
+                value: ' one\\n',
+                range: [0, 8],
+                loc: {
+                    start: { line: 1, column: 0 },
+                    end: { line: 1, column: 8 }
+                }
+            }]
+        },
+
         '// line comment\n42': {
             type: 'ExpressionStatement',
             expression: {


[couchdb-esprima] 07/10: Update ChangeLog for 1.2.2.

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davisp pushed a commit to branch 1.x
in repository https://gitbox.apache.org/repos/asf/couchdb-esprima.git

commit 374961fac6df6a0811c718d323f41647abdeeff1
Author: Ariya Hidayat <ar...@gmail.com>
AuthorDate: Sun May 18 22:39:33 2014 -0700

    Update ChangeLog for 1.2.2.
    
    https://code.google.com/p/esprima/issues/detail?id=514
---
 ChangeLog | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 35dbaf4..8c342ff 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2014-05-18: Version 1.2.2
+
+      * Fix duplicated tokens when collecting comments (issue 537)
+
 2014-05-04: Version 1.2.1
 
       * Ensure that Program node may still have leading comments (issue 536)


[couchdb-esprima] 06/10: Fix duplicate tokens peeked by attachComments.

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davisp pushed a commit to branch 1.x
in repository https://gitbox.apache.org/repos/asf/couchdb-esprima.git

commit b2247253d3b063bcb04666263c3cf38fad358f51
Author: Bei Zhang <ik...@gmail.com>
AuthorDate: Wed May 7 09:11:08 2014 -0700

    Fix duplicate tokens peeked by attachComments.
    
    https://code.google.com/p/esprima/issues/detail?id=537
---
 esprima.js   |   2 -
 test/test.js | 281 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 279 insertions(+), 4 deletions(-)

diff --git a/esprima.js b/esprima.js
index 84a5e98..2a60ad6 100644
--- a/esprima.js
+++ b/esprima.js
@@ -1401,8 +1401,6 @@ parseStatement: true, parseSourceElement: true */
                 }
             }
 
-            peek();
-
             if (extra.trailingComments.length > 0) {
                 if (extra.trailingComments[0].range[0] >= node.range[1]) {
                     trailingComments = extra.trailingComments;
diff --git a/test/test.js b/test/test.js
index 5523b4a..2e5831c 100644
--- a/test/test.js
+++ b/test/test.js
@@ -3423,9 +3423,287 @@ var testFixture = {
                         46
                     ]
                 }
+            ],
+            "tokens": [
+                {
+                    "type": "Numeric",
+                    "range": [
+                        0,
+                        2
+                    ],
+                    "value": "42"
+                }
+            ]
+        },
+
+        'var p1;/* block comment 1 */ /* block comment 2 */': {
+            "range": [
+                0,
+                7
+            ],
+            "loc": {
+                "start": {
+                    "line": 1,
+                    "column": 0
+                },
+                "end": {
+                    "line": 1,
+                    "column": 7
+                }
+            },
+            "type": "Program",
+            "body": [
+                {
+                    "range": [
+                        0,
+                        7
+                    ],
+                    "loc": {
+                        "start": {
+                            "line": 1,
+                            "column": 0
+                        },
+                        "end": {
+                            "line": 1,
+                            "column": 7
+                        }
+                    },
+                    "type": "VariableDeclaration",
+                    "declarations": [
+                        {
+                            "range": [
+                                4,
+                                6
+                            ],
+                            "loc": {
+                                "start": {
+                                    "line": 1,
+                                    "column": 4
+                                },
+                                "end": {
+                                    "line": 1,
+                                    "column": 6
+                                }
+                            },
+                            "type": "VariableDeclarator",
+                            "id": {
+                                "range": [
+                                    4,
+                                    6
+                                ],
+                                "loc": {
+                                    "start": {
+                                        "line": 1,
+                                        "column": 4
+                                    },
+                                    "end": {
+                                        "line": 1,
+                                        "column": 6
+                                    }
+                                },
+                                "type": "Identifier",
+                                "name": "p1"
+                            },
+                            "init": null
+                        }
+                    ],
+                    "kind": "var",
+                    "trailingComments": [
+                        {
+                            "range": [
+                                7,
+                                28
+                            ],
+                            "loc": {
+                                "start": {
+                                    "line": 1,
+                                    "column": 7
+                                },
+                                "end": {
+                                    "line": 1,
+                                    "column": 28
+                                }
+                            },
+                            "type": "Block",
+                            "value": " block comment 1 "
+                        },
+                        {
+                            "range": [
+                                29,
+                                50
+                            ],
+                            "loc": {
+                                "start": {
+                                    "line": 1,
+                                    "column": 29
+                                },
+                                "end": {
+                                    "line": 1,
+                                    "column": 50
+                                }
+                            },
+                            "type": "Block",
+                            "value": " block comment 2 "
+                        }
+                    ]
+                }
+            ],
+            "comments": [
+                {
+                    "range": [
+                        7,
+                        28
+                    ],
+                    "loc": {
+                        "start": {
+                            "line": 1,
+                            "column": 7
+                        },
+                        "end": {
+                            "line": 1,
+                            "column": 28
+                        }
+                    },
+                    "type": "Block",
+                    "value": " block comment 1 "
+                },
+                {
+                    "range": [
+                        29,
+                        50
+                    ],
+                    "loc": {
+                        "start": {
+                            "line": 1,
+                            "column": 29
+                        },
+                        "end": {
+                            "line": 1,
+                            "column": 50
+                        }
+                    },
+                    "type": "Block",
+                    "value": " block comment 2 "
+                }
+            ],
+            "tokens": [
+                {
+                    "range": [
+                        0,
+                        3
+                    ],
+                    "loc": {
+                        "start": {
+                            "line": 1,
+                            "column": 0
+                        },
+                        "end": {
+                            "line": 1,
+                            "column": 3
+                        }
+                    },
+                    "type": "Keyword",
+                    "value": "var"
+                },
+                {
+                    "range": [
+                        4,
+                        6
+                    ],
+                    "loc": {
+                        "start": {
+                            "line": 1,
+                            "column": 4
+                        },
+                        "end": {
+                            "line": 1,
+                            "column": 6
+                        }
+                    },
+                    "type": "Identifier",
+                    "value": "p1"
+                },
+                {
+                    "range": [
+                        6,
+                        7
+                    ],
+                    "loc": {
+                        "start": {
+                            "line": 1,
+                            "column": 6
+                        },
+                        "end": {
+                            "line": 1,
+                            "column": 7
+                        }
+                    },
+                    "type": "Punctuator",
+                    "value": ";"
+                }
             ]
         },
 
+        '/*42*/': {
+            "range": [
+                6,
+                6
+            ],
+            "loc": {
+                "start": {
+                    "line": 1,
+                    "column": 6
+                },
+                "end": {
+                    "line": 1,
+                    "column": 6
+                }
+            },
+            "type": "Program",
+            "body": [],
+            "leadingComments": [
+                {
+                    "range": [
+                        0,
+                        6
+                    ],
+                    "loc": {
+                        "start": {
+                            "line": 1,
+                            "column": 0
+                        },
+                        "end": {
+                            "line": 1,
+                            "column": 6
+                        }
+                    },
+                    "type": "Block",
+                    "value": "42"
+                }
+            ],
+            "comments": [
+                {
+                    "range": [
+                        0,
+                        6
+                    ],
+                    "loc": {
+                        "start": {
+                            "line": 1,
+                            "column": 0
+                        },
+                        "end": {
+                            "line": 1,
+                            "column": 6
+                        }
+                    },
+                    "type": "Block",
+                    "value": "42"
+                }
+            ],
+            "tokens": []
+        },
+
         '(a + /* assignmenr */b ) * c': {
             "type": "Program",
             "body": [
@@ -21808,8 +22086,7 @@ var testFixture = {
             type: 'Boolean',
             value: 'true'
           }]
-        },
-
+        }
     },
 
     'Tolerant parse': {


[couchdb-esprima] 01/10: Branch 1.x is for 1.3 development.

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davisp pushed a commit to branch 1.x
in repository https://gitbox.apache.org/repos/asf/couchdb-esprima.git

commit 6e21781afa2f3457eed5e752df29831eee148503
Author: Ariya Hidayat <ar...@gmail.com>
AuthorDate: Tue Apr 29 22:21:35 2014 -0700

    Branch 1.x is for 1.3 development.
    
    https://code.google.com/p/esprima/issues/detail?id=535
---
 bower.json     | 2 +-
 component.json | 2 +-
 esprima.js     | 2 +-
 package.json   | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/bower.json b/bower.json
index 5f30728..04994b7 100644
--- a/bower.json
+++ b/bower.json
@@ -1,6 +1,6 @@
 {
     "name": "esprima",
-    "version": "1.2.0",
+    "version": "1.3.0-dev",
     "main": "./esprima.js",
     "scripts": [
         "esprima.js"
diff --git a/component.json b/component.json
index c5c47cb..d8a4ef8 100644
--- a/component.json
+++ b/component.json
@@ -1,6 +1,6 @@
 {
     "name": "esprima",
-    "version": "1.2.0",
+    "version": "1.3.0-dev",
     "main": "./esprima.js",
     "scripts": [
         "esprima.js"
diff --git a/esprima.js b/esprima.js
index 0015a66..5e808f6 100644
--- a/esprima.js
+++ b/esprima.js
@@ -3723,7 +3723,7 @@ parseStatement: true, parseSourceElement: true */
     }
 
     // Sync with *.json manifests.
-    exports.version = '1.2.0';
+    exports.version = '1.3.0-dev';
 
     exports.tokenize = tokenize;
 
diff --git a/package.json b/package.json
index 7aef110..37ebaa8 100644
--- a/package.json
+++ b/package.json
@@ -7,7 +7,7 @@
         "esparse": "./bin/esparse.js",
         "esvalidate": "./bin/esvalidate.js"
     },
-    "version": "1.2.0",
+    "version": "1.3.0-dev",
     "files": [
         "bin",
         "test/run.js",