@bablr/helpers 0.25.2 → 0.25.4
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/grammar.js +1 -1
- package/lib/trivia.js +11 -3
- package/package.json +1 -1
package/lib/grammar.js
CHANGED
|
@@ -135,7 +135,7 @@ const __buildDependentLanguages = (language, languages = new Map()) => {
|
|
|
135
135
|
languages.has(dependentLanguage.canonicalURL) &&
|
|
136
136
|
languages.get(dependentLanguage.canonicalURL) !== dependentLanguage
|
|
137
137
|
) {
|
|
138
|
-
throw new Error('url clash');
|
|
138
|
+
throw new Error('url clash: ' + dependentLanguage.canonicalURL);
|
|
139
139
|
}
|
|
140
140
|
|
|
141
141
|
__buildDependentLanguages(dependentLanguage, languages);
|
package/lib/trivia.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { Coroutine } from '@bablr/coroutine';
|
|
3
3
|
import { eat, eatMatch, mapProductions, o, r } from './grammar.js';
|
|
4
4
|
import { Matcher, Regex } from './symbols.js';
|
|
5
|
-
import { get, getCooked, getFlagsWithGap, nodeFlags } from '@bablr/agast-helpers/tree';
|
|
5
|
+
import { get, getCooked, getFlagsWithGap, getRoot, nodeFlags } from '@bablr/agast-helpers/tree';
|
|
6
6
|
import {
|
|
7
7
|
buildTreeNodeMatcher,
|
|
8
8
|
buildIdentifier,
|
|
@@ -95,12 +95,20 @@ export const triviaEnhancer = (
|
|
|
95
95
|
o({
|
|
96
96
|
matcher: wrappedMatcher,
|
|
97
97
|
props,
|
|
98
|
-
options: o({
|
|
98
|
+
options: o({
|
|
99
|
+
...(options?.value ?? {}),
|
|
100
|
+
allowEmpty: true,
|
|
101
|
+
suppressGap: true,
|
|
102
|
+
literal: true,
|
|
103
|
+
}),
|
|
99
104
|
matchTrailing: false,
|
|
100
105
|
}),
|
|
106
|
+
o({
|
|
107
|
+
suppressGap: true,
|
|
108
|
+
}),
|
|
101
109
|
);
|
|
102
110
|
|
|
103
|
-
returnValue = result?.value;
|
|
111
|
+
returnValue = result?.value || getRoot(result?.node);
|
|
104
112
|
break;
|
|
105
113
|
}
|
|
106
114
|
}
|