pacc 9.2.1 → 9.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/package.json +1 -1
- package/src/parser.mjs +2 -5
- package/src/tokens.mjs +4 -0
package/package.json
CHANGED
package/src/parser.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import { tokens, EOF } from "./tokens.mjs";
|
|
|
3
3
|
export function parseOnly(input, context = {}) {
|
|
4
4
|
input = tokens(input, context);
|
|
5
5
|
|
|
6
|
-
let
|
|
6
|
+
let token, value;
|
|
7
7
|
|
|
8
8
|
function advance() {
|
|
9
9
|
const next = input.next();
|
|
@@ -18,9 +18,6 @@ export function parseOnly(input, context = {}) {
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
const parser = {
|
|
21
|
-
get node() {
|
|
22
|
-
return node;
|
|
23
|
-
},
|
|
24
21
|
get token() {
|
|
25
22
|
return token;
|
|
26
23
|
},
|
|
@@ -40,7 +37,7 @@ export function parseOnly(input, context = {}) {
|
|
|
40
37
|
expression(precedence) {
|
|
41
38
|
const last = token;
|
|
42
39
|
advance();
|
|
43
|
-
node = last.nud(parser);
|
|
40
|
+
let node = last.nud(parser);
|
|
44
41
|
|
|
45
42
|
while (token.precedence > precedence) {
|
|
46
43
|
const last = token;
|
package/src/tokens.mjs
CHANGED
|
@@ -393,6 +393,10 @@ export const globals = {
|
|
|
393
393
|
const data = evalOne(args[0], current, context);
|
|
394
394
|
const length = evalOne(args[1], current, context);
|
|
395
395
|
|
|
396
|
+
if(data instanceof Iterator) {
|
|
397
|
+
return data.take(length);
|
|
398
|
+
}
|
|
399
|
+
|
|
396
400
|
data.length = length;
|
|
397
401
|
return data;
|
|
398
402
|
}
|