dorian 2.4.0 → 2.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +15 -0
- data/.github/workflows/ci.yml +38 -0
- data/.gitignore +30 -0
- data/.node-version +1 -0
- data/.prettierignore +2 -0
- data/.rubocop.yml +129 -0
- data/.ruby-version +1 -0
- data/.tool-versions +3 -0
- data/Gemfile +20 -0
- data/Gemfile.lock +186 -0
- data/LICENSE +19 -0
- data/README.md +24 -0
- data/VERSION +1 -1
- data/bin/bundle +123 -0
- data/bin/bundle-audit +31 -0
- data/bin/bundler-audit +31 -0
- data/bin/rspec +31 -0
- data/bin/rubocop +31 -0
- data/dorian.gemspec +35 -0
- data/lib/dorian/bin.rb +739 -81
- data/package-lock.json +39 -0
- data/package.json +11 -0
- data/samples/books.json +33 -0
- data/samples/books.jsonl +3 -0
- data/samples/config.yml +27 -0
- data/samples/config_2.yml +22 -0
- data/samples/maths.js +1 -0
- data/samples/numbers.raw +10 -0
- data/samples/people.csv +6 -0
- data/samples/people.yml +28 -0
- data/samples/query.sql +7 -0
- data/samples/user.json +31 -0
- data/spec/dorian_spec.rb +276 -0
- data/spec/spec_helper.rb +3 -0
- data/vendor/groovy-beautify/LICENSE.MD +21 -0
- data/vendor/groovy-beautify/README.md +65 -0
- data/vendor/groovy-beautify/dist/__tests__/index.test.d.ts +1 -0
- data/vendor/groovy-beautify/dist/cjs/index.js +573 -0
- data/vendor/groovy-beautify/dist/cjs/package.json +3 -0
- data/vendor/groovy-beautify/dist/es/index.js +682 -0
- data/vendor/groovy-beautify/dist/es/package.json +3 -0
- data/vendor/groovy-beautify/dist/formatter/FormatRule.d.ts +14 -0
- data/vendor/groovy-beautify/dist/formatter/Formatter.d.ts +11 -0
- data/vendor/groovy-beautify/dist/formatter/GroovyFormatRules.d.ts +3 -0
- data/vendor/groovy-beautify/dist/formatter/__tests__/formatter.test.d.ts +1 -0
- data/vendor/groovy-beautify/dist/index.d.ts +5 -0
- data/vendor/groovy-beautify/dist/parser/GroovyParseRules.d.ts +3 -0
- data/vendor/groovy-beautify/dist/parser/ParseRule.d.ts +23 -0
- data/vendor/groovy-beautify/dist/parser/Parser.d.ts +29 -0
- data/vendor/groovy-beautify/dist/parser/__tests__/parser.test.d.ts +1 -0
- data/vendor/groovy-beautify/dist/parser/types.d.ts +6 -0
- data/vendor/groovy-beautify/dist/utils/text.d.ts +4 -0
- data/vendor/groovy-beautify/package.json +55 -0
- data/vendor/prettier/LICENSE +4379 -0
- data/vendor/prettier/README.md +109 -0
- data/vendor/prettier/bin/prettier.cjs +71 -0
- data/vendor/prettier/doc.d.ts +243 -0
- data/vendor/prettier/doc.js +1545 -0
- data/vendor/prettier/doc.mjs +1503 -0
- data/vendor/prettier/index.cjs +825 -0
- data/vendor/prettier/index.d.ts +941 -0
- data/vendor/prettier/index.mjs +25899 -0
- data/vendor/prettier/internal/cli.mjs +4366 -0
- data/vendor/prettier/package.json +198 -0
- data/vendor/prettier/plugins/acorn.d.ts +6 -0
- data/vendor/prettier/plugins/acorn.js +6618 -0
- data/vendor/prettier/plugins/acorn.mjs +6456 -0
- data/vendor/prettier/plugins/angular.d.ts +8 -0
- data/vendor/prettier/plugins/angular.js +2435 -0
- data/vendor/prettier/plugins/angular.mjs +2375 -0
- data/vendor/prettier/plugins/babel.d.ts +18 -0
- data/vendor/prettier/plugins/babel.js +14271 -0
- data/vendor/prettier/plugins/babel.mjs +13986 -0
- data/vendor/prettier/plugins/estree.d.ts +1 -0
- data/vendor/prettier/plugins/estree.js +9487 -0
- data/vendor/prettier/plugins/estree.mjs +9279 -0
- data/vendor/prettier/plugins/flow.d.ts +5 -0
- data/vendor/prettier/plugins/flow.js +51477 -0
- data/vendor/prettier/plugins/flow.mjs +51219 -0
- data/vendor/prettier/plugins/glimmer.d.ts +5 -0
- data/vendor/prettier/plugins/glimmer.js +8534 -0
- data/vendor/prettier/plugins/glimmer.mjs +8421 -0
- data/vendor/prettier/plugins/graphql.d.ts +5 -0
- data/vendor/prettier/plugins/graphql.js +2421 -0
- data/vendor/prettier/plugins/graphql.mjs +2347 -0
- data/vendor/prettier/plugins/html.d.ts +8 -0
- data/vendor/prettier/plugins/html.js +8182 -0
- data/vendor/prettier/plugins/html.mjs +8077 -0
- data/vendor/prettier/plugins/markdown.d.ts +7 -0
- data/vendor/prettier/plugins/markdown.js +9068 -0
- data/vendor/prettier/plugins/markdown.mjs +8977 -0
- data/vendor/prettier/plugins/meriyah.d.ts +5 -0
- data/vendor/prettier/plugins/meriyah.js +5953 -0
- data/vendor/prettier/plugins/meriyah.mjs +5800 -0
- data/vendor/prettier/plugins/postcss.d.ts +7 -0
- data/vendor/prettier/plugins/postcss.js +9244 -0
- data/vendor/prettier/plugins/postcss.mjs +9046 -0
- data/vendor/prettier/plugins/typescript.d.ts +5 -0
- data/vendor/prettier/plugins/typescript.js +38058 -0
- data/vendor/prettier/plugins/typescript.mjs +37732 -0
- data/vendor/prettier/plugins/yaml.d.ts +5 -0
- data/vendor/prettier/plugins/yaml.js +7425 -0
- data/vendor/prettier/plugins/yaml.mjs +7329 -0
- data/vendor/prettier/standalone.d.ts +33 -0
- data/vendor/prettier/standalone.js +3984 -0
- data/vendor/prettier/standalone.mjs +3938 -0
- data/vendor/sql-formatter.js +18762 -0
- metadata +205 -2
@@ -0,0 +1,573 @@
|
|
1
|
+
"use strict";
|
2
|
+
var B = Object.defineProperty;
|
3
|
+
var T = (s, t, e) =>
|
4
|
+
t in s
|
5
|
+
? B(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e })
|
6
|
+
: (s[t] = e);
|
7
|
+
var f = (s, t, e) => (T(s, typeof t != "symbol" ? t + "" : t, e), e);
|
8
|
+
class D {
|
9
|
+
constructor(t, e) {
|
10
|
+
f(this, "text");
|
11
|
+
f(this, "textLength");
|
12
|
+
f(this, "textPosition");
|
13
|
+
f(this, "rules");
|
14
|
+
(this.text = t),
|
15
|
+
(this.textLength = t ? t.length : 0),
|
16
|
+
(this.textPosition = 0),
|
17
|
+
(this.rules = e || []);
|
18
|
+
}
|
19
|
+
scan() {
|
20
|
+
return this.textPosition >= this.textLength
|
21
|
+
? null
|
22
|
+
: this.text[this.textPosition++];
|
23
|
+
}
|
24
|
+
isDone() {
|
25
|
+
return this.textPosition >= this.textLength;
|
26
|
+
}
|
27
|
+
move(t) {
|
28
|
+
this.textPosition += t;
|
29
|
+
}
|
30
|
+
match(t, e, r) {
|
31
|
+
var a;
|
32
|
+
let n;
|
33
|
+
if (e instanceof RegExp) {
|
34
|
+
const i = new RegExp("^(" + e.source + ")", e.flags),
|
35
|
+
l =
|
36
|
+
(a = this.text.substring(this.textPosition).match(i)) == null
|
37
|
+
? void 0
|
38
|
+
: a[0];
|
39
|
+
l !== void 0 && (n = l);
|
40
|
+
} else if (e instanceof Array)
|
41
|
+
for (const i of e) {
|
42
|
+
const l = this.match(t, i);
|
43
|
+
if (l) {
|
44
|
+
n = l;
|
45
|
+
break;
|
46
|
+
}
|
47
|
+
}
|
48
|
+
else
|
49
|
+
typeof e == "function"
|
50
|
+
? (n = e(t, this.text.substring(this.textPosition)))
|
51
|
+
: typeof e == "string" &&
|
52
|
+
this.text.substring(this.textPosition).startsWith(e) &&
|
53
|
+
(n = e);
|
54
|
+
if (n && r) {
|
55
|
+
const i = this.text.charAt(this.textPosition - 1),
|
56
|
+
l = this.text.charAt(this.textPosition + n.length);
|
57
|
+
(i.match(/[A-Za-z0-9_]/) || l.match(/[A-Za-z0-9_]/)) && (n = void 0);
|
58
|
+
}
|
59
|
+
return n;
|
60
|
+
}
|
61
|
+
matchStart(t, e) {
|
62
|
+
return this.match(t, e.start, e.wholeword);
|
63
|
+
}
|
64
|
+
matchEnd(t, e) {
|
65
|
+
return this.match(t, e.end, e.wholeword);
|
66
|
+
}
|
67
|
+
matchSkip(t, e) {
|
68
|
+
return this.match(t, e.skip, e.wholeword);
|
69
|
+
}
|
70
|
+
createDefaultTextObject(t) {
|
71
|
+
return { type: "text", start: t };
|
72
|
+
}
|
73
|
+
parse() {
|
74
|
+
var n;
|
75
|
+
const t = { type: "root", start: "" },
|
76
|
+
e = [],
|
77
|
+
r = [t];
|
78
|
+
for (; !this.isDone(); ) {
|
79
|
+
const a = e[e.length - 1],
|
80
|
+
i = r[r.length - 1],
|
81
|
+
l = (n = i.children) == null ? void 0 : n[i.children.length - 1];
|
82
|
+
if (a) {
|
83
|
+
if (a.skip) {
|
84
|
+
const h = this.matchSkip(i, a);
|
85
|
+
if (typeof h == "string") {
|
86
|
+
l && l.type === "text"
|
87
|
+
? (l.start += h)
|
88
|
+
: (i.children || (i.children = []),
|
89
|
+
i.children.push(this.createDefaultTextObject(h))),
|
90
|
+
this.move(h.length);
|
91
|
+
continue;
|
92
|
+
}
|
93
|
+
}
|
94
|
+
if (a.end) {
|
95
|
+
const h = this.matchEnd(i, a);
|
96
|
+
if (typeof h == "string") {
|
97
|
+
(i.end = h), e.pop(), r.pop(), this.move(h.length);
|
98
|
+
continue;
|
99
|
+
}
|
100
|
+
}
|
101
|
+
}
|
102
|
+
if (!(a != null && a.exclusive)) {
|
103
|
+
const h = this.rules.find((c) => this.matchStart(i, c));
|
104
|
+
if (h) {
|
105
|
+
const c = this.matchStart(i, h);
|
106
|
+
if (typeof c == "string") {
|
107
|
+
const g = { type: h.name, start: c };
|
108
|
+
i.children || (i.children = []),
|
109
|
+
i.children.push(g),
|
110
|
+
h.end && (e.push(h), r.push(g)),
|
111
|
+
this.move(c.length);
|
112
|
+
continue;
|
113
|
+
}
|
114
|
+
}
|
115
|
+
}
|
116
|
+
const w = this.scan();
|
117
|
+
w &&
|
118
|
+
(l && l.type === "text"
|
119
|
+
? (l.start += w)
|
120
|
+
: (i.children || (i.children = []),
|
121
|
+
i.children.push(this.createDefaultTextObject(w))));
|
122
|
+
}
|
123
|
+
return t;
|
124
|
+
}
|
125
|
+
}
|
126
|
+
class o {
|
127
|
+
constructor(t, e) {
|
128
|
+
f(this, "name");
|
129
|
+
f(this, "exclusive", !1);
|
130
|
+
f(this, "wholeword", !1);
|
131
|
+
f(this, "start");
|
132
|
+
f(this, "skip");
|
133
|
+
f(this, "end");
|
134
|
+
(this.name = t),
|
135
|
+
(this.exclusive = !!e.exclusive),
|
136
|
+
(this.wholeword = !!e.wholeword),
|
137
|
+
(this.start = e.start),
|
138
|
+
(this.skip = e.skip),
|
139
|
+
(this.end = e.end);
|
140
|
+
}
|
141
|
+
}
|
142
|
+
var O = [
|
143
|
+
new o("keywordblock", {
|
144
|
+
start: (s, t) => {
|
145
|
+
var i;
|
146
|
+
const e =
|
147
|
+
(i = s.children) == null
|
148
|
+
? void 0
|
149
|
+
: i.filter((l) => l.type !== "whitespace"),
|
150
|
+
r = e == null ? void 0 : e.at(-1),
|
151
|
+
n = e == null ? void 0 : e.at(-2),
|
152
|
+
a = t.trimStart();
|
153
|
+
if (
|
154
|
+
(r == null ? void 0 : r.type) === "round" &&
|
155
|
+
(n == null ? void 0 : n.type) === "keywords" &&
|
156
|
+
!a.startsWith("{")
|
157
|
+
)
|
158
|
+
return t.substring(0, t.length - a.length);
|
159
|
+
},
|
160
|
+
end: /\n|$|(?=})/,
|
161
|
+
}),
|
162
|
+
new o("blockcomment", { start: "/*", end: "*/", exclusive: !0 }),
|
163
|
+
new o("linecomment", { start: "//", end: /(?=\n)/, exclusive: !0 }),
|
164
|
+
new o("multilinestring", { start: "'''", end: "'''", exclusive: !0 }),
|
165
|
+
new o("multilinestring", { start: '"""', end: '"""', exclusive: !0 }),
|
166
|
+
new o("string", { start: '"', end: '"', skip: '\\"', exclusive: !0 }),
|
167
|
+
new o("string", { start: "'", end: "'", skip: "\\'", exclusive: !0 }),
|
168
|
+
new o("regexp", { start: /\//g, end: /\//g, skip: /'/g, exclusive: !0 }),
|
169
|
+
new o("numeric", { start: /0[xX][0-9a-fA-F]+\b/g }),
|
170
|
+
new o("numeric", { start: /[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/g }),
|
171
|
+
new o("boolean", { start: /(?:true|false)\b/g }),
|
172
|
+
new o("block", { start: "{", end: "}" }),
|
173
|
+
new o("square", { start: ["?[", "["], end: "]" }),
|
174
|
+
new o("round", { start: "(", end: ")" }),
|
175
|
+
new o("dot", { start: /((\?|\*|&)+)?\.(?=[^\d])(\*)?/g }),
|
176
|
+
new o("delimiters", { start: [",", ":", ";"] }),
|
177
|
+
new o("incdec", { start: ["--", "++", "**"] }),
|
178
|
+
new o("operators", {
|
179
|
+
start: [
|
180
|
+
"--",
|
181
|
+
"-=",
|
182
|
+
"->",
|
183
|
+
"-",
|
184
|
+
"::",
|
185
|
+
"!==",
|
186
|
+
"!=",
|
187
|
+
"?:",
|
188
|
+
"?=",
|
189
|
+
"?",
|
190
|
+
"..<",
|
191
|
+
"..",
|
192
|
+
"**=",
|
193
|
+
"**",
|
194
|
+
"*=",
|
195
|
+
"*",
|
196
|
+
"/=",
|
197
|
+
"/",
|
198
|
+
"&&",
|
199
|
+
"&=",
|
200
|
+
"&",
|
201
|
+
"%=",
|
202
|
+
"%",
|
203
|
+
"^=",
|
204
|
+
"^",
|
205
|
+
"++",
|
206
|
+
"+=",
|
207
|
+
"+",
|
208
|
+
"<..<",
|
209
|
+
"<..",
|
210
|
+
"<<=",
|
211
|
+
"<<",
|
212
|
+
"<=>",
|
213
|
+
"<=",
|
214
|
+
"<",
|
215
|
+
"===",
|
216
|
+
"==~",
|
217
|
+
"==",
|
218
|
+
"=~",
|
219
|
+
"=",
|
220
|
+
">=",
|
221
|
+
">>=",
|
222
|
+
">>>=",
|
223
|
+
">>",
|
224
|
+
">",
|
225
|
+
"|=",
|
226
|
+
"||",
|
227
|
+
"|",
|
228
|
+
"~",
|
229
|
+
],
|
230
|
+
}),
|
231
|
+
new o("negation", { start: "!" }),
|
232
|
+
new o("keywords", {
|
233
|
+
start: [
|
234
|
+
"abstract",
|
235
|
+
"assert",
|
236
|
+
"boolean",
|
237
|
+
"break",
|
238
|
+
"byte",
|
239
|
+
"case",
|
240
|
+
"catch",
|
241
|
+
"char",
|
242
|
+
"class",
|
243
|
+
"continue",
|
244
|
+
"default",
|
245
|
+
"def",
|
246
|
+
"double",
|
247
|
+
"do",
|
248
|
+
"else",
|
249
|
+
"enum",
|
250
|
+
"extends",
|
251
|
+
"finally",
|
252
|
+
"final",
|
253
|
+
"float",
|
254
|
+
"for",
|
255
|
+
"goto",
|
256
|
+
"if",
|
257
|
+
"implements",
|
258
|
+
"import",
|
259
|
+
"instanceof",
|
260
|
+
"interface",
|
261
|
+
"int",
|
262
|
+
"long",
|
263
|
+
"native",
|
264
|
+
"new",
|
265
|
+
"package",
|
266
|
+
"private",
|
267
|
+
"protected",
|
268
|
+
"public",
|
269
|
+
"return",
|
270
|
+
"short",
|
271
|
+
"static",
|
272
|
+
"strictfp",
|
273
|
+
"super",
|
274
|
+
"switch",
|
275
|
+
"synchronized",
|
276
|
+
"throws",
|
277
|
+
"throw",
|
278
|
+
"transient",
|
279
|
+
"try",
|
280
|
+
"void",
|
281
|
+
"volatile",
|
282
|
+
"while",
|
283
|
+
"with",
|
284
|
+
],
|
285
|
+
wholeword: !0,
|
286
|
+
}),
|
287
|
+
new o("identifiers", { start: /[a-zA-Z_$][a-zA-Z0-9_$]*\b/g, wholeword: !0 }),
|
288
|
+
new o("whitespace", { start: /\s+/g }),
|
289
|
+
];
|
290
|
+
class W {
|
291
|
+
constructor(t, e) {
|
292
|
+
f(this, "rules");
|
293
|
+
f(this, "options");
|
294
|
+
(this.rules = (t == null ? void 0 : t.map((r) => new r(this))) || []),
|
295
|
+
(this.options = e || { width: 80 });
|
296
|
+
}
|
297
|
+
format(t, e = 0) {
|
298
|
+
let r = "";
|
299
|
+
if (t) {
|
300
|
+
const n = this.rules.find((a) => a.matches(t));
|
301
|
+
t.start !== void 0 && n && (r += n.formatStart(t, e)),
|
302
|
+
n && (r += n.formatChildren(t, e)),
|
303
|
+
t.end !== void 0 && n && (r += n.formatEnd(t, e));
|
304
|
+
}
|
305
|
+
return r;
|
306
|
+
}
|
307
|
+
}
|
308
|
+
function x(s, t) {
|
309
|
+
return "".padStart(t * 4) + s;
|
310
|
+
}
|
311
|
+
function R(s, t) {
|
312
|
+
return s + "".padStart(t * 4);
|
313
|
+
}
|
314
|
+
function L(s) {
|
315
|
+
return s.replace(/^( |\t)+/, "");
|
316
|
+
}
|
317
|
+
function m(s) {
|
318
|
+
return s.replace(/( |\t)+$/, "");
|
319
|
+
}
|
320
|
+
class p {
|
321
|
+
constructor(t) {
|
322
|
+
f(this, "formatter");
|
323
|
+
this.formatter = t;
|
324
|
+
}
|
325
|
+
matches(t, e) {
|
326
|
+
return !0;
|
327
|
+
}
|
328
|
+
afterSelf(t, e) {
|
329
|
+
return t;
|
330
|
+
}
|
331
|
+
beforeSelf(t, e, r) {
|
332
|
+
return t;
|
333
|
+
}
|
334
|
+
beforeChild(t, e) {
|
335
|
+
return t;
|
336
|
+
}
|
337
|
+
formatStart(t, e) {
|
338
|
+
var r;
|
339
|
+
return (r = t.start) != null ? r : "";
|
340
|
+
}
|
341
|
+
formatEnd(t, e) {
|
342
|
+
var r;
|
343
|
+
return (r = t.end) != null ? r : "";
|
344
|
+
}
|
345
|
+
allowBreak(t) {
|
346
|
+
return !1;
|
347
|
+
}
|
348
|
+
formatChildren(t, e) {
|
349
|
+
var r;
|
350
|
+
return (
|
351
|
+
((r = t == null ? void 0 : t.children) == null
|
352
|
+
? void 0
|
353
|
+
: r.reduce((n, a, i, l) => {
|
354
|
+
var y, k, S, v;
|
355
|
+
const w = this.formatter.rules.find((d) => d.matches(a)),
|
356
|
+
h = this.formatter.rules.find((d) => d.matches(t)),
|
357
|
+
c = this.formatter.rules.find((d) => d.matches(l[i - 1])),
|
358
|
+
g = this.formatter.rules.find((d) => d.matches(l[i + 1]));
|
359
|
+
let u = this.formatter.format(a, e);
|
360
|
+
if (
|
361
|
+
(c && (u = c.afterSelf(u, e)), h && (u = h.beforeChild(u, e)), g)
|
362
|
+
) {
|
363
|
+
const C =
|
364
|
+
!m(n + u).length ||
|
365
|
+
m(n + u).endsWith(`
|
366
|
+
`);
|
367
|
+
u = g.beforeSelf(u, e, C);
|
368
|
+
}
|
369
|
+
const F =
|
370
|
+
(k =
|
371
|
+
(y = n
|
372
|
+
.split(
|
373
|
+
`
|
374
|
+
`,
|
375
|
+
)
|
376
|
+
.at(-1)) == null
|
377
|
+
? void 0
|
378
|
+
: y.length) != null
|
379
|
+
? k
|
380
|
+
: 0,
|
381
|
+
A =
|
382
|
+
(v =
|
383
|
+
(S = u
|
384
|
+
.split(
|
385
|
+
`
|
386
|
+
`,
|
387
|
+
)
|
388
|
+
.at(0)) == null
|
389
|
+
? void 0
|
390
|
+
: S.length) != null
|
391
|
+
? v
|
392
|
+
: 0;
|
393
|
+
return (
|
394
|
+
F + A > this.formatter.options.width &&
|
395
|
+
(w == null ? void 0 : w.allowBreak(a)) &&
|
396
|
+
((u =
|
397
|
+
`
|
398
|
+
` + u.trimStart()),
|
399
|
+
h && (u = h.beforeChild(u, e + 1))),
|
400
|
+
(n += u),
|
401
|
+
n
|
402
|
+
);
|
403
|
+
}, "")) || ""
|
404
|
+
);
|
405
|
+
}
|
406
|
+
}
|
407
|
+
class z extends p {
|
408
|
+
matches(t) {
|
409
|
+
return (t == null ? void 0 : t.type) === "root";
|
410
|
+
}
|
411
|
+
beforeChild(t) {
|
412
|
+
let e = t;
|
413
|
+
const r = m(e);
|
414
|
+
return (
|
415
|
+
r.endsWith(`
|
416
|
+
`) && (e = r),
|
417
|
+
e
|
418
|
+
);
|
419
|
+
}
|
420
|
+
}
|
421
|
+
class P extends p {
|
422
|
+
beforeChild(t, e) {
|
423
|
+
let r = t;
|
424
|
+
const n = L(r);
|
425
|
+
n.startsWith(`
|
426
|
+
`) &&
|
427
|
+
(r =
|
428
|
+
`
|
429
|
+
` + x(n.trimStart(), e));
|
430
|
+
const a = m(r);
|
431
|
+
return (
|
432
|
+
a.endsWith(`
|
433
|
+
`) && (r = R(a, e)),
|
434
|
+
r
|
435
|
+
);
|
436
|
+
}
|
437
|
+
}
|
438
|
+
class E extends P {
|
439
|
+
matches(t) {
|
440
|
+
return (t == null ? void 0 : t.type) === "block";
|
441
|
+
}
|
442
|
+
beforeSelf(t, e, r) {
|
443
|
+
return r ? t : t.trimEnd() + " ";
|
444
|
+
}
|
445
|
+
formatEnd(t, e) {
|
446
|
+
return t.end ? x(t.end, e) : "";
|
447
|
+
}
|
448
|
+
formatChildren(t, e) {
|
449
|
+
let r = super.formatChildren(t, e + 1);
|
450
|
+
return (
|
451
|
+
(r = r.trim()),
|
452
|
+
`
|
453
|
+
` +
|
454
|
+
x(r, e + 1) +
|
455
|
+
`
|
456
|
+
`
|
457
|
+
);
|
458
|
+
}
|
459
|
+
}
|
460
|
+
class Z extends E {
|
461
|
+
matches(t) {
|
462
|
+
return (t == null ? void 0 : t.type) === "keywordblock";
|
463
|
+
}
|
464
|
+
formatStart() {
|
465
|
+
return "{";
|
466
|
+
}
|
467
|
+
formatEnd(t, e) {
|
468
|
+
return x(
|
469
|
+
`}
|
470
|
+
`,
|
471
|
+
e,
|
472
|
+
);
|
473
|
+
}
|
474
|
+
}
|
475
|
+
class _ extends P {
|
476
|
+
matches(t) {
|
477
|
+
return (
|
478
|
+
(t == null ? void 0 : t.type) === "round" ||
|
479
|
+
(t == null ? void 0 : t.type) === "square"
|
480
|
+
);
|
481
|
+
}
|
482
|
+
isMultiline(t) {
|
483
|
+
var e;
|
484
|
+
return (e = t.children) == null
|
485
|
+
? void 0
|
486
|
+
: e.some((r) => {
|
487
|
+
var n;
|
488
|
+
return (n = r.start) == null
|
489
|
+
? void 0
|
490
|
+
: n.includes(`
|
491
|
+
`);
|
492
|
+
});
|
493
|
+
}
|
494
|
+
beforeSelf(t, e, r) {
|
495
|
+
return r ? m(t) : t;
|
496
|
+
}
|
497
|
+
formatEnd(t, e) {
|
498
|
+
var r;
|
499
|
+
return this.isMultiline(t)
|
500
|
+
? t.end
|
501
|
+
? x(t.end, e)
|
502
|
+
: ""
|
503
|
+
: (r = t.end) != null
|
504
|
+
? r
|
505
|
+
: "";
|
506
|
+
}
|
507
|
+
formatChildren(t, e) {
|
508
|
+
if (this.isMultiline(t)) {
|
509
|
+
let r = super.formatChildren(t, e + 1);
|
510
|
+
return (
|
511
|
+
(r = r.trim()),
|
512
|
+
`
|
513
|
+
` +
|
514
|
+
x(r, e + 1) +
|
515
|
+
`
|
516
|
+
`
|
517
|
+
);
|
518
|
+
} else return super.formatChildren(t, e).trim();
|
519
|
+
}
|
520
|
+
}
|
521
|
+
class $ extends p {
|
522
|
+
matches(t) {
|
523
|
+
return (t == null ? void 0 : t.type) === "dot";
|
524
|
+
}
|
525
|
+
beforeSelf(t, e, r) {
|
526
|
+
return r ? R(m(t), e + 1) : t;
|
527
|
+
}
|
528
|
+
}
|
529
|
+
class b extends p {
|
530
|
+
matches(t) {
|
531
|
+
return (t == null ? void 0 : t.type) === "operators";
|
532
|
+
}
|
533
|
+
beforeSelf(t) {
|
534
|
+
return m(t) + " ";
|
535
|
+
}
|
536
|
+
afterSelf(t) {
|
537
|
+
return " " + t.trimStart();
|
538
|
+
}
|
539
|
+
allowBreak() {
|
540
|
+
return !0;
|
541
|
+
}
|
542
|
+
}
|
543
|
+
class M extends p {
|
544
|
+
matches(t) {
|
545
|
+
return (t == null ? void 0 : t.type) === "delimiters";
|
546
|
+
}
|
547
|
+
beforeSelf(t) {
|
548
|
+
return m(t);
|
549
|
+
}
|
550
|
+
afterSelf(t) {
|
551
|
+
return " " + L(t);
|
552
|
+
}
|
553
|
+
}
|
554
|
+
class q extends p {
|
555
|
+
matches(t) {
|
556
|
+
return (t == null ? void 0 : t.type) === "keywords";
|
557
|
+
}
|
558
|
+
beforeSelf(t, e, r) {
|
559
|
+
return r ? t : t.trimEnd() + " ";
|
560
|
+
}
|
561
|
+
afterSelf(t) {
|
562
|
+
return " " + t.trimStart();
|
563
|
+
}
|
564
|
+
allowBreak() {
|
565
|
+
return !0;
|
566
|
+
}
|
567
|
+
}
|
568
|
+
var G = [z, E, Z, _, $, q, b, M, p];
|
569
|
+
function K(s, t) {
|
570
|
+
const r = new D(s, O).parse();
|
571
|
+
return new W(G, t).format(r);
|
572
|
+
}
|
573
|
+
module.exports = K;
|