@optique/core 0.8.0-dev.161 → 0.8.0-dev.164
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/dist/modifiers.cjs +40 -18
- package/dist/modifiers.js +40 -18
- package/package.json +1 -1
package/dist/modifiers.cjs
CHANGED
|
@@ -23,18 +23,29 @@ function optional(parser) {
|
|
|
23
23
|
}],
|
|
24
24
|
initialState: void 0,
|
|
25
25
|
parse(context) {
|
|
26
|
+
const innerState = typeof context.state === "undefined" ? parser.initialState : context.state[0];
|
|
26
27
|
const result = parser.parse({
|
|
27
28
|
...context,
|
|
28
|
-
state:
|
|
29
|
+
state: innerState
|
|
29
30
|
});
|
|
30
|
-
if (result.success)
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
31
|
+
if (result.success) {
|
|
32
|
+
if (result.next.state !== innerState || result.consumed.length === 0) return {
|
|
33
|
+
success: true,
|
|
34
|
+
next: {
|
|
35
|
+
...result.next,
|
|
36
|
+
state: [result.next.state]
|
|
37
|
+
},
|
|
38
|
+
consumed: result.consumed
|
|
39
|
+
};
|
|
40
|
+
return {
|
|
41
|
+
success: true,
|
|
42
|
+
next: {
|
|
43
|
+
...result.next,
|
|
44
|
+
state: context.state
|
|
45
|
+
},
|
|
46
|
+
consumed: result.consumed
|
|
47
|
+
};
|
|
48
|
+
}
|
|
38
49
|
if (result.consumed === 0) return {
|
|
39
50
|
success: true,
|
|
40
51
|
next: context,
|
|
@@ -110,18 +121,29 @@ function withDefault(parser, defaultValue, options) {
|
|
|
110
121
|
}],
|
|
111
122
|
initialState: void 0,
|
|
112
123
|
parse(context) {
|
|
124
|
+
const innerState = typeof context.state === "undefined" ? parser.initialState : context.state[0];
|
|
113
125
|
const result = parser.parse({
|
|
114
126
|
...context,
|
|
115
|
-
state:
|
|
127
|
+
state: innerState
|
|
116
128
|
});
|
|
117
|
-
if (result.success)
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
129
|
+
if (result.success) {
|
|
130
|
+
if (result.next.state !== innerState || result.consumed.length === 0) return {
|
|
131
|
+
success: true,
|
|
132
|
+
next: {
|
|
133
|
+
...result.next,
|
|
134
|
+
state: [result.next.state]
|
|
135
|
+
},
|
|
136
|
+
consumed: result.consumed
|
|
137
|
+
};
|
|
138
|
+
return {
|
|
139
|
+
success: true,
|
|
140
|
+
next: {
|
|
141
|
+
...result.next,
|
|
142
|
+
state: context.state
|
|
143
|
+
},
|
|
144
|
+
consumed: result.consumed
|
|
145
|
+
};
|
|
146
|
+
}
|
|
125
147
|
if (result.consumed === 0) return {
|
|
126
148
|
success: true,
|
|
127
149
|
next: context,
|
package/dist/modifiers.js
CHANGED
|
@@ -23,18 +23,29 @@ function optional(parser) {
|
|
|
23
23
|
}],
|
|
24
24
|
initialState: void 0,
|
|
25
25
|
parse(context) {
|
|
26
|
+
const innerState = typeof context.state === "undefined" ? parser.initialState : context.state[0];
|
|
26
27
|
const result = parser.parse({
|
|
27
28
|
...context,
|
|
28
|
-
state:
|
|
29
|
+
state: innerState
|
|
29
30
|
});
|
|
30
|
-
if (result.success)
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
31
|
+
if (result.success) {
|
|
32
|
+
if (result.next.state !== innerState || result.consumed.length === 0) return {
|
|
33
|
+
success: true,
|
|
34
|
+
next: {
|
|
35
|
+
...result.next,
|
|
36
|
+
state: [result.next.state]
|
|
37
|
+
},
|
|
38
|
+
consumed: result.consumed
|
|
39
|
+
};
|
|
40
|
+
return {
|
|
41
|
+
success: true,
|
|
42
|
+
next: {
|
|
43
|
+
...result.next,
|
|
44
|
+
state: context.state
|
|
45
|
+
},
|
|
46
|
+
consumed: result.consumed
|
|
47
|
+
};
|
|
48
|
+
}
|
|
38
49
|
if (result.consumed === 0) return {
|
|
39
50
|
success: true,
|
|
40
51
|
next: context,
|
|
@@ -110,18 +121,29 @@ function withDefault(parser, defaultValue, options) {
|
|
|
110
121
|
}],
|
|
111
122
|
initialState: void 0,
|
|
112
123
|
parse(context) {
|
|
124
|
+
const innerState = typeof context.state === "undefined" ? parser.initialState : context.state[0];
|
|
113
125
|
const result = parser.parse({
|
|
114
126
|
...context,
|
|
115
|
-
state:
|
|
127
|
+
state: innerState
|
|
116
128
|
});
|
|
117
|
-
if (result.success)
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
129
|
+
if (result.success) {
|
|
130
|
+
if (result.next.state !== innerState || result.consumed.length === 0) return {
|
|
131
|
+
success: true,
|
|
132
|
+
next: {
|
|
133
|
+
...result.next,
|
|
134
|
+
state: [result.next.state]
|
|
135
|
+
},
|
|
136
|
+
consumed: result.consumed
|
|
137
|
+
};
|
|
138
|
+
return {
|
|
139
|
+
success: true,
|
|
140
|
+
next: {
|
|
141
|
+
...result.next,
|
|
142
|
+
state: context.state
|
|
143
|
+
},
|
|
144
|
+
consumed: result.consumed
|
|
145
|
+
};
|
|
146
|
+
}
|
|
125
147
|
if (result.consumed === 0) return {
|
|
126
148
|
success: true,
|
|
127
149
|
next: context,
|