From 1ed25992a783f4ea26ef0549b4320989391aa456 Mon Sep 17 00:00:00 2001 From: Marijn Haverbeke Date: Thu, 10 Oct 2013 10:40:31 +0200 Subject: [PATCH] Mark release 0.4 --- acorn.js | 2 +- index.html | 16 ++++++++++------ package.json | 2 +- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/acorn.js b/acorn.js index 945439c5c3..e3214dc6d0 100644 --- a/acorn.js +++ b/acorn.js @@ -27,7 +27,7 @@ })(this, function(exports) { "use strict"; - exports.version = "0.3.2"; + exports.version = "0.4.0"; // The main exported interface (under `self.acorn` when in the // browser) is a `parse` function that takes a code string and diff --git a/index.html b/index.html index b7569c8947..6aa2bb6dc7 100644 --- a/index.html +++ b/index.html @@ -21,7 +21,7 @@ with a error-tolerant parser and an })(this, function(exports) { "use strict"; - exports.version = "0.3.2";

The main exported interface (under self.acorn when in the + exports.version = "0.4.0";

The main exported interface (under self.acorn when in the browser) is a parse function that takes a code string and returns an abstract syntax tree as specified by Mozilla parser API, with the caveat that the SpiderMonkey-specific syntax @@ -333,8 +333,10 @@ whitespace and comments, and.

} } else if (ch === 10 || ch === 8232 || ch === 8233) { ++tokPos; - ++tokCurLine; - tokLineStart = tokPos; + if (options.locations) { + ++tokCurLine; + tokLineStart = tokPos; + } } else if (ch > 8 && ch < 14) { ++tokPos; } else if (ch === 47) { // '/' @@ -690,9 +692,11 @@ precedence levels that JavaScript defines.

  function setStrict(strct) {
     strict = strct;
     tokPos = lastEnd;
-    while (tokPos < tokLineStart) {
-      tokLineStart = input.lastIndexOf("\n", tokLineStart - 2) + 1;
-      --tokCurLine;
+    if (options.locations) {
+      while (tokPos < tokLineStart) {
+        tokLineStart = input.lastIndexOf("\n", tokLineStart - 2) + 1;
+        --tokCurLine;
+      }
     }
     skipSpace();
     readToken();
diff --git a/package.json b/package.json
index f2fb071f2e..d923c9a9cc 100644
--- a/package.json
+++ b/package.json
@@ -3,7 +3,7 @@
     "description": "ECMAScript parser",
     "homepage": "http://marijnhaverbeke.nl/acorn/",
     "main": "acorn.js",
-    "version": "0.3.2",
+    "version": "0.4.0",
     "engines": {"node": ">=0.4.0"},
     "maintainers": [{"name": "Marijn Haverbeke",
                      "email": "marijnh@gmail.com",