acorn-loose
Advanced tools
Comparing version 8.3.0 to 8.4.0
@@ -0,1 +1,13 @@ | ||
## 8.4.0 (2023-10-26) | ||
### Bug fixes | ||
Fix an issue where a slash after a call to a propery named the same as some keywords would be tokenized as a regular expression. | ||
Fix a bug where the parser would raise an error when an invalid escape was included in an identifier after a keyword. | ||
### New features | ||
Use a set of new, much more precise, TypeScript types. | ||
## 8.3.0 (2021-12-27) | ||
@@ -2,0 +14,0 @@ |
@@ -271,2 +271,3 @@ (function (global, factory) { | ||
this.toks.pos = pos; | ||
this.toks.containsEsc = false; | ||
var ch = this.input.charAt(pos - 1); | ||
@@ -1386,2 +1387,3 @@ this.toks.exprAllowed = !ch || /[[{(,;:?/*=+\-~!|&%^<>]/.test(ch) || | ||
if (!name) { return this.dummyIdent() } | ||
if (this.tok.type.keyword) { this.toks.type = acorn.tokTypes.name; } | ||
var node = this.startNode(); | ||
@@ -1536,3 +1538,33 @@ this.next(); | ||
// Acorn: Loose parser | ||
// | ||
// This module provides an alternative parser that exposes that same | ||
// interface as the main module's `parse` function, but will try to | ||
// parse anything as JavaScript, repairing syntax error the best it | ||
// can. There are circumstances in which it will raise an error and | ||
// give up, but they are very rare. The resulting AST will be a mostly | ||
// valid JavaScript AST (as per the [Mozilla parser API][api], except | ||
// that: | ||
// | ||
// - Return outside functions is allowed | ||
// | ||
// - Label consistency (no conflicts, break only to existing labels) | ||
// is not enforced. | ||
// | ||
// - Bogus Identifier nodes with a name of `"✖"` are inserted whenever | ||
// the parser got too confused to return anything meaningful. | ||
// | ||
// [api]: https://developer.mozilla.org/en-US/docs/SpiderMonkey/Parser_API | ||
// | ||
// The expected use for this is to *first* try `acorn.parse`, and only | ||
// if that fails switch to the loose parser. The loose parser might | ||
// parse badly indented code incorrectly, so **don't** use it as your | ||
// default parser. | ||
// | ||
// Quite a lot of acorn.js is duplicated here. The alternative was to | ||
// add a *lot* of extra cruft to that file, making it less readable | ||
// and slower. Copying and editing the code allowed me to make | ||
// invasive changes and simplifications without creating a complicated | ||
// tangle. | ||
acorn.defaultOptions.tabSize = 4; | ||
@@ -1548,4 +1580,2 @@ | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
})); |
@@ -7,2 +7,3 @@ { | ||
"module": "dist/acorn-loose.mjs", | ||
"types": "dist/acorn-loose.d.ts", | ||
"exports": { | ||
@@ -19,6 +20,8 @@ ".": [ | ||
}, | ||
"version": "8.3.0", | ||
"engines": {"node": ">=0.4.0"}, | ||
"version": "8.4.0", | ||
"engines": { | ||
"node": ">=0.4.0" | ||
}, | ||
"dependencies": { | ||
"acorn": "^8.5.0" | ||
"acorn": "^8.11.0" | ||
}, | ||
@@ -25,0 +28,0 @@ "maintainers": [ |
@@ -23,5 +23,3 @@ # Acorn loose parser | ||
bugs](https://github.com/acornjs/acorn/issues) or create pull requests | ||
on [github](https://github.com/acornjs/acorn). For questions and | ||
discussion, please use the [Tern discussion | ||
forum](https://discuss.ternjs.net). | ||
on [github](https://github.com/acornjs/acorn). | ||
@@ -28,0 +26,0 @@ ## Installation |
Sorry, the diff of this file is not supported yet
117643
8
2856
65
Updatedacorn@^8.11.0