goldstein 3.2.1 → 3.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ChangeLog +10 -0
- package/build/parser.cjs +45 -6
- package/package.json +2 -2
- package/packages/parser/index.js +15 -5
package/ChangeLog
CHANGED
package/build/parser.cjs
CHANGED
|
@@ -5040,11 +5040,19 @@ var extendParser = (keywords3) => {
|
|
|
5040
5040
|
parse: parse4
|
|
5041
5041
|
};
|
|
5042
5042
|
};
|
|
5043
|
-
var createParse = (parser) => (
|
|
5044
|
-
|
|
5045
|
-
|
|
5046
|
-
|
|
5047
|
-
|
|
5043
|
+
var createParse = (parser) => (source) => {
|
|
5044
|
+
const options = {
|
|
5045
|
+
ecmaVersion: "latest",
|
|
5046
|
+
sourceType: "module",
|
|
5047
|
+
locations: true
|
|
5048
|
+
};
|
|
5049
|
+
const result = parser.parse(source, options);
|
|
5050
|
+
const tokens = Array.from(parser.tokenizer(source, options));
|
|
5051
|
+
return {
|
|
5052
|
+
...result,
|
|
5053
|
+
tokens
|
|
5054
|
+
};
|
|
5055
|
+
};
|
|
5048
5056
|
|
|
5049
5057
|
// packages/operator/scopeflags.js
|
|
5050
5058
|
var SCOPE_TOP2 = 1;
|
|
@@ -5472,6 +5480,36 @@ function keywordImport(Parser3) {
|
|
|
5472
5480
|
};
|
|
5473
5481
|
}
|
|
5474
5482
|
|
|
5483
|
+
// packages/keyword-arrow/index.js
|
|
5484
|
+
function fn3(Parser3) {
|
|
5485
|
+
return class extends Parser3 {
|
|
5486
|
+
parseBlock(createNewLexicalScope, node, exitStrict) {
|
|
5487
|
+
if (createNewLexicalScope === void 0)
|
|
5488
|
+
createNewLexicalScope = true;
|
|
5489
|
+
if (node === void 0)
|
|
5490
|
+
node = this.startNode();
|
|
5491
|
+
node.body = [];
|
|
5492
|
+
this.eat(types$1.arrow);
|
|
5493
|
+
this.expect(types$1.braceL);
|
|
5494
|
+
if (createNewLexicalScope) {
|
|
5495
|
+
this.enterScope(0);
|
|
5496
|
+
}
|
|
5497
|
+
while (this.type !== types$1.braceR) {
|
|
5498
|
+
const stmt = this.parseStatement(null);
|
|
5499
|
+
node.body.push(stmt);
|
|
5500
|
+
}
|
|
5501
|
+
if (exitStrict) {
|
|
5502
|
+
this.strict = false;
|
|
5503
|
+
}
|
|
5504
|
+
this.next();
|
|
5505
|
+
if (createNewLexicalScope) {
|
|
5506
|
+
this.exitScope();
|
|
5507
|
+
}
|
|
5508
|
+
return this.finishNode(node, "BlockStatement");
|
|
5509
|
+
}
|
|
5510
|
+
};
|
|
5511
|
+
}
|
|
5512
|
+
|
|
5475
5513
|
// packages/goldstein/parser.js
|
|
5476
5514
|
var defaultKeywords = {
|
|
5477
5515
|
keywordFn: fn,
|
|
@@ -5483,10 +5521,11 @@ var defaultKeywords = {
|
|
|
5483
5521
|
keywordFreeze,
|
|
5484
5522
|
keywordIf: fn2,
|
|
5485
5523
|
keywordImport,
|
|
5524
|
+
keywordArrow: fn3,
|
|
5486
5525
|
stringInterpolation
|
|
5487
5526
|
};
|
|
5488
5527
|
var keywords2 = defaultKeywords;
|
|
5489
|
-
var parse3 = (source, keywords3 = defaultKeywords) => {
|
|
5528
|
+
var parse3 = (source, options, keywords3 = defaultKeywords) => {
|
|
5490
5529
|
const { parse: parse4 } = extendParser(Object.values(keywords3));
|
|
5491
5530
|
return parse4(source);
|
|
5492
5531
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "goldstein",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
|
|
6
6
|
"description": "JavaScript with no limits",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"lint": "madrun lint",
|
|
27
27
|
"fix:lint": "madrun fix:lint",
|
|
28
28
|
"build": "madrun build",
|
|
29
|
-
"
|
|
29
|
+
"wisdom": "madrun wisdom"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@putout/printer": "^1.16.0",
|
package/packages/parser/index.js
CHANGED
|
@@ -12,8 +12,18 @@ export const extendParser = (keywords) => {
|
|
|
12
12
|
};
|
|
13
13
|
};
|
|
14
14
|
|
|
15
|
-
const createParse = (parser) => (
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
const createParse = (parser) => (source) => {
|
|
16
|
+
const options = {
|
|
17
|
+
ecmaVersion: 'latest',
|
|
18
|
+
sourceType: 'module',
|
|
19
|
+
locations: true,
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const result = parser.parse(source, options);
|
|
23
|
+
const tokens = Array.from(parser.tokenizer(source, options));
|
|
24
|
+
|
|
25
|
+
return {
|
|
26
|
+
...result,
|
|
27
|
+
tokens,
|
|
28
|
+
};
|
|
29
|
+
};
|