@bablr/helpers 0.1.5 → 0.1.7
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/lib/decorators.js +7 -0
- package/lib/productions.generated.js +1 -0
- package/lib/productions.js +2 -0
- package/lib/symbols.js +0 -5
- package/lib/trivia.js +6 -1
- package/package.json +1 -1
package/lib/decorators.js
CHANGED
|
@@ -1 +1,8 @@
|
|
|
1
1
|
export * from '@bablr/boot-helpers/decorators';
|
|
2
|
+
|
|
3
|
+
export const UnboundAttributes = (attributes) => (desc, context) => {
|
|
4
|
+
context.addInitializer(function () {
|
|
5
|
+
this.unboundAttributes = this.unboundAttributes || new Map();
|
|
6
|
+
this.unboundAttributes.set(context.name, attributes);
|
|
7
|
+
});
|
|
8
|
+
};
|
package/lib/productions.js
CHANGED
package/lib/symbols.js
CHANGED
|
@@ -1,6 +1 @@
|
|
|
1
1
|
export const node = Symbol.for('@bablr/node');
|
|
2
|
-
|
|
3
|
-
export const active = Symbol.for('@bablr/active');
|
|
4
|
-
export const suspended = Symbol.for('@bablr/suspended');
|
|
5
|
-
export const accepted = Symbol.for('@bablr/accepted');
|
|
6
|
-
export const rejected = Symbol.for('@bablr/rejected');
|
package/lib/trivia.js
CHANGED
|
@@ -22,6 +22,8 @@ export const triviaEnhancer = ({ triviaIsAllowed, eatMatchTrivia }, grammar) =>
|
|
|
22
22
|
|
|
23
23
|
co.advance();
|
|
24
24
|
|
|
25
|
+
let isTerminal = false;
|
|
26
|
+
|
|
25
27
|
try {
|
|
26
28
|
while (!co.done) {
|
|
27
29
|
const instr = co.value;
|
|
@@ -53,6 +55,7 @@ export const triviaEnhancer = ({ triviaIsAllowed, eatMatchTrivia }, grammar) =>
|
|
|
53
55
|
yield eatMatchTrivia;
|
|
54
56
|
matchedResults.add(s.result);
|
|
55
57
|
}
|
|
58
|
+
isTerminal = true;
|
|
56
59
|
}
|
|
57
60
|
|
|
58
61
|
returnValue = returnValue || (yield instr);
|
|
@@ -67,7 +70,7 @@ export const triviaEnhancer = ({ triviaIsAllowed, eatMatchTrivia }, grammar) =>
|
|
|
67
70
|
co.advance(returnValue);
|
|
68
71
|
}
|
|
69
72
|
|
|
70
|
-
if (!
|
|
73
|
+
if (!isTerminal) {
|
|
71
74
|
const previous = lookbehind(ctx, s);
|
|
72
75
|
if (triviaIsAllowed(s) && !matchedResults.has(previous)) {
|
|
73
76
|
matchedResults.add(previous);
|
|
@@ -75,6 +78,8 @@ export const triviaEnhancer = ({ triviaIsAllowed, eatMatchTrivia }, grammar) =>
|
|
|
75
78
|
matchedResults.add(s.result);
|
|
76
79
|
}
|
|
77
80
|
}
|
|
81
|
+
|
|
82
|
+
return co.value;
|
|
78
83
|
} catch (e) {
|
|
79
84
|
co.throw(e);
|
|
80
85
|
throw e;
|