@traqula/generator-sparql-1-2 0.0.15 → 0.0.16

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/index.cjs CHANGED
@@ -24,8 +24,8 @@ __export(index_exports, {
24
24
  });
25
25
  module.exports = __toCommonJS(index_exports);
26
26
 
27
- // ../../packages/core/lib/CoreFactory.js
28
- var CoreFactory = class {
27
+ // ../../packages/core/lib/AstCoreFactory.js
28
+ var AstCoreFactory = class {
29
29
  wrap(val, loc) {
30
30
  return { val, loc };
31
31
  }
@@ -151,214 +151,6 @@ var CoreFactory = class {
151
151
  }
152
152
  };
153
153
 
154
- // ../../packages/core/lib/generator-builder/dynamicGenerator.js
155
- var DynamicGenerator = class {
156
- rules;
157
- factory = new CoreFactory();
158
- __context = void 0;
159
- origSource = "";
160
- generatedUntil = 0;
161
- expectsSpace;
162
- stringBuilder = [];
163
- constructor(rules) {
164
- this.rules = rules;
165
- for (const rule of Object.values(rules)) {
166
- this[rule.name] = ((input, context, args) => {
167
- this.expectsSpace = false;
168
- this.stringBuilder.length = 0;
169
- this.origSource = context.origSource;
170
- this.generatedUntil = context?.offset ?? 0;
171
- this.setContext(context);
172
- this.subrule(rule, input, args);
173
- this.catchup(this.origSource.length);
174
- return this.stringBuilder.join("");
175
- });
176
- }
177
- }
178
- setContext(context) {
179
- this.__context = context;
180
- }
181
- getSafeContext() {
182
- return this.__context;
183
- }
184
- subrule = (cstDef, ast, ...arg) => {
185
- const def = this.rules[cstDef.name];
186
- if (!def) {
187
- throw new Error(`Rule ${cstDef.name} not found`);
188
- }
189
- const generate = () => def.gImpl({
190
- SUBRULE: this.subrule,
191
- PRINT: this.print,
192
- PRINT_SPACE_LEFT: this.printSpaceLeft,
193
- PRINT_WORD: this.printWord,
194
- PRINT_WORDS: this.printWords,
195
- CATCHUP: this.catchup,
196
- HANDLE_LOC: this.handleLoc
197
- })(ast, this.getSafeContext(), ...arg);
198
- if (this.factory.isLocalized(ast)) {
199
- this.handleLoc(ast, generate);
200
- } else {
201
- generate();
202
- }
203
- };
204
- handleLoc = (localized, handle) => {
205
- if (this.factory.isSourceLocationNoMaterialize(localized.loc)) {
206
- return;
207
- }
208
- if (this.factory.isSourceLocationStringReplace(localized.loc)) {
209
- this.catchup(localized.loc.start);
210
- this.print(localized.loc.newSource);
211
- this.generatedUntil = localized.loc.end;
212
- return;
213
- }
214
- if (this.factory.isSourceLocationNodeReplace(localized.loc)) {
215
- this.catchup(localized.loc.start);
216
- this.generatedUntil = localized.loc.end;
217
- }
218
- if (this.factory.isSourceLocationSource(localized.loc)) {
219
- this.catchup(localized.loc.start);
220
- }
221
- const ret = handle();
222
- if (this.factory.isSourceLocationSource(localized.loc)) {
223
- this.catchup(localized.loc.end);
224
- }
225
- return ret;
226
- };
227
- catchup = (until) => {
228
- const start = this.generatedUntil;
229
- if (start < until) {
230
- this.print(this.origSource.slice(start, until));
231
- }
232
- this.generatedUntil = Math.max(this.generatedUntil, until);
233
- };
234
- print = (...args) => {
235
- const pureArgs = args.filter((x) => x.length > 0);
236
- if (pureArgs.length > 0) {
237
- const [head2, ...tail] = pureArgs;
238
- if (this.expectsSpace) {
239
- this.expectsSpace = false;
240
- const blanks = /* @__PURE__ */ new Set(["\n", " ", " "]);
241
- if (this.stringBuilder.length > 0 && !(blanks.has(head2[0]) || blanks.has(this.stringBuilder.at(-1).at(-1)))) {
242
- this.stringBuilder.push(" ");
243
- }
244
- }
245
- this.stringBuilder.push(head2);
246
- this.stringBuilder.push(...tail);
247
- }
248
- };
249
- printWord = (...args) => {
250
- this.expectsSpace = true;
251
- this.print(...args);
252
- this.expectsSpace = true;
253
- };
254
- printSpaceLeft = (...args) => {
255
- this.expectsSpace = true;
256
- this.print(...args);
257
- };
258
- printWords = (...args) => {
259
- for (const arg of args) {
260
- this.printWord(arg);
261
- }
262
- };
263
- };
264
-
265
- // ../../packages/core/lib/generator-builder/generatorBuilder.js
266
- function listToRuleDefMap(rules) {
267
- const newRules = {};
268
- for (const rule of rules) {
269
- newRules[rule.name] = rule;
270
- }
271
- return newRules;
272
- }
273
- var GeneratorBuilder = class _GeneratorBuilder {
274
- static create(start) {
275
- if (start instanceof _GeneratorBuilder) {
276
- return new _GeneratorBuilder({ ...start.rules });
277
- }
278
- return new _GeneratorBuilder(listToRuleDefMap(start));
279
- }
280
- rules;
281
- constructor(startRules) {
282
- this.rules = startRules;
283
- }
284
- widenContext() {
285
- return this;
286
- }
287
- typePatch() {
288
- return this;
289
- }
290
- /**
291
- * Change the implementation of an existing generator rule.
292
- */
293
- patchRule(patch) {
294
- const self2 = this;
295
- self2.rules[patch.name] = patch;
296
- return self2;
297
- }
298
- /**
299
- * Add a rule to the grammar. If the rule already exists, but the implementation differs, an error will be thrown.
300
- */
301
- addRuleRedundant(rule) {
302
- const self2 = this;
303
- const rules = self2.rules;
304
- if (rules[rule.name] !== void 0 && rules[rule.name] !== rule) {
305
- throw new Error(`Rule ${rule.name} already exists in the GeneratorBuilder`);
306
- }
307
- rules[rule.name] = rule;
308
- return self2;
309
- }
310
- /**
311
- * Add a rule to the grammar. Will raise a typescript error if the rule already exists in the grammar.
312
- */
313
- addRule(rule) {
314
- return this.addRuleRedundant(rule);
315
- }
316
- addMany(...rules) {
317
- this.rules = { ...this.rules, ...listToRuleDefMap(rules) };
318
- return this;
319
- }
320
- /**
321
- * Delete a grammar rule by its name.
322
- */
323
- deleteRule(ruleName) {
324
- delete this.rules[ruleName];
325
- return this;
326
- }
327
- /**
328
- * Merge this grammar GeneratorBuilder with another.
329
- * It is best to merge the bigger grammar with the smaller one.
330
- * If the two builders both have a grammar rule with the same name,
331
- * no error will be thrown case they map to the same ruledef object.
332
- * If they map to a different object, an error will be thrown.
333
- * To fix this problem, the overridingRules array should contain a rule with the same conflicting name,
334
- * this rule implementation will be used.
335
- */
336
- merge(GeneratorBuilder2, overridingRules) {
337
- const otherRules = { ...GeneratorBuilder2.rules };
338
- const myRules = this.rules;
339
- for (const rule of Object.values(myRules)) {
340
- if (otherRules[rule.name] === void 0) {
341
- otherRules[rule.name] = rule;
342
- } else {
343
- const existingRule = otherRules[rule.name];
344
- if (existingRule !== rule) {
345
- const override = overridingRules.find((x) => x.name === rule.name);
346
- if (override) {
347
- otherRules[rule.name] = override;
348
- } else {
349
- throw new Error(`Rule with name "${rule.name}" already exists in the GeneratorBuilder, specify an override to resolve conflict`);
350
- }
351
- }
352
- }
353
- }
354
- this.rules = otherRules;
355
- return this;
356
- }
357
- build() {
358
- return new DynamicGenerator(this.rules);
359
- }
360
- };
361
-
362
154
  // ../../node_modules/lodash-es/_freeGlobal.js
363
155
  var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
364
156
  var freeGlobal_default = freeGlobal;
@@ -9570,28 +9362,284 @@ applyMixins(Parser, [
9570
9362
  PerformanceTracer
9571
9363
  ]);
9572
9364
 
9573
- // ../../packages/core/lib/lexer-builder/LexerBuilder.js
9574
- var LexerBuilder = class _LexerBuilder {
9575
- tokens;
9576
- static create(starter) {
9577
- return new _LexerBuilder(starter);
9365
+ // ../../packages/core/lib/utils.js
9366
+ function unCapitalize(str2) {
9367
+ return str2.charAt(0).toLowerCase() + str2.slice(1);
9368
+ }
9369
+ function createToken2(config) {
9370
+ return createToken(config);
9371
+ }
9372
+ var traqulaIndentation = "When you use this string, you expect traqula to handle indentation after every newline";
9373
+
9374
+ // ../../packages/core/lib/generator-builder/dynamicGenerator.js
9375
+ var DynamicGenerator = class {
9376
+ rules;
9377
+ factory = new AstCoreFactory();
9378
+ __context = void 0;
9379
+ origSource = "";
9380
+ generatedUntil = 0;
9381
+ expectsSpace;
9382
+ stringBuilder = [];
9383
+ constructor(rules) {
9384
+ this.rules = rules;
9385
+ for (const rule of Object.values(rules)) {
9386
+ this[rule.name] = ((input, context, args) => {
9387
+ this.expectsSpace = false;
9388
+ this.stringBuilder.length = 0;
9389
+ this.origSource = context.origSource;
9390
+ this.generatedUntil = context?.offset ?? 0;
9391
+ this.setContext(context);
9392
+ this.subrule(rule, input, args);
9393
+ this.catchup(this.origSource.length);
9394
+ return this.stringBuilder.join("");
9395
+ });
9396
+ }
9578
9397
  }
9579
- constructor(starter) {
9580
- this.tokens = starter?.tokens ? [...starter.tokens] : [];
9398
+ setContext(context) {
9399
+ this.__context = context;
9581
9400
  }
9582
- merge(merge, overwrite = []) {
9583
- const extraTokens = merge.tokens.filter((token) => {
9584
- const overwriteToken = overwrite.find((t) => t.name === token.name);
9585
- if (overwriteToken) {
9586
- return false;
9587
- }
9588
- const match = this.tokens.find((t) => t.name === token.name);
9589
- if (match) {
9590
- if (match !== token) {
9591
- throw new Error(`Token with name ${token.name} already exists. Implementation is different and no overwrite was provided.`);
9592
- }
9593
- return false;
9594
- }
9401
+ getSafeContext() {
9402
+ return this.__context;
9403
+ }
9404
+ subrule = (cstDef, ast, ...arg) => {
9405
+ const def = this.rules[cstDef.name];
9406
+ if (!def) {
9407
+ throw new Error(`Rule ${cstDef.name} not found`);
9408
+ }
9409
+ const generate = () => def.gImpl({
9410
+ SUBRULE: this.subrule,
9411
+ PRINT: this.print,
9412
+ PRINT_SPACE_LEFT: this.printSpaceLeft,
9413
+ PRINT_WORD: this.printWord,
9414
+ PRINT_WORDS: this.printWords,
9415
+ PRINT_ON_EMPTY: this.printOnEmpty,
9416
+ CATCHUP: this.catchup,
9417
+ HANDLE_LOC: this.handleLoc
9418
+ })(ast, this.getSafeContext(), ...arg);
9419
+ if (this.factory.isLocalized(ast)) {
9420
+ this.handleLoc(ast, generate);
9421
+ } else {
9422
+ generate();
9423
+ }
9424
+ };
9425
+ handleLoc = (localized, handle) => {
9426
+ if (this.factory.isSourceLocationNoMaterialize(localized.loc)) {
9427
+ return;
9428
+ }
9429
+ if (this.factory.isSourceLocationStringReplace(localized.loc)) {
9430
+ this.catchup(localized.loc.start);
9431
+ this.print(localized.loc.newSource);
9432
+ this.generatedUntil = localized.loc.end;
9433
+ return;
9434
+ }
9435
+ if (this.factory.isSourceLocationNodeReplace(localized.loc)) {
9436
+ this.catchup(localized.loc.start);
9437
+ this.generatedUntil = localized.loc.end;
9438
+ }
9439
+ if (this.factory.isSourceLocationSource(localized.loc)) {
9440
+ this.catchup(localized.loc.start);
9441
+ }
9442
+ const ret = handle();
9443
+ if (this.factory.isSourceLocationSource(localized.loc)) {
9444
+ this.catchup(localized.loc.end);
9445
+ }
9446
+ return ret;
9447
+ };
9448
+ catchup = (until) => {
9449
+ const start = this.generatedUntil;
9450
+ if (start < until) {
9451
+ this.print(this.origSource.slice(start, until));
9452
+ }
9453
+ this.generatedUntil = Math.max(this.generatedUntil, until);
9454
+ };
9455
+ print = (...args) => {
9456
+ const pureArgs = args.filter((x) => x.length > 0);
9457
+ if (pureArgs.length > 0) {
9458
+ const head2 = pureArgs[0];
9459
+ if (this.expectsSpace) {
9460
+ this.expectsSpace = false;
9461
+ const blanks = /* @__PURE__ */ new Set(["\n", " ", " "]);
9462
+ if (this.stringBuilder.length > 0 && !(blanks.has(head2[0]) || blanks.has(this.stringBuilder.at(-1).at(-1)))) {
9463
+ this.stringBuilder.push(" ");
9464
+ }
9465
+ }
9466
+ const context = this.getSafeContext();
9467
+ if (context[traqulaIndentation] && typeof context[traqulaIndentation] === "number") {
9468
+ const indent = context[traqulaIndentation];
9469
+ for (const str2 of pureArgs) {
9470
+ const [noNl, ...postNl] = str2.split("\n");
9471
+ this.stringBuilder.push(noNl);
9472
+ for (const subStr of postNl.map((line) => line.trimStart())) {
9473
+ this.stringBuilder.push("\n", " ".repeat(indent));
9474
+ if (subStr.length > 0) {
9475
+ this.stringBuilder.push(subStr);
9476
+ }
9477
+ }
9478
+ }
9479
+ } else {
9480
+ this.stringBuilder.push(...pureArgs);
9481
+ }
9482
+ }
9483
+ };
9484
+ printWord = (...args) => {
9485
+ this.expectsSpace = true;
9486
+ this.print(...args);
9487
+ this.expectsSpace = true;
9488
+ };
9489
+ printSpaceLeft = (...args) => {
9490
+ this.expectsSpace = true;
9491
+ this.print(...args);
9492
+ };
9493
+ printWords = (...args) => {
9494
+ for (const arg of args) {
9495
+ this.printWord(arg);
9496
+ }
9497
+ };
9498
+ printOnEmpty = (...args) => {
9499
+ let counter = this.stringBuilder.length - 1;
9500
+ let onEmpty = true;
9501
+ const isEmptyTest = /^[ \t\n]*$/u;
9502
+ while (counter >= 0 && onEmpty) {
9503
+ const cur = this.stringBuilder[counter];
9504
+ const indexOfNl = cur.lastIndexOf("\n");
9505
+ if (indexOfNl >= 0) {
9506
+ onEmpty = isEmptyTest.test(cur.slice(indexOfNl));
9507
+ if (onEmpty) {
9508
+ const newVal = cur.slice(0, indexOfNl);
9509
+ if (newVal) {
9510
+ this.stringBuilder[counter] = cur.slice(0, indexOfNl);
9511
+ } else {
9512
+ this.stringBuilder.splice(counter, 1);
9513
+ }
9514
+ }
9515
+ break;
9516
+ }
9517
+ onEmpty = isEmptyTest.test(cur);
9518
+ counter--;
9519
+ }
9520
+ this.print("\n", ...args);
9521
+ };
9522
+ };
9523
+
9524
+ // ../../packages/core/lib/generator-builder/generatorBuilder.js
9525
+ function listToRuleDefMap(rules) {
9526
+ const newRules = {};
9527
+ for (const rule of rules) {
9528
+ newRules[rule.name] = rule;
9529
+ }
9530
+ return newRules;
9531
+ }
9532
+ var GeneratorBuilder = class _GeneratorBuilder {
9533
+ static create(start) {
9534
+ if (start instanceof _GeneratorBuilder) {
9535
+ return new _GeneratorBuilder({ ...start.rules });
9536
+ }
9537
+ return new _GeneratorBuilder(listToRuleDefMap(start));
9538
+ }
9539
+ rules;
9540
+ constructor(startRules) {
9541
+ this.rules = startRules;
9542
+ }
9543
+ widenContext() {
9544
+ return this;
9545
+ }
9546
+ typePatch() {
9547
+ return this;
9548
+ }
9549
+ /**
9550
+ * Change the implementation of an existing generator rule.
9551
+ */
9552
+ patchRule(patch) {
9553
+ const self2 = this;
9554
+ self2.rules[patch.name] = patch;
9555
+ return self2;
9556
+ }
9557
+ /**
9558
+ * Add a rule to the grammar. If the rule already exists, but the implementation differs, an error will be thrown.
9559
+ */
9560
+ addRuleRedundant(rule) {
9561
+ const self2 = this;
9562
+ const rules = self2.rules;
9563
+ if (rules[rule.name] !== void 0 && rules[rule.name] !== rule) {
9564
+ throw new Error(`Rule ${rule.name} already exists in the GeneratorBuilder`);
9565
+ }
9566
+ rules[rule.name] = rule;
9567
+ return self2;
9568
+ }
9569
+ /**
9570
+ * Add a rule to the grammar. Will raise a typescript error if the rule already exists in the grammar.
9571
+ */
9572
+ addRule(rule) {
9573
+ return this.addRuleRedundant(rule);
9574
+ }
9575
+ addMany(...rules) {
9576
+ this.rules = { ...this.rules, ...listToRuleDefMap(rules) };
9577
+ return this;
9578
+ }
9579
+ /**
9580
+ * Delete a grammar rule by its name.
9581
+ */
9582
+ deleteRule(ruleName) {
9583
+ delete this.rules[ruleName];
9584
+ return this;
9585
+ }
9586
+ /**
9587
+ * Merge this grammar GeneratorBuilder with another.
9588
+ * It is best to merge the bigger grammar with the smaller one.
9589
+ * If the two builders both have a grammar rule with the same name,
9590
+ * no error will be thrown case they map to the same ruledef object.
9591
+ * If they map to a different object, an error will be thrown.
9592
+ * To fix this problem, the overridingRules array should contain a rule with the same conflicting name,
9593
+ * this rule implementation will be used.
9594
+ */
9595
+ merge(GeneratorBuilder2, overridingRules) {
9596
+ const otherRules = { ...GeneratorBuilder2.rules };
9597
+ const myRules = this.rules;
9598
+ for (const rule of Object.values(myRules)) {
9599
+ if (otherRules[rule.name] === void 0) {
9600
+ otherRules[rule.name] = rule;
9601
+ } else {
9602
+ const existingRule = otherRules[rule.name];
9603
+ if (existingRule !== rule) {
9604
+ const override = overridingRules.find((x) => x.name === rule.name);
9605
+ if (override) {
9606
+ otherRules[rule.name] = override;
9607
+ } else {
9608
+ throw new Error(`Rule with name "${rule.name}" already exists in the GeneratorBuilder, specify an override to resolve conflict`);
9609
+ }
9610
+ }
9611
+ }
9612
+ }
9613
+ this.rules = otherRules;
9614
+ return this;
9615
+ }
9616
+ build() {
9617
+ return new DynamicGenerator(this.rules);
9618
+ }
9619
+ };
9620
+
9621
+ // ../../packages/core/lib/lexer-builder/LexerBuilder.js
9622
+ var LexerBuilder = class _LexerBuilder {
9623
+ tokens;
9624
+ static create(starter) {
9625
+ return new _LexerBuilder(starter);
9626
+ }
9627
+ constructor(starter) {
9628
+ this.tokens = starter?.tokens ? [...starter.tokens] : [];
9629
+ }
9630
+ merge(merge, overwrite = []) {
9631
+ const extraTokens = merge.tokens.filter((token) => {
9632
+ const overwriteToken = overwrite.find((t) => t.name === token.name);
9633
+ if (overwriteToken) {
9634
+ return false;
9635
+ }
9636
+ const match = this.tokens.find((t) => t.name === token.name);
9637
+ if (match) {
9638
+ if (match !== token) {
9639
+ throw new Error(`Token with name ${token.name} already exists. Implementation is different and no overwrite was provided.`);
9640
+ }
9641
+ return false;
9642
+ }
9595
9643
  return true;
9596
9644
  });
9597
9645
  this.tokens.push(...extraTokens);
@@ -9667,14 +9715,6 @@ var LexerBuilder = class _LexerBuilder {
9667
9715
  }
9668
9716
  };
9669
9717
 
9670
- // ../../packages/core/lib/utils.js
9671
- function unCapitalize(str2) {
9672
- return str2.charAt(0).toLowerCase() + str2.slice(1);
9673
- }
9674
- function createToken2(config) {
9675
- return createToken(config);
9676
- }
9677
-
9678
9718
  // ../../packages/core/lib/Transformers.js
9679
9719
  var TransformerType = class {
9680
9720
  safeObjectVisit(value, mapper) {
@@ -11181,8 +11221,8 @@ function UpdateOperationFactoryMixin(Base) {
11181
11221
  };
11182
11222
  }
11183
11223
 
11184
- // ../../packages/rules-sparql-1-1/lib/factory.js
11185
- var Factory = class extends asArg(CoreFactory).call(ContextFactoryMixin).call(ExpressionFactoryMixin).call(GraphRefFactoryMixin).call(PathFactoryMixin).call(PatternFactoryMixin).call(QueryFactoryMixin).call(SolutionModifiersFactoryMixin).call(TermFactoryMixin).call(UpdateOperationFactoryMixin).returns() {
11224
+ // ../../packages/rules-sparql-1-1/lib/astFactory.js
11225
+ var AstFactory = class extends asArg(AstCoreFactory).call(ContextFactoryMixin).call(ExpressionFactoryMixin).call(GraphRefFactoryMixin).call(PathFactoryMixin).call(PatternFactoryMixin).call(QueryFactoryMixin).call(SolutionModifiersFactoryMixin).call(TermFactoryMixin).call(UpdateOperationFactoryMixin).returns() {
11186
11226
  alwaysSparql11(obj) {
11187
11227
  return true;
11188
11228
  }
@@ -11283,7 +11323,7 @@ var TransformerSparql11 = class extends TransformerSubType {
11283
11323
  };
11284
11324
 
11285
11325
  // ../../packages/rules-sparql-1-1/lib/validation/validators.js
11286
- var F = new Factory();
11326
+ var F = new AstFactory();
11287
11327
  var transformer = new TransformerSparql11();
11288
11328
  function getAggregatesOfExpression(expression2) {
11289
11329
  if (F.isExpressionAggregate(expression2)) {
@@ -11503,22 +11543,22 @@ var rdfLiteral = {
11503
11543
  return OPTION(() => OR([
11504
11544
  { ALT: () => {
11505
11545
  const lang2 = CONSUME(terminals_exports.langTag);
11506
- return ACTION(() => C.factory.literalTerm(C.factory.sourceLocation(value, lang2), value.value, lang2.image.slice(1).toLowerCase()));
11546
+ return ACTION(() => C.astFactory.literalTerm(C.astFactory.sourceLocation(value, lang2), value.value, lang2.image.slice(1).toLowerCase()));
11507
11547
  } },
11508
11548
  { ALT: () => {
11509
11549
  CONSUME(symbols_exports.hathat);
11510
11550
  const iriVal = SUBRULE1(iri2);
11511
- return ACTION(() => C.factory.literalTerm(C.factory.sourceLocation(value, iriVal), value.value, iriVal));
11551
+ return ACTION(() => C.astFactory.literalTerm(C.astFactory.sourceLocation(value, iriVal), value.value, iriVal));
11512
11552
  } }
11513
11553
  ])) ?? value;
11514
11554
  },
11515
- gImpl: ({ SUBRULE, PRINT, PRINT_SPACE_LEFT }) => (ast, { factory }) => {
11516
- factory.printFilter(ast, () => PRINT_SPACE_LEFT(stringEscapedLexical(ast.value)));
11555
+ gImpl: ({ SUBRULE, PRINT, PRINT_SPACE_LEFT }) => (ast, { astFactory }) => {
11556
+ astFactory.printFilter(ast, () => PRINT_SPACE_LEFT(stringEscapedLexical(ast.value)));
11517
11557
  if (ast.langOrIri) {
11518
11558
  if (typeof ast.langOrIri === "string") {
11519
- factory.printFilter(ast, () => PRINT("@", ast.langOrIri));
11559
+ astFactory.printFilter(ast, () => PRINT("@", ast.langOrIri));
11520
11560
  } else {
11521
- factory.printFilter(ast, () => PRINT("^^"));
11561
+ astFactory.printFilter(ast, () => PRINT("^^"));
11522
11562
  SUBRULE(iri2, ast.langOrIri);
11523
11563
  }
11524
11564
  }
@@ -11540,7 +11580,7 @@ var numericLiteralUnsigned = {
11540
11580
  { ALT: () => [CONSUME(terminals_exports.decimal), CommonIRIs.DECIMAL] },
11541
11581
  { ALT: () => [CONSUME(terminals_exports.double), CommonIRIs.DOUBLE] }
11542
11582
  ]);
11543
- return ACTION(() => C.factory.literalTerm(C.factory.sourceLocation(parsed[0]), parsed[0].image, C.factory.namedNode(C.factory.sourceLocationNoMaterialize(), parsed[1])));
11583
+ return ACTION(() => C.astFactory.literalTerm(C.astFactory.sourceLocation(parsed[0]), parsed[0].image, C.astFactory.namedNode(C.astFactory.sourceLocationNoMaterialize(), parsed[1])));
11544
11584
  }
11545
11585
  };
11546
11586
  var numericLiteralPositive = {
@@ -11551,7 +11591,7 @@ var numericLiteralPositive = {
11551
11591
  { ALT: () => [CONSUME(terminals_exports.decimalPositive), CommonIRIs.DECIMAL] },
11552
11592
  { ALT: () => [CONSUME(terminals_exports.doublePositive), CommonIRIs.DOUBLE] }
11553
11593
  ]);
11554
- return ACTION(() => C.factory.literalTerm(C.factory.sourceLocation(parsed[0]), parsed[0].image, C.factory.namedNode(C.factory.sourceLocationNoMaterialize(), parsed[1])));
11594
+ return ACTION(() => C.astFactory.literalTerm(C.astFactory.sourceLocation(parsed[0]), parsed[0].image, C.astFactory.namedNode(C.astFactory.sourceLocationNoMaterialize(), parsed[1])));
11555
11595
  }
11556
11596
  };
11557
11597
  var numericLiteralNegative = {
@@ -11562,7 +11602,7 @@ var numericLiteralNegative = {
11562
11602
  { ALT: () => [CONSUME(terminals_exports.decimalNegative), CommonIRIs.DECIMAL] },
11563
11603
  { ALT: () => [CONSUME(terminals_exports.doubleNegative), CommonIRIs.DOUBLE] }
11564
11604
  ]);
11565
- return ACTION(() => C.factory.literalTerm(C.factory.sourceLocation(parsed[0]), parsed[0].image, C.factory.namedNode(C.factory.sourceLocationNoMaterialize(), parsed[1])));
11605
+ return ACTION(() => C.astFactory.literalTerm(C.astFactory.sourceLocation(parsed[0]), parsed[0].image, C.astFactory.namedNode(C.astFactory.sourceLocationNoMaterialize(), parsed[1])));
11566
11606
  }
11567
11607
  };
11568
11608
  var booleanLiteral = {
@@ -11572,7 +11612,7 @@ var booleanLiteral = {
11572
11612
  { ALT: () => CONSUME(true_) },
11573
11613
  { ALT: () => CONSUME(false_) }
11574
11614
  ]);
11575
- return ACTION(() => C.factory.literalTerm(C.factory.sourceLocation(token), token.image.toLowerCase(), C.factory.namedNode(C.factory.sourceLocationNoMaterialize(), CommonIRIs.BOOLEAN)));
11615
+ return ACTION(() => C.astFactory.literalTerm(C.astFactory.sourceLocation(token), token.image.toLowerCase(), C.astFactory.namedNode(C.astFactory.sourceLocationNoMaterialize(), CommonIRIs.BOOLEAN)));
11576
11616
  }
11577
11617
  };
11578
11618
  var string = {
@@ -11597,7 +11637,7 @@ var string = {
11597
11637
  } }
11598
11638
  ]);
11599
11639
  return ACTION(() => {
11600
- const F3 = C.factory;
11640
+ const F3 = C.astFactory;
11601
11641
  const value = x[1].replaceAll(/\\([tnrbf"'\\])/gu, (_, char) => {
11602
11642
  switch (char) {
11603
11643
  case "t":
@@ -11624,16 +11664,16 @@ var iri2 = {
11624
11664
  { ALT: () => SUBRULE(iriFull) },
11625
11665
  { ALT: () => SUBRULE(prefixedName) }
11626
11666
  ]),
11627
- gImpl: ({ SUBRULE }) => (ast, { factory: F3 }) => F3.isTermNamedPrefixed(ast) ? SUBRULE(prefixedName, ast) : SUBRULE(iriFull, ast)
11667
+ gImpl: ({ SUBRULE }) => (ast, { astFactory: F3 }) => F3.isTermNamedPrefixed(ast) ? SUBRULE(prefixedName, ast) : SUBRULE(iriFull, ast)
11628
11668
  };
11629
11669
  var iriFull = {
11630
11670
  name: "iriFull",
11631
11671
  impl: ({ ACTION, CONSUME }) => (C) => {
11632
11672
  const iriToken = CONSUME(terminals_exports.iriRef);
11633
- return ACTION(() => C.factory.namedNode(C.factory.sourceLocation(iriToken), iriToken.image.slice(1, -1)));
11673
+ return ACTION(() => C.astFactory.namedNode(C.astFactory.sourceLocation(iriToken), iriToken.image.slice(1, -1)));
11634
11674
  },
11635
- gImpl: ({ PRINT }) => (ast, { factory }) => {
11636
- factory.printFilter(ast, () => PRINT("<", ast.value, ">"));
11675
+ gImpl: ({ PRINT }) => (ast, { astFactory: F3 }) => {
11676
+ F3.printFilter(ast, () => PRINT("<", ast.value, ">"));
11637
11677
  }
11638
11678
  };
11639
11679
  var prefixedName = {
@@ -11643,16 +11683,16 @@ var prefixedName = {
11643
11683
  const longName = CONSUME(terminals_exports.pNameLn);
11644
11684
  return ACTION(() => {
11645
11685
  const [prefix, localName] = longName.image.split(":");
11646
- return C.factory.namedNode(C.factory.sourceLocation(longName), localName, prefix);
11686
+ return C.astFactory.namedNode(C.astFactory.sourceLocation(longName), localName, prefix);
11647
11687
  });
11648
11688
  } },
11649
11689
  { ALT: () => {
11650
11690
  const shortName = CONSUME(terminals_exports.pNameNs);
11651
- return ACTION(() => C.factory.namedNode(C.factory.sourceLocation(shortName), "", shortName.image.slice(0, -1)));
11691
+ return ACTION(() => C.astFactory.namedNode(C.astFactory.sourceLocation(shortName), "", shortName.image.slice(0, -1)));
11652
11692
  } }
11653
11693
  ]),
11654
- gImpl: ({ PRINT_WORD }) => (ast, { factory }) => {
11655
- factory.printFilter(ast, () => PRINT_WORD(ast.prefix, ":", ast.value));
11694
+ gImpl: ({ PRINT_WORD }) => (ast, { astFactory: F3 }) => {
11695
+ F3.printFilter(ast, () => PRINT_WORD(ast.prefix, ":", ast.value));
11656
11696
  }
11657
11697
  };
11658
11698
  var canCreateBlankNodes = Symbol("canCreateBlankNodes");
@@ -11662,11 +11702,11 @@ var blankNode = {
11662
11702
  const result = OR([
11663
11703
  { ALT: () => {
11664
11704
  const labelToken = CONSUME(terminals_exports.blankNodeLabel);
11665
- return ACTION(() => C.factory.blankNode(labelToken.image.slice(2), C.factory.sourceLocation(labelToken)));
11705
+ return ACTION(() => C.astFactory.blankNode(labelToken.image.slice(2), C.astFactory.sourceLocation(labelToken)));
11666
11706
  } },
11667
11707
  { ALT: () => {
11668
11708
  const anonToken = CONSUME(terminals_exports.anon);
11669
- return ACTION(() => C.factory.blankNode(void 0, C.factory.sourceLocation(anonToken)));
11709
+ return ACTION(() => C.astFactory.blankNode(void 0, C.astFactory.sourceLocation(anonToken)));
11670
11710
  } }
11671
11711
  ]);
11672
11712
  ACTION(() => {
@@ -11676,15 +11716,15 @@ var blankNode = {
11676
11716
  });
11677
11717
  return result;
11678
11718
  },
11679
- gImpl: ({ PRINT_WORD }) => (ast, { factory }) => {
11680
- factory.printFilter(ast, () => PRINT_WORD("_:", ast.label.replace(/^e_/u, "")));
11719
+ gImpl: ({ PRINT_WORD }) => (ast, { astFactory }) => {
11720
+ astFactory.printFilter(ast, () => PRINT_WORD("_:", ast.label.replace(/^e_/u, "")));
11681
11721
  }
11682
11722
  };
11683
11723
  var verbA = {
11684
11724
  name: "VerbA",
11685
11725
  impl: ({ ACTION, CONSUME }) => (C) => {
11686
11726
  const token = CONSUME(a);
11687
- return ACTION(() => C.factory.namedNode(C.factory.sourceLocation(token), CommonIRIs.TYPE, void 0));
11727
+ return ACTION(() => C.astFactory.namedNode(C.astFactory.sourceLocation(token), CommonIRIs.TYPE, void 0));
11688
11728
  }
11689
11729
  };
11690
11730
 
@@ -11701,7 +11741,7 @@ var prologue = {
11701
11741
  ]));
11702
11742
  return result;
11703
11743
  },
11704
- gImpl: ({ SUBRULE }) => (ast, { factory: F3 }) => {
11744
+ gImpl: ({ SUBRULE }) => (ast, { astFactory: F3 }) => {
11705
11745
  for (const context of ast) {
11706
11746
  if (F3.isContextDefinitionBase(context)) {
11707
11747
  SUBRULE(baseDecl2, context);
@@ -11716,11 +11756,12 @@ var baseDecl2 = {
11716
11756
  impl: ({ ACTION, CONSUME, SUBRULE }) => (C) => {
11717
11757
  const base = CONSUME(baseDecl);
11718
11758
  const val = SUBRULE(iriFull);
11719
- return ACTION(() => C.factory.contextDefinitionBase(C.factory.sourceLocation(base, val), val));
11759
+ return ACTION(() => C.astFactory.contextDefinitionBase(C.astFactory.sourceLocation(base, val), val));
11720
11760
  },
11721
- gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F3 }) => {
11761
+ gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { astFactory: F3 }) => {
11722
11762
  F3.printFilter(ast, () => PRINT_WORD("BASE"));
11723
11763
  SUBRULE(iri2, ast.value);
11764
+ F3.printFilter(ast, () => PRINT_WORD("\n"));
11724
11765
  }
11725
11766
  };
11726
11767
  var prefixDecl2 = {
@@ -11729,13 +11770,14 @@ var prefixDecl2 = {
11729
11770
  const prefix = CONSUME(prefixDecl);
11730
11771
  const name = CONSUME(terminals_exports.pNameNs).image.slice(0, -1);
11731
11772
  const value = SUBRULE(iriFull);
11732
- return ACTION(() => C.factory.contextDefinitionPrefix(C.factory.sourceLocation(prefix, value), name, value));
11773
+ return ACTION(() => C.astFactory.contextDefinitionPrefix(C.astFactory.sourceLocation(prefix, value), name, value));
11733
11774
  },
11734
- gImpl: ({ SUBRULE, PRINT_WORDS }) => (ast, { factory: F3 }) => {
11775
+ gImpl: ({ SUBRULE, PRINT_WORDS }) => (ast, { astFactory: F3 }) => {
11735
11776
  F3.printFilter(ast, () => {
11736
11777
  PRINT_WORDS("PREFIX", `${ast.key}:`);
11737
11778
  });
11738
11779
  SUBRULE(iri2, ast.value);
11780
+ F3.printFilter(ast, () => PRINT_WORDS("\n"));
11739
11781
  }
11740
11782
  };
11741
11783
  var verb = {
@@ -11751,7 +11793,7 @@ var varOrTerm = {
11751
11793
  { GATE: () => C.parseMode.has("canParseVars"), ALT: () => SUBRULE(var_) },
11752
11794
  { ALT: () => SUBRULE(graphTerm) }
11753
11795
  ]),
11754
- gImpl: ({ SUBRULE }) => (ast, { factory: F3 }) => {
11796
+ gImpl: ({ SUBRULE }) => (ast, { astFactory: F3 }) => {
11755
11797
  if (F3.isTermVariable(ast)) {
11756
11798
  return SUBRULE(var_, ast);
11757
11799
  }
@@ -11772,9 +11814,9 @@ var var_ = {
11772
11814
  { ALT: () => CONSUME(terminals_exports.var1) },
11773
11815
  { ALT: () => CONSUME(terminals_exports.var2) }
11774
11816
  ]);
11775
- return ACTION(() => C.factory.variable(varToken.image.slice(1), C.factory.sourceLocation(varToken)));
11817
+ return ACTION(() => C.astFactory.variable(varToken.image.slice(1), C.astFactory.sourceLocation(varToken)));
11776
11818
  },
11777
- gImpl: ({ PRINT_WORD }) => (ast, { factory: F3 }) => {
11819
+ gImpl: ({ PRINT_WORD }) => (ast, { astFactory: F3 }) => {
11778
11820
  F3.printFilter(ast, () => PRINT_WORD(`?${ast.value}`));
11779
11821
  }
11780
11822
  };
@@ -11788,10 +11830,10 @@ var graphTerm = {
11788
11830
  { GATE: () => C.parseMode.has("canCreateBlankNodes"), ALT: () => SUBRULE(blankNode) },
11789
11831
  { ALT: () => {
11790
11832
  const tokenNil = CONSUME(terminals_exports.nil);
11791
- return ACTION(() => C.factory.namedNode(C.factory.sourceLocation(tokenNil), CommonIRIs.NIL));
11833
+ return ACTION(() => C.astFactory.namedNode(C.astFactory.sourceLocation(tokenNil), CommonIRIs.NIL));
11792
11834
  } }
11793
11835
  ]),
11794
- gImpl: ({ SUBRULE }) => (ast, { factory: F3 }) => {
11836
+ gImpl: ({ SUBRULE }) => (ast, { astFactory: F3 }) => {
11795
11837
  if (F3.isTermNamed(ast)) {
11796
11838
  SUBRULE(iri2, ast);
11797
11839
  } else if (F3.isTermLiteral(ast)) {
@@ -11811,14 +11853,14 @@ function datasetClauseUsing(name, token) {
11811
11853
  return OR([
11812
11854
  { ALT: () => {
11813
11855
  const iri3 = SUBRULE(defaultGraphClause);
11814
- return ACTION(() => C.factory.wrap({ clauseType: "default", value: iri3 }, C.factory.sourceLocation(start, iri3)));
11856
+ return ACTION(() => C.astFactory.wrap({ clauseType: "default", value: iri3 }, C.astFactory.sourceLocation(start, iri3)));
11815
11857
  } },
11816
11858
  { ALT: () => {
11817
11859
  const namedClause = SUBRULE(namedGraphClause);
11818
- return ACTION(() => C.factory.wrap({
11860
+ return ACTION(() => C.astFactory.wrap({
11819
11861
  clauseType: "named",
11820
11862
  value: namedClause.val
11821
- }, C.factory.sourceLocation(start, namedClause)));
11863
+ }, C.astFactory.sourceLocation(start, namedClause)));
11822
11864
  } }
11823
11865
  ]);
11824
11866
  }
@@ -11839,9 +11881,9 @@ function datasetClauseUsingStar(name, subRule, fromUsing) {
11839
11881
  const clause = SUBRULE(subRule);
11840
11882
  clauses.push(clause);
11841
11883
  });
11842
- return ACTION(() => C.factory.datasetClauses(clauses.map((clause) => clause.val), C.factory.sourceLocation(...clauses)));
11884
+ return ACTION(() => C.astFactory.datasetClauses(clauses.map((clause) => clause.val), C.astFactory.sourceLocation(...clauses)));
11843
11885
  },
11844
- gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F3 }) => {
11886
+ gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { astFactory: F3 }) => {
11845
11887
  for (const clause of ast.clauses) {
11846
11888
  F3.printFilter(ast, () => PRINT_WORD(fromUsing));
11847
11889
  if (clause.clauseType === "named") {
@@ -11859,7 +11901,7 @@ var namedGraphClause = {
11859
11901
  impl: ({ ACTION, SUBRULE, CONSUME }) => (C) => {
11860
11902
  const named2 = CONSUME(graph_exports.named);
11861
11903
  const iri3 = SUBRULE(sourceSelector);
11862
- return ACTION(() => C.factory.wrap(iri3, C.factory.sourceLocation(named2, iri3)));
11904
+ return ACTION(() => C.astFactory.wrap(iri3, C.astFactory.sourceLocation(named2, iri3)));
11863
11905
  }
11864
11906
  };
11865
11907
  var sourceSelector = {
@@ -11876,7 +11918,7 @@ function funcExpr1(func) {
11876
11918
  CONSUME(symbols_exports.LParen);
11877
11919
  const arg = SUBRULE(expression);
11878
11920
  const close = CONSUME(symbols_exports.RParen);
11879
- return ACTION(() => C.factory.expressionOperation(operator.image, [arg], C.factory.sourceLocation(operator, close)));
11921
+ return ACTION(() => C.astFactory.expressionOperation(operator.image, [arg], C.astFactory.sourceLocation(operator, close)));
11880
11922
  }
11881
11923
  };
11882
11924
  }
@@ -11890,7 +11932,7 @@ function funcExpr2(func) {
11890
11932
  CONSUME(symbols_exports.comma);
11891
11933
  const arg2 = SUBRULE2(expression);
11892
11934
  const close = CONSUME(symbols_exports.RParen);
11893
- return ACTION(() => C.factory.expressionOperation(operator.image, [arg1, arg2], C.factory.sourceLocation(operator, close)));
11935
+ return ACTION(() => C.astFactory.expressionOperation(operator.image, [arg1, arg2], C.astFactory.sourceLocation(operator, close)));
11894
11936
  }
11895
11937
  };
11896
11938
  }
@@ -11906,7 +11948,7 @@ function funcExpr3(func) {
11906
11948
  CONSUME2(symbols_exports.comma);
11907
11949
  const arg3 = SUBRULE3(expression);
11908
11950
  const close = CONSUME(symbols_exports.RParen);
11909
- return ACTION(() => C.factory.expressionOperation(operator.image, [arg1, arg2, arg3], C.factory.sourceLocation(operator, close)));
11951
+ return ACTION(() => C.astFactory.expressionOperation(operator.image, [arg1, arg2, arg3], C.astFactory.sourceLocation(operator, close)));
11910
11952
  }
11911
11953
  };
11912
11954
  }
@@ -11918,7 +11960,7 @@ function funcVar1(func) {
11918
11960
  CONSUME(symbols_exports.LParen);
11919
11961
  const arg = SUBRULE(var_);
11920
11962
  const close = CONSUME(symbols_exports.RParen);
11921
- return ACTION(() => C.factory.expressionOperation(operator.image, [arg], C.factory.sourceLocation(operator, close)));
11963
+ return ACTION(() => C.astFactory.expressionOperation(operator.image, [arg], C.astFactory.sourceLocation(operator, close)));
11922
11964
  }
11923
11965
  };
11924
11966
  }
@@ -11932,11 +11974,11 @@ function funcExprOrNil1(func) {
11932
11974
  CONSUME(symbols_exports.LParen);
11933
11975
  const arg = SUBRULE(expression);
11934
11976
  const close = CONSUME(symbols_exports.RParen);
11935
- return ACTION(() => C.factory.expressionOperation(operator.image, [arg], C.factory.sourceLocation(operator, close)));
11977
+ return ACTION(() => C.astFactory.expressionOperation(operator.image, [arg], C.astFactory.sourceLocation(operator, close)));
11936
11978
  } },
11937
11979
  { ALT: () => {
11938
11980
  const nil2 = CONSUME(terminals_exports.nil);
11939
- return ACTION(() => C.factory.expressionOperation(operator.image, [], C.factory.sourceLocation(operator, nil2)));
11981
+ return ACTION(() => C.astFactory.expressionOperation(operator.image, [], C.astFactory.sourceLocation(operator, nil2)));
11940
11982
  } }
11941
11983
  ]);
11942
11984
  }
@@ -11948,7 +11990,7 @@ function funcNil1(func) {
11948
11990
  impl: ({ ACTION, CONSUME }) => (C) => {
11949
11991
  const operator = CONSUME(func);
11950
11992
  const nil2 = CONSUME(terminals_exports.nil);
11951
- return ACTION(() => C.factory.expressionOperation(operator.image, [], C.factory.sourceLocation(operator, nil2)));
11993
+ return ACTION(() => C.astFactory.expressionOperation(operator.image, [], C.astFactory.sourceLocation(operator, nil2)));
11952
11994
  }
11953
11995
  };
11954
11996
  }
@@ -11958,7 +12000,7 @@ function funcExprList1(func) {
11958
12000
  impl: ({ ACTION, CONSUME, SUBRULE }) => (C) => {
11959
12001
  const operator = CONSUME(func);
11960
12002
  const args = SUBRULE(expressionList);
11961
- return ACTION(() => C.factory.expressionOperation(operator.image, args.val, C.factory.sourceLocation(operator, args)));
12003
+ return ACTION(() => C.astFactory.expressionOperation(operator.image, args.val, C.astFactory.sourceLocation(operator, args)));
11962
12004
  }
11963
12005
  };
11964
12006
  }
@@ -11976,7 +12018,7 @@ function funcExpr2or3(func) {
11976
12018
  return SUBRULE3(expression);
11977
12019
  });
11978
12020
  const close = CONSUME(symbols_exports.RParen);
11979
- return ACTION(() => C.factory.expressionOperation(operator.image, arg3 ? [arg1, arg2, arg3] : [arg1, arg2], C.factory.sourceLocation(operator, close)));
12021
+ return ACTION(() => C.astFactory.expressionOperation(operator.image, arg3 ? [arg1, arg2, arg3] : [arg1, arg2], C.astFactory.sourceLocation(operator, close)));
11980
12022
  }
11981
12023
  };
11982
12024
  }
@@ -11996,7 +12038,7 @@ function funcExpr3or4(func) {
11996
12038
  return SUBRULE4(expression);
11997
12039
  });
11998
12040
  const close = CONSUME(symbols_exports.RParen);
11999
- return ACTION(() => C.factory.expressionOperation(operator.image, arg4 ? [arg1, arg2, arg3, arg4] : [arg1, arg2, arg3], C.factory.sourceLocation(operator, close)));
12041
+ return ACTION(() => C.astFactory.expressionOperation(operator.image, arg4 ? [arg1, arg2, arg3, arg4] : [arg1, arg2, arg3], C.astFactory.sourceLocation(operator, close)));
12000
12042
  }
12001
12043
  };
12002
12044
  }
@@ -12006,7 +12048,7 @@ function funcGroupGraphPattern(func) {
12006
12048
  impl: ({ ACTION, SUBRULE, CONSUME }) => (C) => {
12007
12049
  const operator = CONSUME(func);
12008
12050
  const group = SUBRULE(groupGraphPattern);
12009
- return ACTION(() => C.factory.expressionPatternOperation(operator.image, group, C.factory.sourceLocation(operator, group)));
12051
+ return ACTION(() => C.astFactory.expressionPatternOperation(operator.image, group, C.astFactory.sourceLocation(operator, group)));
12010
12052
  }
12011
12053
  };
12012
12054
  }
@@ -12019,7 +12061,7 @@ function baseAggregateFunc(func) {
12019
12061
  const distinct2 = OPTION(() => CONSUME(distinct));
12020
12062
  const expr1 = SUBRULE(expression);
12021
12063
  const close = CONSUME(symbols_exports.RParen);
12022
- return ACTION(() => C.factory.aggregate(operator.image, distinct2 !== void 0, expr1, void 0, C.factory.sourceLocation(operator, close)));
12064
+ return ACTION(() => C.astFactory.aggregate(operator.image, distinct2 !== void 0, expr1, void 0, C.astFactory.sourceLocation(operator, close)));
12023
12065
  }
12024
12066
  };
12025
12067
  }
@@ -12159,17 +12201,17 @@ var aggregateCount = {
12159
12201
  const expressionVal = OR([
12160
12202
  { ALT: () => {
12161
12203
  const starToken = CONSUME(symbols_exports.star);
12162
- return ACTION(() => C.factory.wildcard(C.factory.sourceLocation(starToken)));
12204
+ return ACTION(() => C.astFactory.wildcard(C.astFactory.sourceLocation(starToken)));
12163
12205
  } },
12164
12206
  { ALT: () => SUBRULE(expression) }
12165
12207
  ]);
12166
12208
  const closeToken = CONSUME(symbols_exports.RParen);
12167
12209
  return ACTION(() => {
12168
- const F3 = C.factory;
12169
- if (C.factory.isWildcard(expressionVal)) {
12170
- return F3.aggregate(operatorToken.image, Boolean(distinctToken), expressionVal, void 0, C.factory.sourceLocation(operatorToken, closeToken));
12210
+ const F3 = C.astFactory;
12211
+ if (C.astFactory.isWildcard(expressionVal)) {
12212
+ return F3.aggregate(operatorToken.image, Boolean(distinctToken), expressionVal, void 0, C.astFactory.sourceLocation(operatorToken, closeToken));
12171
12213
  }
12172
- return F3.aggregate(operatorToken.image, Boolean(distinctToken), expressionVal, void 0, C.factory.sourceLocation(operatorToken, closeToken));
12214
+ return F3.aggregate(operatorToken.image, Boolean(distinctToken), expressionVal, void 0, C.astFactory.sourceLocation(operatorToken, closeToken));
12173
12215
  });
12174
12216
  }
12175
12217
  };
@@ -12193,7 +12235,7 @@ var aggregateGroup_concat = {
12193
12235
  });
12194
12236
  const closeToken = CONSUME(symbols_exports.RParen);
12195
12237
  return ACTION(() => {
12196
- const F3 = C.factory;
12238
+ const F3 = C.astFactory;
12197
12239
  return F3.aggregate(operatorToken.image, Boolean(distinctToken), expr, sep?.value ?? " ", F3.sourceLocation(operatorToken, closeToken));
12198
12240
  });
12199
12241
  }
@@ -12223,7 +12265,7 @@ var aggregate = {
12223
12265
  });
12224
12266
  return result;
12225
12267
  },
12226
- gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F3 }) => {
12268
+ gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { astFactory: F3 }) => {
12227
12269
  F3.printFilter(ast, () => {
12228
12270
  PRINT_WORD(ast.aggregation.toUpperCase(), "(");
12229
12271
  if (ast.distinct) {
@@ -12250,7 +12292,7 @@ var path = {
12250
12292
  };
12251
12293
  var pathGenerator = {
12252
12294
  name: "path",
12253
- gImpl: ({ PRINT, SUBRULE }) => (ast, { factory: F3 }, braces = true) => {
12295
+ gImpl: ({ PRINT, SUBRULE }) => (ast, { astFactory: F3 }, braces = true) => {
12254
12296
  if (F3.isTerm(ast) && F3.isTermNamed(ast)) {
12255
12297
  SUBRULE(iri2, ast);
12256
12298
  } else {
@@ -12299,7 +12341,7 @@ function pathChainHelper(name, SEP, subType, subRule) {
12299
12341
  tailEnd = SUBRULE2(subRule);
12300
12342
  tail.push(tailEnd);
12301
12343
  });
12302
- return ACTION(() => tail.length === 0 ? head2 : C.factory.path(subType, [head2, ...tail], C.factory.sourceLocation(head2, tailEnd)));
12344
+ return ACTION(() => tail.length === 0 ? head2 : C.astFactory.path(subType, [head2, ...tail], C.astFactory.sourceLocation(head2, tailEnd)));
12303
12345
  }
12304
12346
  };
12305
12347
  }
@@ -12310,7 +12352,7 @@ var pathEltOrInverse = {
12310
12352
  { ALT: () => {
12311
12353
  const hat2 = CONSUME(symbols_exports.hat);
12312
12354
  const item = SUBRULE2(pathElt);
12313
- return ACTION(() => C.factory.path("^", [item], C.factory.sourceLocation(hat2, item)));
12355
+ return ACTION(() => C.astFactory.path("^", [item], C.astFactory.sourceLocation(hat2, item)));
12314
12356
  } }
12315
12357
  ])
12316
12358
  };
@@ -12321,7 +12363,7 @@ var pathElt = {
12321
12363
  impl: ({ ACTION, SUBRULE, OPTION }) => (C) => {
12322
12364
  const item = SUBRULE(pathPrimary);
12323
12365
  const modification = OPTION(() => SUBRULE(pathMod));
12324
- return ACTION(() => modification === void 0 ? item : C.factory.path(modification.image, [item], C.factory.sourceLocation(item, modification)));
12366
+ return ACTION(() => modification === void 0 ? item : C.astFactory.path(modification.image, [item], C.astFactory.sourceLocation(item, modification)));
12325
12367
  }
12326
12368
  };
12327
12369
  var pathMod = {
@@ -12353,7 +12395,7 @@ var pathNegatedPropertySet = {
12353
12395
  return OR([
12354
12396
  { ALT: () => {
12355
12397
  const noAlternative = SUBRULE1(pathOneInPropertySet);
12356
- return ACTION(() => C.factory.path("!", [noAlternative], C.factory.sourceLocation(exclamation2, noAlternative)));
12398
+ return ACTION(() => C.astFactory.path("!", [noAlternative], C.astFactory.sourceLocation(exclamation2, noAlternative)));
12357
12399
  } },
12358
12400
  { ALT: () => {
12359
12401
  const open = CONSUME(symbols_exports.LParen);
@@ -12366,7 +12408,7 @@ var pathNegatedPropertySet = {
12366
12408
  });
12367
12409
  const close = CONSUME(symbols_exports.RParen);
12368
12410
  return ACTION(() => {
12369
- const F3 = C.factory;
12411
+ const F3 = C.astFactory;
12370
12412
  if (tail.length === 0) {
12371
12413
  return F3.path("!", [head2], F3.sourceLocation(exclamation2, close));
12372
12414
  }
@@ -12387,7 +12429,7 @@ var pathOneInPropertySet = {
12387
12429
  { ALT: () => SUBRULE2(iri2) },
12388
12430
  { ALT: () => SUBRULE2(verbA) }
12389
12431
  ]);
12390
- return ACTION(() => C.factory.path("^", [item], C.factory.sourceLocation(hat2, item)));
12432
+ return ACTION(() => C.astFactory.path("^", [item], C.astFactory.sourceLocation(hat2, item)));
12391
12433
  } }
12392
12434
  ])
12393
12435
  };
@@ -12412,33 +12454,35 @@ function triplesDotSeperated(triplesSameSubjectSubrule) {
12412
12454
  });
12413
12455
  }
12414
12456
  });
12415
- return ACTION(() => C.factory.patternBgp(triples, C.factory.sourceLocation(...triples, dotToken)));
12457
+ return ACTION(() => C.astFactory.patternBgp(triples, C.astFactory.sourceLocation(...triples, dotToken)));
12416
12458
  };
12417
12459
  }
12418
12460
  var triplesBlock = {
12419
12461
  name: "triplesBlock",
12420
12462
  impl: (implArgs) => (C) => triplesDotSeperated(triplesSameSubjectPath)(implArgs)(C),
12421
- gImpl: ({ SUBRULE, PRINT_WORD, HANDLE_LOC }) => (ast, { factory: F3 }) => {
12463
+ gImpl: ({ SUBRULE, PRINT_WORD, HANDLE_LOC }) => (ast, { astFactory: F3 }) => {
12422
12464
  for (const [index, triple] of ast.triples.entries()) {
12423
12465
  HANDLE_LOC(triple, () => {
12424
12466
  const nextTriple = ast.triples.at(index);
12425
12467
  if (F3.isTripleCollection(triple)) {
12426
12468
  SUBRULE(graphNodePath, triple);
12427
- F3.printFilter(triple, () => PRINT_WORD("."));
12469
+ F3.printFilter(triple, () => PRINT_WORD(".\n"));
12428
12470
  } else {
12429
12471
  SUBRULE(graphNodePath, triple.subject);
12472
+ F3.printFilter(triple, () => PRINT_WORD(""));
12430
12473
  if (F3.isTerm(triple.predicate) && F3.isTermVariable(triple.predicate)) {
12431
12474
  SUBRULE(varOrTerm, triple.predicate);
12432
12475
  } else {
12433
12476
  SUBRULE(pathGenerator, triple.predicate, void 0);
12434
12477
  }
12478
+ F3.printFilter(triple, () => PRINT_WORD(""));
12435
12479
  SUBRULE(graphNodePath, triple.object);
12436
12480
  if (nextTriple === void 0 || F3.isTripleCollection(nextTriple) || !F3.isSourceLocationNoMaterialize(nextTriple.subject.loc)) {
12437
- F3.printFilter(ast, () => PRINT_WORD("."));
12481
+ F3.printFilter(ast, () => PRINT_WORD(".\n"));
12438
12482
  } else if (F3.isSourceLocationNoMaterialize(nextTriple.predicate.loc)) {
12439
12483
  F3.printFilter(ast, () => PRINT_WORD(","));
12440
12484
  } else {
12441
- F3.printFilter(ast, () => PRINT_WORD(";"));
12485
+ F3.printFilter(ast, () => PRINT_WORD(";\n"));
12442
12486
  }
12443
12487
  }
12444
12488
  });
@@ -12451,24 +12495,24 @@ function triplesSameSubjectImpl(name, allowPaths) {
12451
12495
  impl: ({ ACTION, SUBRULE, OR }) => (C) => OR([
12452
12496
  { ALT: () => {
12453
12497
  const subject = SUBRULE(varOrTerm);
12454
- const res = SUBRULE(allowPaths ? propertyListPathNotEmpty : propertyListNotEmpty, ACTION(() => C.factory.dematerialized(subject)));
12498
+ const res = SUBRULE(allowPaths ? propertyListPathNotEmpty : propertyListNotEmpty, ACTION(() => C.astFactory.dematerialized(subject)));
12455
12499
  return ACTION(() => {
12456
12500
  if (res.length > 0) {
12457
12501
  res[0].subject = subject;
12458
- res[0].loc = C.factory.sourceLocation(subject, res[0]);
12502
+ res[0].loc = C.astFactory.sourceLocation(subject, res[0]);
12459
12503
  }
12460
12504
  return res;
12461
12505
  });
12462
12506
  } },
12463
12507
  { ALT: () => {
12464
12508
  const subjectNode = SUBRULE(allowPaths ? triplesNodePath : triplesNode);
12465
- const restNode = SUBRULE(allowPaths ? propertyListPath : propertyList, ACTION(() => C.factory.graphNodeIdentifier(subjectNode)));
12509
+ const restNode = SUBRULE(allowPaths ? propertyListPath : propertyList, ACTION(() => C.astFactory.graphNodeIdentifier(subjectNode)));
12466
12510
  return ACTION(() => {
12467
12511
  if (restNode.length === 0) {
12468
12512
  return [subjectNode];
12469
12513
  }
12470
12514
  restNode[0].subject = subjectNode;
12471
- restNode[0].loc = C.factory.sourceLocation(subjectNode, restNode[0]);
12515
+ restNode[0].loc = C.astFactory.sourceLocation(subjectNode, restNode[0]);
12472
12516
  return restNode;
12473
12517
  });
12474
12518
  } }
@@ -12552,7 +12596,7 @@ function objectImpl(name, allowPaths) {
12552
12596
  name,
12553
12597
  impl: ({ ACTION, SUBRULE }) => (C, subject, predicate) => {
12554
12598
  const node = SUBRULE(allowPaths ? graphNodePath : graphNode);
12555
- return ACTION(() => C.factory.triple(subject, predicate, node));
12599
+ return ACTION(() => C.astFactory.triple(subject, predicate, node));
12556
12600
  }
12557
12601
  };
12558
12602
  }
@@ -12569,7 +12613,7 @@ function collectionImpl(name, allowPaths) {
12569
12613
  });
12570
12614
  const endToken = CONSUME(symbols_exports.RParen);
12571
12615
  return ACTION(() => {
12572
- const F3 = C.factory;
12616
+ const F3 = C.astFactory;
12573
12617
  const triples = [];
12574
12618
  const predFirst = F3.namedNode(F3.sourceLocationNoMaterialize(), CommonIRIs.FIRST, void 0);
12575
12619
  const predRest = F3.namedNode(F3.sourceLocationNoMaterialize(), CommonIRIs.REST, void 0);
@@ -12593,7 +12637,7 @@ function collectionImpl(name, allowPaths) {
12593
12637
  return F3.tripleCollectionList(listHead, triples, F3.sourceLocation(startToken, endToken));
12594
12638
  });
12595
12639
  },
12596
- gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F3 }) => {
12640
+ gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { astFactory: F3 }) => {
12597
12641
  F3.printFilter(ast, () => PRINT_WORD("("));
12598
12642
  for (const [idx, triple] of ast.triples.entries()) {
12599
12643
  if (idx % 2 === 0) {
@@ -12624,13 +12668,17 @@ function blankNodePropertyListImpl(name, allowPaths) {
12624
12668
  name,
12625
12669
  impl: ({ ACTION, SUBRULE, CONSUME }) => (C) => {
12626
12670
  const startToken = CONSUME(symbols_exports.LSquare);
12627
- const blankNode2 = ACTION(() => C.factory.blankNode(void 0, C.factory.sourceLocationNoMaterialize()));
12671
+ const blankNode2 = ACTION(() => C.astFactory.blankNode(void 0, C.astFactory.sourceLocationNoMaterialize()));
12628
12672
  const propList = SUBRULE(propertyPathNotEmptyImpl, blankNode2);
12629
12673
  const endToken = CONSUME(symbols_exports.RSquare);
12630
- return ACTION(() => C.factory.tripleCollectionBlankNodeProperties(blankNode2, propList, C.factory.sourceLocation(startToken, endToken)));
12674
+ return ACTION(() => C.astFactory.tripleCollectionBlankNodeProperties(blankNode2, propList, C.astFactory.sourceLocation(startToken, endToken)));
12631
12675
  },
12632
- gImpl: ({ SUBRULE, PRINT, PRINT_WORD, HANDLE_LOC }) => (ast, { factory: F3 }) => {
12633
- F3.printFilter(ast, () => PRINT("["));
12676
+ gImpl: ({ SUBRULE, PRINT, PRINT_WORD, HANDLE_LOC, PRINT_ON_EMPTY }) => (ast, c) => {
12677
+ const { astFactory: F3, indentInc } = c;
12678
+ F3.printFilter(ast, () => {
12679
+ c[traqulaIndentation] += indentInc;
12680
+ PRINT("[\n");
12681
+ });
12634
12682
  for (const triple of ast.triples) {
12635
12683
  HANDLE_LOC(triple, () => {
12636
12684
  if (F3.isTerm(triple.predicate) && F3.isTermVariable(triple.predicate)) {
@@ -12638,11 +12686,15 @@ function blankNodePropertyListImpl(name, allowPaths) {
12638
12686
  } else {
12639
12687
  SUBRULE(pathGenerator, triple.predicate, void 0);
12640
12688
  }
12689
+ F3.printFilter(triple, () => PRINT_WORD(""));
12641
12690
  SUBRULE(graphNodePath, triple.object);
12642
- F3.printFilter(ast, () => PRINT_WORD(";"));
12691
+ F3.printFilter(ast, () => PRINT_WORD(";\n"));
12643
12692
  });
12644
12693
  }
12645
- F3.printFilter(ast, () => PRINT("]"));
12694
+ F3.printFilter(ast, () => {
12695
+ c[traqulaIndentation] -= indentInc;
12696
+ PRINT_ON_EMPTY("]");
12697
+ });
12646
12698
  }
12647
12699
  };
12648
12700
  }
@@ -12659,7 +12711,7 @@ function graphNodeImpl(name, allowPaths) {
12659
12711
  ALT: () => SUBRULE(triplesNodeRule)
12660
12712
  }
12661
12713
  ]),
12662
- gImpl: ({ SUBRULE }) => (ast, { factory: F3 }) => {
12714
+ gImpl: ({ SUBRULE }) => (ast, { astFactory: F3 }) => {
12663
12715
  if (F3.isTerm(ast)) {
12664
12716
  SUBRULE(varOrTerm, ast);
12665
12717
  } else {
@@ -12677,9 +12729,9 @@ var whereClause = {
12677
12729
  impl: ({ ACTION, SUBRULE, CONSUME, OPTION }) => (C) => {
12678
12730
  const where2 = OPTION(() => CONSUME(where));
12679
12731
  const group = SUBRULE(groupGraphPattern);
12680
- return ACTION(() => C.factory.wrap(group, C.factory.sourceLocation(where2, group)));
12732
+ return ACTION(() => C.astFactory.wrap(group, C.astFactory.sourceLocation(where2, group)));
12681
12733
  },
12682
- gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F3 }) => {
12734
+ gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { astFactory: F3 }) => {
12683
12735
  F3.printFilter(ast, () => PRINT_WORD("WHERE"));
12684
12736
  SUBRULE(groupGraphPattern, ast.val);
12685
12737
  }
@@ -12693,19 +12745,26 @@ var groupGraphPattern = {
12693
12745
  { ALT: () => SUBRULE(groupGraphPatternSub) }
12694
12746
  ]);
12695
12747
  const close = CONSUME(symbols_exports.RCurly);
12696
- return ACTION(() => C.factory.patternGroup(patterns, C.factory.sourceLocation(open, close)));
12748
+ return ACTION(() => C.astFactory.patternGroup(patterns, C.astFactory.sourceLocation(open, close)));
12697
12749
  },
12698
- gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F3 }) => {
12699
- F3.printFilter(ast, () => PRINT_WORD("{"));
12750
+ gImpl: ({ SUBRULE, PRINT_WORD, PRINT_ON_EMPTY }) => (ast, C) => {
12751
+ const { astFactory: F3, indentInc } = C;
12752
+ F3.printFilter(ast, () => {
12753
+ C[traqulaIndentation] += indentInc;
12754
+ PRINT_WORD("{\n");
12755
+ });
12700
12756
  for (const pattern of ast.patterns) {
12701
12757
  SUBRULE(generatePattern, pattern);
12702
12758
  }
12703
- F3.printFilter(ast, () => PRINT_WORD("}"));
12759
+ F3.printFilter(ast, () => {
12760
+ C[traqulaIndentation] -= indentInc;
12761
+ PRINT_ON_EMPTY("}\n");
12762
+ });
12704
12763
  }
12705
12764
  };
12706
12765
  var generatePattern = {
12707
12766
  name: "generatePattern",
12708
- gImpl: ({ SUBRULE }) => (ast, { factory: F3 }) => {
12767
+ gImpl: ({ SUBRULE }) => (ast, { astFactory: F3 }) => {
12709
12768
  if (ast.type === "query") {
12710
12769
  SUBRULE(query, F3.querySelect({
12711
12770
  context: [],
@@ -12794,9 +12853,9 @@ var optionalGraphPattern = {
12794
12853
  impl: ({ ACTION, SUBRULE, CONSUME }) => (C) => {
12795
12854
  const optional2 = CONSUME(optional);
12796
12855
  const group = SUBRULE(groupGraphPattern);
12797
- return ACTION(() => C.factory.patternOptional(group.patterns, C.factory.sourceLocation(optional2, group)));
12856
+ return ACTION(() => C.astFactory.patternOptional(group.patterns, C.astFactory.sourceLocation(optional2, group)));
12798
12857
  },
12799
- gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F3 }) => {
12858
+ gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { astFactory: F3 }) => {
12800
12859
  F3.printFilter(ast, () => PRINT_WORD("OPTIONAL"));
12801
12860
  SUBRULE(groupGraphPattern, F3.patternGroup(ast.patterns, ast.loc));
12802
12861
  }
@@ -12807,9 +12866,9 @@ var graphGraphPattern = {
12807
12866
  const graph2 = CONSUME(graph_exports.graph);
12808
12867
  const name = SUBRULE(varOrIri);
12809
12868
  const group = SUBRULE(groupGraphPattern);
12810
- return ACTION(() => C.factory.patternGraph(name, group.patterns, C.factory.sourceLocation(graph2, group)));
12869
+ return ACTION(() => C.astFactory.patternGraph(name, group.patterns, C.astFactory.sourceLocation(graph2, group)));
12811
12870
  },
12812
- gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F3 }) => {
12871
+ gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { astFactory: F3 }) => {
12813
12872
  F3.printFilter(ast, () => PRINT_WORD("GRAPH"));
12814
12873
  SUBRULE(varOrTerm, ast.name);
12815
12874
  SUBRULE(groupGraphPattern, F3.patternGroup(ast.patterns, ast.loc));
@@ -12825,9 +12884,9 @@ var serviceGraphPattern = {
12825
12884
  }) ?? false;
12826
12885
  const name = SUBRULE1(varOrIri);
12827
12886
  const group = SUBRULE1(groupGraphPattern);
12828
- return ACTION(() => C.factory.patternService(name, group.patterns, silent2, C.factory.sourceLocation(service2, group)));
12887
+ return ACTION(() => C.astFactory.patternService(name, group.patterns, silent2, C.astFactory.sourceLocation(service2, group)));
12829
12888
  },
12830
- gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F3 }) => {
12889
+ gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { astFactory: F3 }) => {
12831
12890
  F3.printFilter(ast, () => {
12832
12891
  PRINT_WORD("SERVICE");
12833
12892
  if (ast.silent) {
@@ -12847,14 +12906,14 @@ var bind2 = {
12847
12906
  CONSUME(as);
12848
12907
  const variable = SUBRULE(var_);
12849
12908
  const close = CONSUME(symbols_exports.RParen);
12850
- return ACTION(() => C.factory.patternBind(expressionVal, variable, C.factory.sourceLocation(bind3, close)));
12909
+ return ACTION(() => C.astFactory.patternBind(expressionVal, variable, C.astFactory.sourceLocation(bind3, close)));
12851
12910
  },
12852
- gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F3 }) => {
12911
+ gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { astFactory: F3 }) => {
12853
12912
  F3.printFilter(ast, () => PRINT_WORD("BIND", "("));
12854
12913
  SUBRULE(expression, ast.expression);
12855
12914
  F3.printFilter(ast, () => PRINT_WORD("AS"));
12856
12915
  SUBRULE(var_, ast.variable);
12857
- F3.printFilter(ast, () => PRINT_WORD(")"));
12916
+ F3.printFilter(ast, () => PRINT_WORD(")\n"));
12858
12917
  }
12859
12918
  };
12860
12919
  var inlineData = {
@@ -12862,16 +12921,19 @@ var inlineData = {
12862
12921
  impl: ({ ACTION, SUBRULE, CONSUME }) => (C) => {
12863
12922
  const values3 = CONSUME(values2);
12864
12923
  const datablock = SUBRULE(dataBlock);
12865
- return ACTION(() => C.factory.patternValues(datablock.val, C.factory.sourceLocation(values3, datablock)));
12924
+ return ACTION(() => C.astFactory.patternValues(datablock.val, C.astFactory.sourceLocation(values3, datablock)));
12866
12925
  },
12867
- gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F3 }) => {
12926
+ gImpl: ({ SUBRULE, PRINT_WORD, PRINT_ON_EMPTY }) => (ast, C) => {
12927
+ const { astFactory: F3, indentInc } = C;
12868
12928
  const variables = Object.keys(ast.values.at(0) ?? {});
12869
12929
  F3.printFilter(ast, () => {
12930
+ PRINT_ON_EMPTY("");
12870
12931
  PRINT_WORD("VALUES", "(");
12871
12932
  for (const variable of variables) {
12872
12933
  PRINT_WORD(`?${variable}`);
12873
12934
  }
12874
- PRINT_WORD(")", "{");
12935
+ C[traqulaIndentation] += indentInc;
12936
+ PRINT_WORD(")", "{\n");
12875
12937
  });
12876
12938
  for (const mapping of ast.values) {
12877
12939
  F3.printFilter(ast, () => PRINT_WORD("("));
@@ -12882,9 +12944,12 @@ var inlineData = {
12882
12944
  SUBRULE(graphNodePath, mapping[variable]);
12883
12945
  }
12884
12946
  }
12885
- F3.printFilter(ast, () => PRINT_WORD(")"));
12947
+ F3.printFilter(ast, () => PRINT_WORD(")\n"));
12886
12948
  }
12887
- F3.printFilter(ast, () => PRINT_WORD("}"));
12949
+ F3.printFilter(ast, () => {
12950
+ C[traqulaIndentation] -= indentInc;
12951
+ PRINT_ON_EMPTY("}\n");
12952
+ });
12888
12953
  }
12889
12954
  };
12890
12955
  var dataBlock = {
@@ -12907,7 +12972,7 @@ var inlineDataOneVar = {
12907
12972
  });
12908
12973
  });
12909
12974
  const close = CONSUME(symbols_exports.RCurly);
12910
- return ACTION(() => C.factory.wrap(res, C.factory.sourceLocation(varVal, close)));
12975
+ return ACTION(() => C.astFactory.wrap(res, C.astFactory.sourceLocation(varVal, close)));
12911
12976
  }
12912
12977
  };
12913
12978
  var inlineDataFull = {
@@ -12924,7 +12989,7 @@ var inlineDataFull = {
12924
12989
  res.push({});
12925
12990
  });
12926
12991
  const close = CONSUME1(symbols_exports.RCurly);
12927
- return ACTION(() => C.factory.wrap(res, C.factory.sourceLocation(nil2, close)));
12992
+ return ACTION(() => C.astFactory.wrap(res, C.astFactory.sourceLocation(nil2, close)));
12928
12993
  } },
12929
12994
  { ALT: () => {
12930
12995
  const open = CONSUME1(symbols_exports.LParen);
@@ -12956,7 +13021,7 @@ var inlineDataFull = {
12956
13021
  });
12957
13022
  });
12958
13023
  const close = CONSUME2(symbols_exports.RCurly);
12959
- return ACTION(() => C.factory.wrap(res, C.factory.sourceLocation(open, close)));
13024
+ return ACTION(() => C.astFactory.wrap(res, C.astFactory.sourceLocation(open, close)));
12960
13025
  } }
12961
13026
  ]);
12962
13027
  }
@@ -12979,9 +13044,9 @@ var minusGraphPattern = {
12979
13044
  impl: ({ ACTION, SUBRULE, CONSUME }) => (C) => {
12980
13045
  const minus2 = CONSUME(minus);
12981
13046
  const group = SUBRULE(groupGraphPattern);
12982
- return ACTION(() => C.factory.patternMinus(group.patterns, C.factory.sourceLocation(minus2, group)));
13047
+ return ACTION(() => C.astFactory.patternMinus(group.patterns, C.astFactory.sourceLocation(minus2, group)));
12983
13048
  },
12984
- gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F3 }) => {
13049
+ gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { astFactory: F3 }) => {
12985
13050
  F3.printFilter(ast, () => PRINT_WORD("MINUS"));
12986
13051
  SUBRULE(groupGraphPattern, F3.patternGroup(ast.patterns, ast.loc));
12987
13052
  }
@@ -12997,9 +13062,9 @@ var groupOrUnionGraphPattern = {
12997
13062
  const group2 = SUBRULE2(groupGraphPattern);
12998
13063
  groups.push(group2);
12999
13064
  });
13000
- return ACTION(() => groups.length === 1 ? groups[0] : C.factory.patternUnion(groups, C.factory.sourceLocation(group, groups.at(-1))));
13065
+ return ACTION(() => groups.length === 1 ? groups[0] : C.astFactory.patternUnion(groups, C.astFactory.sourceLocation(group, groups.at(-1))));
13001
13066
  },
13002
- gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F3 }) => {
13067
+ gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { astFactory: F3 }) => {
13003
13068
  if (F3.isPatternUnion(ast)) {
13004
13069
  const [head2, ...tail] = ast.patterns;
13005
13070
  SUBRULE(groupGraphPattern, head2);
@@ -13017,12 +13082,12 @@ var filter3 = {
13017
13082
  impl: ({ ACTION, SUBRULE, CONSUME }) => (C) => {
13018
13083
  const filterToken = CONSUME(filter2);
13019
13084
  const expression2 = SUBRULE(constraint);
13020
- return ACTION(() => C.factory.patternFilter(expression2, C.factory.sourceLocation(filterToken, expression2)));
13085
+ return ACTION(() => C.astFactory.patternFilter(expression2, C.astFactory.sourceLocation(filterToken, expression2)));
13021
13086
  },
13022
- gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F3 }) => {
13087
+ gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { astFactory: F3 }) => {
13023
13088
  F3.printFilter(ast, () => PRINT_WORD("FILTER ("));
13024
13089
  SUBRULE(expression, ast.expression);
13025
- F3.printFilter(ast, () => PRINT_WORD(")"));
13090
+ F3.printFilter(ast, () => PRINT_WORD(")\n"));
13026
13091
  }
13027
13092
  };
13028
13093
  var constraint = {
@@ -13038,7 +13103,7 @@ var functionCall = {
13038
13103
  impl: ({ ACTION, SUBRULE }) => (C) => {
13039
13104
  const func = SUBRULE(iri2);
13040
13105
  const args = SUBRULE(argList);
13041
- return ACTION(() => C.factory.expressionFunctionCall(func, args.val.args, args.val.distinct, C.factory.sourceLocation(func, args)));
13106
+ return ACTION(() => C.astFactory.expressionFunctionCall(func, args.val.args, args.val.distinct, C.astFactory.sourceLocation(func, args)));
13042
13107
  }
13043
13108
  };
13044
13109
 
@@ -13048,7 +13113,7 @@ var argList = {
13048
13113
  impl: ({ ACTION, CONSUME, SUBRULE1, OPTION, OR, AT_LEAST_ONE_SEP }) => (C) => OR([
13049
13114
  { ALT: () => {
13050
13115
  const nil2 = CONSUME(terminals_exports.nil);
13051
- return ACTION(() => C.factory.wrap({ args: [], distinct: false }, C.factory.sourceLocation(nil2)));
13116
+ return ACTION(() => C.astFactory.wrap({ args: [], distinct: false }, C.astFactory.sourceLocation(nil2)));
13052
13117
  } },
13053
13118
  { ALT: () => {
13054
13119
  const args = [];
@@ -13065,10 +13130,10 @@ var argList = {
13065
13130
  }
13066
13131
  });
13067
13132
  const close = CONSUME(symbols_exports.RParen);
13068
- return ACTION(() => C.factory.wrap({ args, distinct: distinct2 }, C.factory.sourceLocation(open, close)));
13133
+ return ACTION(() => C.astFactory.wrap({ args, distinct: distinct2 }, C.astFactory.sourceLocation(open, close)));
13069
13134
  } }
13070
13135
  ]),
13071
- gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F3 }) => {
13136
+ gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { astFactory: F3 }) => {
13072
13137
  F3.printFilter(ast, () => {
13073
13138
  PRINT_WORD("(");
13074
13139
  if (ast.val.distinct) {
@@ -13091,7 +13156,7 @@ var expressionList = {
13091
13156
  impl: ({ ACTION, CONSUME, MANY, OR, SUBRULE1, SUBRULE2 }) => (C) => OR([
13092
13157
  { ALT: () => {
13093
13158
  const nil2 = CONSUME(terminals_exports.nil);
13094
- return ACTION(() => C.factory.wrap([], C.factory.sourceLocation(nil2)));
13159
+ return ACTION(() => C.astFactory.wrap([], C.astFactory.sourceLocation(nil2)));
13095
13160
  } },
13096
13161
  { ALT: () => {
13097
13162
  const open = CONSUME(symbols_exports.LParen);
@@ -13103,7 +13168,7 @@ var expressionList = {
13103
13168
  args.push(expr);
13104
13169
  });
13105
13170
  const close = CONSUME(symbols_exports.RParen);
13106
- return ACTION(() => C.factory.wrap(args, C.factory.sourceLocation(open, close)));
13171
+ return ACTION(() => C.astFactory.wrap(args, C.astFactory.sourceLocation(open, close)));
13107
13172
  } }
13108
13173
  ])
13109
13174
  };
@@ -13112,7 +13177,7 @@ var prefixOperator = /* @__PURE__ */ new Set(["!", "UPLUS", "UMINUS"]);
13112
13177
  var expression = {
13113
13178
  name: "expression",
13114
13179
  impl: ({ SUBRULE }) => () => SUBRULE(conditionalOrExpression),
13115
- gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F3 }) => {
13180
+ gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { astFactory: F3 }) => {
13116
13181
  if (F3.isTerm(ast)) {
13117
13182
  SUBRULE(varOrTerm, ast);
13118
13183
  } else if (F3.isExpressionOperator(ast)) {
@@ -13177,7 +13242,7 @@ var conditionalOrExpression = {
13177
13242
  impl: ({ ACTION, MANY, CONSUME, SUBRULE1, SUBRULE2 }) => (C) => constructLeftDeep(() => SUBRULE1(conditionalAndExpression), () => {
13178
13243
  CONSUME(symbols_exports.logicOr);
13179
13244
  const args = SUBRULE2(conditionalAndExpression);
13180
- return (left) => ACTION(() => C.factory.expressionOperation("||", [left, args], C.factory.sourceLocation(left, args)));
13245
+ return (left) => ACTION(() => C.astFactory.expressionOperation("||", [left, args], C.astFactory.sourceLocation(left, args)));
13181
13246
  }, ACTION, MANY)
13182
13247
  };
13183
13248
  var conditionalAndExpression = {
@@ -13185,7 +13250,7 @@ var conditionalAndExpression = {
13185
13250
  impl: ({ ACTION, MANY, SUBRULE1, SUBRULE2, CONSUME }) => (C) => constructLeftDeep(() => SUBRULE1(valueLogical), () => {
13186
13251
  CONSUME(symbols_exports.logicAnd);
13187
13252
  const arg = SUBRULE2(valueLogical);
13188
- return (left) => ACTION(() => C.factory.expressionOperation("&&", [left, arg], C.factory.sourceLocation(left, arg)));
13253
+ return (left) => ACTION(() => C.astFactory.expressionOperation("&&", [left, arg], C.astFactory.sourceLocation(left, arg)));
13189
13254
  }, ACTION, MANY)
13190
13255
  };
13191
13256
  var valueLogical = {
@@ -13207,7 +13272,7 @@ var relationalExpression = {
13207
13272
  { ALT: () => CONSUME(symbols_exports.greaterThanEqual) }
13208
13273
  ]);
13209
13274
  const expr = SUBRULE2(numericExpression);
13210
- return ACTION(() => C.factory.expressionOperation(operator.image, [args1, expr], C.factory.sourceLocation(args1, expr)));
13275
+ return ACTION(() => C.astFactory.expressionOperation(operator.image, [args1, expr], C.astFactory.sourceLocation(args1, expr)));
13211
13276
  } },
13212
13277
  { ALT: () => {
13213
13278
  const operator = OR3([
@@ -13215,7 +13280,7 @@ var relationalExpression = {
13215
13280
  { ALT: () => CONSUME(notIn) }
13216
13281
  ]);
13217
13282
  const args = SUBRULE1(expressionList);
13218
- return ACTION(() => C.factory.expressionOperation(operator.image, [args1, ...args.val], C.factory.sourceLocation(args1, args)));
13283
+ return ACTION(() => C.astFactory.expressionOperation(operator.image, [args1, ...args.val], C.astFactory.sourceLocation(args1, args)));
13219
13284
  } }
13220
13285
  ]));
13221
13286
  return expression2 ?? args1;
@@ -13234,7 +13299,7 @@ var additiveExpression = {
13234
13299
  { ALT: () => CONSUME(symbols_exports.opMinus) }
13235
13300
  ]);
13236
13301
  const arg = SUBRULE2(multiplicativeExpression);
13237
- return ACTION(() => (left) => C.factory.expressionOperation(operator.image, [left, arg], C.factory.sourceLocation(left, arg)));
13302
+ return ACTION(() => (left) => C.astFactory.expressionOperation(operator.image, [left, arg], C.astFactory.sourceLocation(left, arg)));
13238
13303
  } },
13239
13304
  { ALT: () => {
13240
13305
  const { operator, startInt } = OR3([
@@ -13265,9 +13330,9 @@ var additiveExpression = {
13265
13330
  { ALT: () => CONSUME(symbols_exports.slash) }
13266
13331
  ]);
13267
13332
  const innerExpr = SUBRULE1(unaryExpression);
13268
- return ACTION(() => (leftInner) => C.factory.expressionOperation(innerOperator.image, [leftInner, innerExpr], C.factory.sourceLocation(leftInner, innerExpr)));
13333
+ return ACTION(() => (leftInner) => C.astFactory.expressionOperation(innerOperator.image, [leftInner, innerExpr], C.astFactory.sourceLocation(leftInner, innerExpr)));
13269
13334
  }, ACTION, MANY2);
13270
- return (left) => C.factory.expressionOperation(operator, [left, multiplicativeExpr], C.factory.sourceLocation(left, multiplicativeExpr));
13335
+ return (left) => C.astFactory.expressionOperation(operator, [left, multiplicativeExpr], C.astFactory.sourceLocation(left, multiplicativeExpr));
13271
13336
  } }
13272
13337
  ]), ACTION, MANY1)
13273
13338
  };
@@ -13284,7 +13349,7 @@ var multiplicativeExpression = {
13284
13349
  subType: "operation",
13285
13350
  operator: operator.image,
13286
13351
  args: [left, expr],
13287
- loc: C.factory.sourceLocation(left, expr)
13352
+ loc: C.astFactory.sourceLocation(left, expr)
13288
13353
  });
13289
13354
  }, ACTION, MANY)
13290
13355
  };
@@ -13299,7 +13364,7 @@ var unaryExpression = {
13299
13364
  { ALT: () => CONSUME(symbols_exports.opMinus) }
13300
13365
  ]);
13301
13366
  const expr = SUBRULE2(primaryExpression);
13302
- return ACTION(() => C.factory.expressionOperation(operator.image === "!" ? "!" : operator.image === "+" ? "UPLUS" : "UMINUS", [expr], C.factory.sourceLocation(operator, expr)));
13367
+ return ACTION(() => C.astFactory.expressionOperation(operator.image === "!" ? "!" : operator.image === "+" ? "UPLUS" : "UMINUS", [expr], C.astFactory.sourceLocation(operator, expr)));
13303
13368
  } }
13304
13369
  ])
13305
13370
  };
@@ -13322,7 +13387,7 @@ var brackettedExpression = {
13322
13387
  const expr = SUBRULE(expression);
13323
13388
  const close = CONSUME(symbols_exports.RParen);
13324
13389
  return ACTION(() => {
13325
- expr.loc = C.factory.sourceLocation(open, close);
13390
+ expr.loc = C.astFactory.sourceLocation(open, close);
13326
13391
  return expr;
13327
13392
  });
13328
13393
  }
@@ -13344,13 +13409,13 @@ var iriOrFunction = {
13344
13409
  function: iriVal,
13345
13410
  args: args.val.args,
13346
13411
  distinct: distinct2,
13347
- loc: C.factory.sourceLocation(iriVal, args)
13412
+ loc: C.astFactory.sourceLocation(iriVal, args)
13348
13413
  };
13349
13414
  });
13350
13415
  });
13351
13416
  return functionCall2 ?? iriVal;
13352
13417
  },
13353
- gImpl: ({ SUBRULE }) => (ast, { factory: F3 }) => {
13418
+ gImpl: ({ SUBRULE }) => (ast, { astFactory: F3 }) => {
13354
13419
  if (F3.isTermNamed(ast)) {
13355
13420
  SUBRULE(iri2, ast);
13356
13421
  } else {
@@ -13403,11 +13468,14 @@ var groupClause = {
13403
13468
  type: "solutionModifier",
13404
13469
  subType: "group",
13405
13470
  groupings,
13406
- loc: C.factory.sourceLocation(start, groupings.at(-1))
13471
+ loc: C.astFactory.sourceLocation(start, groupings.at(-1))
13407
13472
  }));
13408
13473
  },
13409
- gImpl: ({ PRINT_WORDS, SUBRULE }) => (ast, { factory: F3 }) => {
13410
- F3.printFilter(ast, () => PRINT_WORDS("GROUP", "BY"));
13474
+ gImpl: ({ PRINT_WORDS, SUBRULE, PRINT_ON_EMPTY }) => (ast, { astFactory: F3 }) => {
13475
+ F3.printFilter(ast, () => {
13476
+ PRINT_ON_EMPTY("");
13477
+ PRINT_WORDS("GROUP", "BY");
13478
+ });
13411
13479
  for (const grouping of ast.groupings) {
13412
13480
  if (F3.isExpression(grouping)) {
13413
13481
  SUBRULE(expression, grouping);
@@ -13441,7 +13509,7 @@ var groupCondition = {
13441
13509
  return {
13442
13510
  variable,
13443
13511
  value: expressionValue,
13444
- loc: C.factory.sourceLocation(open, close)
13512
+ loc: C.astFactory.sourceLocation(open, close)
13445
13513
  };
13446
13514
  }
13447
13515
  return expressionValue;
@@ -13460,10 +13528,13 @@ var havingClause = {
13460
13528
  expressions.push(SUBRULE(havingCondition));
13461
13529
  });
13462
13530
  ACTION(() => !couldParseAgg && C.parseMode.delete("canParseAggregate"));
13463
- return ACTION(() => C.factory.solutionModifierHaving(expressions, C.factory.sourceLocation(having2, expressions.at(-1))));
13531
+ return ACTION(() => C.astFactory.solutionModifierHaving(expressions, C.astFactory.sourceLocation(having2, expressions.at(-1))));
13464
13532
  },
13465
- gImpl: ({ PRINT_WORD, SUBRULE }) => (ast, { factory: F3 }) => {
13466
- F3.printFilter(ast, () => PRINT_WORD("HAVING"));
13533
+ gImpl: ({ PRINT_WORD, PRINT_ON_EMPTY, SUBRULE }) => (ast, { astFactory: F3 }) => {
13534
+ F3.printFilter(ast, () => {
13535
+ PRINT_ON_EMPTY("");
13536
+ PRINT_WORD("HAVING");
13537
+ });
13467
13538
  for (const having2 of ast.having) {
13468
13539
  SUBRULE(expression, having2);
13469
13540
  }
@@ -13484,10 +13555,13 @@ var orderClause = {
13484
13555
  orderings.push(SUBRULE1(orderCondition));
13485
13556
  });
13486
13557
  ACTION(() => !couldParseAgg && C.parseMode.delete("canParseAggregate"));
13487
- return ACTION(() => C.factory.solutionModifierOrder(orderings, C.factory.sourceLocation(order2, orderings.at(-1))));
13558
+ return ACTION(() => C.astFactory.solutionModifierOrder(orderings, C.astFactory.sourceLocation(order2, orderings.at(-1))));
13488
13559
  },
13489
- gImpl: ({ PRINT_WORDS, SUBRULE }) => (ast, { factory: F3 }) => {
13490
- F3.printFilter(ast, () => PRINT_WORDS("ORDER", "BY"));
13560
+ gImpl: ({ PRINT_WORDS, PRINT_ON_EMPTY, SUBRULE }) => (ast, { astFactory: F3 }) => {
13561
+ F3.printFilter(ast, () => {
13562
+ PRINT_ON_EMPTY("");
13563
+ PRINT_WORDS("ORDER", "BY");
13564
+ });
13491
13565
  for (const ordering of ast.orderDefs) {
13492
13566
  if (ordering.descending) {
13493
13567
  F3.printFilter(ast, () => PRINT_WORDS("DESC"));
@@ -13518,7 +13592,7 @@ var orderCondition = {
13518
13592
  return ACTION(() => ({
13519
13593
  expression: expr,
13520
13594
  descending: descending[0],
13521
- loc: C.factory.sourceLocation(descending[1], expr)
13595
+ loc: C.astFactory.sourceLocation(descending[1], expr)
13522
13596
  }));
13523
13597
  } },
13524
13598
  { ALT: () => {
@@ -13537,16 +13611,17 @@ var limitOffsetClauses = {
13537
13611
  { ALT: () => {
13538
13612
  const limit2 = SUBRULE1(limitClause);
13539
13613
  const offset2 = OPTION1(() => SUBRULE1(offsetClause));
13540
- return ACTION(() => C.factory.solutionModifierLimitOffset(limit2.val, offset2?.val, C.factory.sourceLocation(limit2, ...offset2 ? [offset2] : [])));
13614
+ return ACTION(() => C.astFactory.solutionModifierLimitOffset(limit2.val, offset2?.val, C.astFactory.sourceLocation(limit2, ...offset2 ? [offset2] : [])));
13541
13615
  } },
13542
13616
  { ALT: () => {
13543
13617
  const offset2 = SUBRULE2(offsetClause);
13544
13618
  const limit2 = OPTION2(() => SUBRULE2(limitClause));
13545
- return ACTION(() => C.factory.solutionModifierLimitOffset(limit2?.val, offset2.val, C.factory.sourceLocation(offset2, limit2)));
13619
+ return ACTION(() => C.astFactory.solutionModifierLimitOffset(limit2?.val, offset2.val, C.astFactory.sourceLocation(offset2, limit2)));
13546
13620
  } }
13547
13621
  ]),
13548
- gImpl: ({ PRINT_WORDS }) => (ast, { factory: F3 }) => {
13622
+ gImpl: ({ PRINT_WORDS, PRINT_ON_EMPTY }) => (ast, { astFactory: F3 }) => {
13549
13623
  F3.printFilter(ast, () => {
13624
+ PRINT_ON_EMPTY("");
13550
13625
  if (ast.limit) {
13551
13626
  PRINT_WORDS("LIMIT", String(ast.limit));
13552
13627
  }
@@ -13562,7 +13637,7 @@ var limitClause = {
13562
13637
  const offset2 = CONSUME(limit);
13563
13638
  const value = CONSUME(terminals_exports.integer);
13564
13639
  const val = Number.parseInt(value.image, 10);
13565
- return ACTION(() => C.factory.wrap(val, C.factory.sourceLocation(offset2, value)));
13640
+ return ACTION(() => C.astFactory.wrap(val, C.astFactory.sourceLocation(offset2, value)));
13566
13641
  }
13567
13642
  };
13568
13643
  var offsetClause = {
@@ -13571,7 +13646,7 @@ var offsetClause = {
13571
13646
  const offset2 = CONSUME(offset);
13572
13647
  const value = CONSUME(terminals_exports.integer);
13573
13648
  const val = Number.parseInt(value.image, 10);
13574
- return ACTION(() => C.factory.wrap(val, C.factory.sourceLocation(offset2, value)));
13649
+ return ACTION(() => C.astFactory.wrap(val, C.astFactory.sourceLocation(offset2, value)));
13575
13650
  }
13576
13651
  };
13577
13652
 
@@ -13596,10 +13671,10 @@ var query = {
13596
13671
  ...subType,
13597
13672
  type: "query",
13598
13673
  ...values3 && { values: values3 },
13599
- loc: C.factory.sourceLocation(prologueValues.at(0), subType, values3)
13674
+ loc: C.astFactory.sourceLocation(prologueValues.at(0), subType, values3)
13600
13675
  }));
13601
13676
  },
13602
- gImpl: ({ SUBRULE }) => (ast, { factory: F3 }) => {
13677
+ gImpl: ({ SUBRULE }) => (ast, { astFactory: F3 }) => {
13603
13678
  SUBRULE(prologue, ast.context);
13604
13679
  if (F3.isQuerySelect(ast)) {
13605
13680
  SUBRULE(selectQuery, ast);
@@ -13629,13 +13704,13 @@ var selectQuery = {
13629
13704
  solutionModifiers: modifiers,
13630
13705
  datasets: from2,
13631
13706
  ...selectVal.val,
13632
- loc: C.factory.sourceLocation(selectVal, where2, modifiers.group, modifiers.having, modifiers.order, modifiers.limitOffset)
13707
+ loc: C.astFactory.sourceLocation(selectVal, where2, modifiers.group, modifiers.having, modifiers.order, modifiers.limitOffset)
13633
13708
  };
13634
13709
  queryIsGood(ret);
13635
13710
  return ret;
13636
13711
  });
13637
13712
  },
13638
- gImpl: ({ SUBRULE }) => (ast, { factory: F3 }) => {
13713
+ gImpl: ({ SUBRULE }) => (ast, { astFactory: F3 }) => {
13639
13714
  SUBRULE(selectClause, F3.wrap({
13640
13715
  variables: ast.variables,
13641
13716
  distinct: ast.distinct,
@@ -13653,14 +13728,14 @@ var subSelect = {
13653
13728
  const where2 = SUBRULE(whereClause);
13654
13729
  const modifiers = SUBRULE(solutionModifier);
13655
13730
  const values3 = SUBRULE(valuesClause);
13656
- return ACTION(() => C.factory.querySelect({
13731
+ return ACTION(() => C.astFactory.querySelect({
13657
13732
  where: where2.val,
13658
- datasets: C.factory.datasetClauses([], C.factory.sourceLocation()),
13733
+ datasets: C.astFactory.datasetClauses([], C.astFactory.sourceLocation()),
13659
13734
  context: [],
13660
13735
  solutionModifiers: modifiers,
13661
13736
  ...selectVal.val,
13662
13737
  ...values3 && { values: values3 }
13663
- }, C.factory.sourceLocation(selectVal, where2, modifiers.group, modifiers.having, modifiers.order, modifiers.limitOffset, values3)));
13738
+ }, C.astFactory.sourceLocation(selectVal, where2, modifiers.group, modifiers.having, modifiers.order, modifiers.limitOffset, values3)));
13664
13739
  }
13665
13740
  };
13666
13741
  var selectClause = {
@@ -13691,7 +13766,7 @@ var selectClause = {
13691
13766
  const star2 = CONSUME(symbols_exports.star);
13692
13767
  return ACTION(() => {
13693
13768
  last2 = star2;
13694
- return { variables: [C.factory.wildcard(C.factory.sourceLocation(star2))], ...distRed };
13769
+ return { variables: [C.astFactory.wildcard(C.astFactory.sourceLocation(star2))], ...distRed };
13695
13770
  });
13696
13771
  } },
13697
13772
  { ALT: () => {
@@ -13721,7 +13796,7 @@ var selectClause = {
13721
13796
  throw new Error(`Variable ${variable.value} used more than once in SELECT clause`);
13722
13797
  }
13723
13798
  usedVars.push(variable);
13724
- variables.push(C.factory.patternBind(expr, variable, C.factory.sourceLocation(open, last2)));
13799
+ variables.push(C.astFactory.patternBind(expr, variable, C.astFactory.sourceLocation(open, last2)));
13725
13800
  });
13726
13801
  } }
13727
13802
  ]));
@@ -13729,9 +13804,9 @@ var selectClause = {
13729
13804
  } }
13730
13805
  ]);
13731
13806
  ACTION(() => !couldParseAgg && C.parseMode.delete("canParseAggregate"));
13732
- return ACTION(() => C.factory.wrap(val, C.factory.sourceLocation(select2, last2)));
13807
+ return ACTION(() => C.astFactory.wrap(val, C.astFactory.sourceLocation(select2, last2)));
13733
13808
  },
13734
- gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F3 }) => {
13809
+ gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { astFactory: F3 }) => {
13735
13810
  F3.printFilter(ast, () => {
13736
13811
  PRINT_WORD("SELECT");
13737
13812
  if (ast.val.distinct) {
@@ -13771,7 +13846,7 @@ var constructQuery = {
13771
13846
  datasets: from2,
13772
13847
  where: where2.val,
13773
13848
  solutionModifiers: modifiers,
13774
- loc: C.factory.sourceLocation(construct2, where2, modifiers.group, modifiers.having, modifiers.order, modifiers.limitOffset)
13849
+ loc: C.astFactory.sourceLocation(construct2, where2, modifiers.group, modifiers.having, modifiers.order, modifiers.limitOffset)
13775
13850
  }));
13776
13851
  } },
13777
13852
  { ALT: () => {
@@ -13783,19 +13858,26 @@ var constructQuery = {
13783
13858
  subType: "construct",
13784
13859
  template: template.val,
13785
13860
  datasets: from2,
13786
- where: C.factory.patternGroup([template.val], C.factory.sourceLocation()),
13861
+ where: C.astFactory.patternGroup([template.val], C.astFactory.sourceLocation()),
13787
13862
  solutionModifiers: modifiers,
13788
- loc: C.factory.sourceLocation(construct2, template, modifiers.group, modifiers.having, modifiers.order, modifiers.limitOffset)
13863
+ loc: C.astFactory.sourceLocation(construct2, template, modifiers.group, modifiers.having, modifiers.order, modifiers.limitOffset)
13789
13864
  }));
13790
13865
  } }
13791
13866
  ]);
13792
13867
  },
13793
- gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F3 }) => {
13868
+ gImpl: ({ SUBRULE, PRINT_WORD, PRINT_ON_EMPTY }) => (ast, C) => {
13869
+ const { astFactory: F3, indentInc } = C;
13794
13870
  F3.printFilter(ast, () => PRINT_WORD("CONSTRUCT"));
13795
13871
  if (!F3.isSourceLocationNoMaterialize(ast.where.loc)) {
13796
- F3.printFilter(ast, () => PRINT_WORD("{"));
13872
+ F3.printFilter(ast, () => {
13873
+ C[traqulaIndentation] += indentInc;
13874
+ PRINT_WORD("{\n");
13875
+ });
13797
13876
  SUBRULE(triplesBlock, ast.template);
13798
- F3.printFilter(ast, () => PRINT_WORD("}"));
13877
+ F3.printFilter(ast, () => {
13878
+ C[traqulaIndentation] -= indentInc;
13879
+ PRINT_ON_EMPTY("}\n");
13880
+ });
13799
13881
  }
13800
13882
  SUBRULE(datasetClauseStar, ast.datasets);
13801
13883
  if (F3.isSourceLocationNoMaterialize(ast.where.loc)) {
@@ -13820,7 +13902,7 @@ var describeQuery = {
13820
13902
  } },
13821
13903
  { ALT: () => {
13822
13904
  const star2 = CONSUME(symbols_exports.star);
13823
- return [ACTION(() => C.factory.wildcard(C.factory.sourceLocation(star2)))];
13905
+ return [ACTION(() => C.astFactory.wildcard(C.astFactory.sourceLocation(star2)))];
13824
13906
  } }
13825
13907
  ]);
13826
13908
  const from2 = SUBRULE1(datasetClauseStar);
@@ -13832,10 +13914,10 @@ var describeQuery = {
13832
13914
  datasets: from2,
13833
13915
  ...where2 && { where: where2.val },
13834
13916
  solutionModifiers: modifiers,
13835
- loc: C.factory.sourceLocation(describe2, ...variables, from2, where2, modifiers.group, modifiers.having, modifiers.order, modifiers.limitOffset)
13917
+ loc: C.astFactory.sourceLocation(describe2, ...variables, from2, where2, modifiers.group, modifiers.having, modifiers.order, modifiers.limitOffset)
13836
13918
  }));
13837
13919
  },
13838
- gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F3 }) => {
13920
+ gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { astFactory: F3 }) => {
13839
13921
  F3.printFilter(ast, () => PRINT_WORD("DESCRIBE"));
13840
13922
  if (F3.isWildcard(ast.variables[0])) {
13841
13923
  F3.printFilter(ast, () => PRINT_WORD("*"));
@@ -13863,10 +13945,10 @@ var askQuery = {
13863
13945
  datasets: from2,
13864
13946
  where: where2.val,
13865
13947
  solutionModifiers: modifiers,
13866
- loc: C.factory.sourceLocation(ask2, from2, where2, modifiers.group, modifiers.having, modifiers.order, modifiers.limitOffset)
13948
+ loc: C.astFactory.sourceLocation(ask2, from2, where2, modifiers.group, modifiers.having, modifiers.order, modifiers.limitOffset)
13867
13949
  }));
13868
13950
  },
13869
- gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F3 }) => {
13951
+ gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { astFactory: F3 }) => {
13870
13952
  F3.printFilter(ast, () => PRINT_WORD("ASK"));
13871
13953
  SUBRULE(datasetClauseStar, ast.datasets);
13872
13954
  SUBRULE(whereClause, F3.wrap(ast.where, ast.loc));
@@ -13883,7 +13965,7 @@ var constructTemplate = {
13883
13965
  const open = CONSUME(symbols_exports.LCurly);
13884
13966
  const triples = OPTION(() => SUBRULE1(constructTriples));
13885
13967
  const close = CONSUME(symbols_exports.RCurly);
13886
- return ACTION(() => C.factory.wrap(triples ?? C.factory.patternBgp([], C.factory.sourceLocation()), C.factory.sourceLocation(open, close)));
13968
+ return ACTION(() => C.astFactory.wrap(triples ?? C.astFactory.patternBgp([], C.astFactory.sourceLocation()), C.astFactory.sourceLocation(open, close)));
13887
13969
  }
13888
13970
  };
13889
13971
  var constructTriples = {
@@ -13920,13 +14002,13 @@ var update = {
13920
14002
  const update2 = {
13921
14003
  type: "update",
13922
14004
  updates,
13923
- loc: C.factory.sourceLocation(...updates[0].context, updates[0].operation, ...updates.at(-1).context, updates.at(-1)?.operation)
14005
+ loc: C.astFactory.sourceLocation(...updates[0].context, updates[0].operation, ...updates.at(-1).context, updates.at(-1)?.operation)
13924
14006
  };
13925
14007
  updateNoReuseBlankNodeLabels(update2);
13926
14008
  return update2;
13927
14009
  });
13928
14010
  },
13929
- gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F3 }) => {
14011
+ gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { astFactory: F3 }) => {
13930
14012
  const [head2, ...tail] = ast.updates;
13931
14013
  if (head2) {
13932
14014
  SUBRULE(prologue, head2.context);
@@ -14006,9 +14088,9 @@ var load2 = {
14006
14088
  CONSUME(loadInto);
14007
14089
  return SUBRULE1(graphRef);
14008
14090
  });
14009
- return ACTION(() => C.factory.updateOperationLoad(C.factory.sourceLocation(loadToken, source, destination), source, Boolean(silent2), destination));
14091
+ return ACTION(() => C.astFactory.updateOperationLoad(C.astFactory.sourceLocation(loadToken, source, destination), source, Boolean(silent2), destination));
14010
14092
  },
14011
- gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F3 }) => {
14093
+ gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { astFactory: F3 }) => {
14012
14094
  F3.printFilter(ast, () => {
14013
14095
  PRINT_WORD("LOAD");
14014
14096
  if (ast.silent) {
@@ -14029,9 +14111,9 @@ function clearOrDrop(operation) {
14029
14111
  const opToken = CONSUME(operation);
14030
14112
  const silent2 = OPTION(() => CONSUME(silent));
14031
14113
  const destination = SUBRULE1(graphRefAll);
14032
- return ACTION(() => C.factory.updateOperationClearDrop(unCapitalize(operation.name), Boolean(silent2), destination, C.factory.sourceLocation(opToken, destination)));
14114
+ return ACTION(() => C.astFactory.updateOperationClearDrop(unCapitalize(operation.name), Boolean(silent2), destination, C.astFactory.sourceLocation(opToken, destination)));
14033
14115
  },
14034
- gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F3 }) => {
14116
+ gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { astFactory: F3 }) => {
14035
14117
  F3.printFilter(ast, () => {
14036
14118
  PRINT_WORD(operation.name.toUpperCase());
14037
14119
  if (ast.silent) {
@@ -14050,9 +14132,9 @@ var create2 = {
14050
14132
  const createToken3 = CONSUME(create);
14051
14133
  const silent2 = OPTION(() => CONSUME(silent));
14052
14134
  const destination = SUBRULE1(graphRef);
14053
- return ACTION(() => C.factory.updateOperationCreate(destination, Boolean(silent2), C.factory.sourceLocation(createToken3, destination)));
14135
+ return ACTION(() => C.astFactory.updateOperationCreate(destination, Boolean(silent2), C.astFactory.sourceLocation(createToken3, destination)));
14054
14136
  },
14055
- gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F3 }) => {
14137
+ gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { astFactory: F3 }) => {
14056
14138
  F3.printFilter(ast, () => {
14057
14139
  PRINT_WORD("CREATE");
14058
14140
  if (ast.silent) {
@@ -14071,9 +14153,9 @@ function copyMoveAddOperation(operation) {
14071
14153
  const source = SUBRULE1(graphOrDefault);
14072
14154
  CONSUME(to);
14073
14155
  const destination = SUBRULE2(graphOrDefault);
14074
- return ACTION(() => C.factory.updateOperationAddMoveCopy(unCapitalize(operation.name), source, destination, Boolean(silent2), C.factory.sourceLocation(op, destination)));
14156
+ return ACTION(() => C.astFactory.updateOperationAddMoveCopy(unCapitalize(operation.name), source, destination, Boolean(silent2), C.astFactory.sourceLocation(op, destination)));
14075
14157
  },
14076
- gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F3 }) => {
14158
+ gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { astFactory: F3 }) => {
14077
14159
  F3.printFilter(ast, () => {
14078
14160
  PRINT_WORD(operation.name.toUpperCase());
14079
14161
  if (ast.silent) {
@@ -14095,7 +14177,7 @@ var quadPattern = {
14095
14177
  const open = CONSUME(symbols_exports.LCurly);
14096
14178
  const val = SUBRULE1(quads);
14097
14179
  const close = CONSUME(symbols_exports.RCurly);
14098
- return ACTION(() => C.factory.wrap(val.val, C.factory.sourceLocation(open, close)));
14180
+ return ACTION(() => C.astFactory.wrap(val.val, C.astFactory.sourceLocation(open, close)));
14099
14181
  }
14100
14182
  };
14101
14183
  var quadData = {
@@ -14106,7 +14188,7 @@ var quadData = {
14106
14188
  const val = SUBRULE1(quads);
14107
14189
  ACTION(() => couldParseVars && C.parseMode.add("canParseVars"));
14108
14190
  const close = CONSUME(symbols_exports.RCurly);
14109
- return ACTION(() => C.factory.wrap(val.val, C.factory.sourceLocation(open, close)));
14191
+ return ACTION(() => C.astFactory.wrap(val.val, C.astFactory.sourceLocation(open, close)));
14110
14192
  }
14111
14193
  };
14112
14194
  function insertDeleteDelWhere(name, subType, cons1, cons2, dataRule) {
@@ -14123,12 +14205,26 @@ function insertDeleteDelWhere(name, subType, cons1, cons2, dataRule) {
14123
14205
  if (name !== "insertData") {
14124
14206
  ACTION(() => couldCreateBlankNodes && C.parseMode.add("canCreateBlankNodes"));
14125
14207
  }
14126
- return ACTION(() => C.factory.updateOperationInsDelDataWhere(subType, data.val, C.factory.sourceLocation(insDelToken, data)));
14208
+ return ACTION(() => C.astFactory.updateOperationInsDelDataWhere(subType, data.val, C.astFactory.sourceLocation(insDelToken, data)));
14127
14209
  },
14128
- gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F3 }) => {
14129
- F3.printFilter(ast, () => PRINT_WORD(subType === "insertdata" ? "INSERT DATA" : subType === "deletedata" ? "DELETE DATA" : "DELETE WHERE", "{"));
14210
+ gImpl: ({ SUBRULE, PRINT_WORD, PRINT_ON_EMPTY }) => (ast, C) => {
14211
+ const { astFactory: F3, indentInc } = C;
14212
+ F3.printFilter(ast, () => {
14213
+ C[traqulaIndentation] += indentInc;
14214
+ if (subType === "insertdata") {
14215
+ PRINT_WORD("INSERT DATA");
14216
+ } else if (subType === "deletedata") {
14217
+ PRINT_WORD("DELETE DATA");
14218
+ } else if (subType === "deletewhere") {
14219
+ PRINT_WORD("DELETE WHERE");
14220
+ }
14221
+ PRINT_WORD("{\n");
14222
+ });
14130
14223
  SUBRULE(quads, F3.wrap(ast.data, ast.loc));
14131
- F3.printFilter(ast, () => PRINT_WORD("}"));
14224
+ F3.printFilter(ast, () => {
14225
+ C[traqulaIndentation] -= indentInc;
14226
+ PRINT_ON_EMPTY("}\n");
14227
+ });
14132
14228
  }
14133
14229
  };
14134
14230
  }
@@ -14157,22 +14253,35 @@ var modify = {
14157
14253
  const using = SUBRULE1(usingClauseStar);
14158
14254
  CONSUME(where);
14159
14255
  const where2 = SUBRULE1(groupGraphPattern);
14160
- return ACTION(() => C.factory.updateOperationModify(C.factory.sourceLocation(graph2?.withToken, del, insert, where2), insert?.val ?? [], del?.val ?? [], where2, using, graph2?.graph));
14256
+ return ACTION(() => C.astFactory.updateOperationModify(C.astFactory.sourceLocation(graph2?.withToken, del, insert, where2), insert?.val ?? [], del?.val ?? [], where2, using, graph2?.graph));
14161
14257
  },
14162
- gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F3 }) => {
14258
+ gImpl: ({ SUBRULE, PRINT_WORD, PRINT_ON_EMPTY }) => (ast, C) => {
14259
+ const { astFactory: F3, indentInc } = C;
14163
14260
  if (ast.graph) {
14164
14261
  F3.printFilter(ast, () => PRINT_WORD("WITH"));
14165
14262
  SUBRULE(iri2, ast.graph);
14166
14263
  }
14167
14264
  if (ast.delete.length > 0) {
14168
- F3.printFilter(ast, () => PRINT_WORD("DELETE", "{"));
14265
+ F3.printFilter(ast, () => {
14266
+ C[traqulaIndentation] += indentInc;
14267
+ PRINT_WORD("DELETE", "{\n");
14268
+ });
14169
14269
  SUBRULE(quads, F3.wrap(ast.delete, ast.loc));
14170
- F3.printFilter(ast, () => PRINT_WORD("}"));
14270
+ F3.printFilter(ast, () => {
14271
+ C[traqulaIndentation] -= indentInc;
14272
+ PRINT_ON_EMPTY("}\n");
14273
+ });
14171
14274
  }
14172
14275
  if (ast.insert.length > 0) {
14173
- F3.printFilter(ast, () => PRINT_WORD("INSERT", "{"));
14276
+ F3.printFilter(ast, () => {
14277
+ C[traqulaIndentation] += indentInc;
14278
+ PRINT_WORD("INSERT", "{\n");
14279
+ });
14174
14280
  SUBRULE(quads, F3.wrap(ast.insert, ast.loc));
14175
- F3.printFilter(ast, () => PRINT_WORD("}"));
14281
+ F3.printFilter(ast, () => {
14282
+ C[traqulaIndentation] -= indentInc;
14283
+ PRINT_ON_EMPTY("}\n");
14284
+ });
14176
14285
  }
14177
14286
  SUBRULE(usingClauseStar, ast.from);
14178
14287
  F3.printFilter(ast, () => PRINT_WORD("WHERE"));
@@ -14186,7 +14295,7 @@ var deleteClause2 = {
14186
14295
  const couldCreateBlankNodes = ACTION(() => C.parseMode.delete("canCreateBlankNodes"));
14187
14296
  const del = SUBRULE(quadPattern);
14188
14297
  ACTION(() => couldCreateBlankNodes && C.parseMode.add("canCreateBlankNodes"));
14189
- return ACTION(() => C.factory.wrap(del.val, C.factory.sourceLocation(delToken, del)));
14298
+ return ACTION(() => C.astFactory.wrap(del.val, C.astFactory.sourceLocation(delToken, del)));
14190
14299
  }
14191
14300
  };
14192
14301
  var insertClause2 = {
@@ -14194,7 +14303,7 @@ var insertClause2 = {
14194
14303
  impl: ({ ACTION, SUBRULE, CONSUME }) => (C) => {
14195
14304
  const insertToken = CONSUME(insertClause);
14196
14305
  const insert = SUBRULE(quadPattern);
14197
- return ACTION(() => C.factory.wrap(insert.val, C.factory.sourceLocation(insertToken, insert)));
14306
+ return ACTION(() => C.astFactory.wrap(insert.val, C.astFactory.sourceLocation(insertToken, insert)));
14198
14307
  }
14199
14308
  };
14200
14309
  var graphOrDefault = {
@@ -14202,12 +14311,12 @@ var graphOrDefault = {
14202
14311
  impl: ({ ACTION, SUBRULE1, CONSUME, OPTION, OR }) => (C) => OR([
14203
14312
  { ALT: () => {
14204
14313
  const def = CONSUME(graph_exports.default_);
14205
- return ACTION(() => C.factory.graphRefDefault(C.factory.sourceLocation(def)));
14314
+ return ACTION(() => C.astFactory.graphRefDefault(C.astFactory.sourceLocation(def)));
14206
14315
  } },
14207
14316
  { ALT: () => {
14208
14317
  const graph2 = OPTION(() => CONSUME(graph_exports.graph));
14209
14318
  const name = SUBRULE1(iri2);
14210
- return ACTION(() => C.factory.graphRefSpecific(name, C.factory.sourceLocation(graph2, name)));
14319
+ return ACTION(() => C.astFactory.graphRefSpecific(name, C.astFactory.sourceLocation(graph2, name)));
14211
14320
  } }
14212
14321
  ])
14213
14322
  };
@@ -14216,9 +14325,9 @@ var graphRef = {
14216
14325
  impl: ({ ACTION, SUBRULE, CONSUME }) => (C) => {
14217
14326
  const graph2 = CONSUME(graph_exports.graph);
14218
14327
  const val = SUBRULE(iri2);
14219
- return ACTION(() => C.factory.graphRefSpecific(val, C.factory.sourceLocation(graph2, val)));
14328
+ return ACTION(() => C.astFactory.graphRefSpecific(val, C.astFactory.sourceLocation(graph2, val)));
14220
14329
  },
14221
- gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F3 }) => {
14330
+ gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { astFactory: F3 }) => {
14222
14331
  F3.printFilter(ast, () => PRINT_WORD("GRAPH"));
14223
14332
  SUBRULE(iri2, ast.graph);
14224
14333
  }
@@ -14229,18 +14338,18 @@ var graphRefAll = {
14229
14338
  { ALT: () => SUBRULE(graphRef) },
14230
14339
  { ALT: () => {
14231
14340
  const def = CONSUME(graph_exports.default_);
14232
- return ACTION(() => C.factory.graphRefDefault(C.factory.sourceLocation(def)));
14341
+ return ACTION(() => C.astFactory.graphRefDefault(C.astFactory.sourceLocation(def)));
14233
14342
  } },
14234
14343
  { ALT: () => {
14235
14344
  const named2 = CONSUME(graph_exports.named);
14236
- return ACTION(() => C.factory.graphRefNamed(C.factory.sourceLocation(named2)));
14345
+ return ACTION(() => C.astFactory.graphRefNamed(C.astFactory.sourceLocation(named2)));
14237
14346
  } },
14238
14347
  { ALT: () => {
14239
14348
  const graphAll2 = CONSUME(graph_exports.graphAll);
14240
- return ACTION(() => C.factory.graphRefAll(C.factory.sourceLocation(graphAll2)));
14349
+ return ACTION(() => C.astFactory.graphRefAll(C.astFactory.sourceLocation(graphAll2)));
14241
14350
  } }
14242
14351
  ]),
14243
- gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F3 }) => {
14352
+ gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { astFactory: F3 }) => {
14244
14353
  if (F3.isGraphRefSpecific(ast)) {
14245
14354
  SUBRULE(graphRef, ast);
14246
14355
  } else if (F3.isGraphRefDefault(ast)) {
@@ -14277,9 +14386,9 @@ var quads = {
14277
14386
  ACTION(() => quads2.push(triples));
14278
14387
  });
14279
14388
  });
14280
- return ACTION(() => C.factory.wrap(quads2, C.factory.sourceLocation(quads2.at(0), last2)));
14389
+ return ACTION(() => C.astFactory.wrap(quads2, C.astFactory.sourceLocation(quads2.at(0), last2)));
14281
14390
  },
14282
- gImpl: ({ SUBRULE }) => (ast, { factory: F3 }) => {
14391
+ gImpl: ({ SUBRULE }) => (ast, { astFactory: F3 }) => {
14283
14392
  for (const quad of ast.val) {
14284
14393
  if (F3.isPattern(quad)) {
14285
14394
  SUBRULE(triplesBlock, quad);
@@ -14297,14 +14406,21 @@ var quadsNotTriples = {
14297
14406
  CONSUME(symbols_exports.LCurly);
14298
14407
  const triples = OPTION(() => SUBRULE1(triplesTemplate));
14299
14408
  const close = CONSUME(symbols_exports.RCurly);
14300
- return ACTION(() => C.factory.graphQuads(name, triples ?? C.factory.patternBgp([], C.factory.sourceLocationNoMaterialize()), C.factory.sourceLocation(graph2, close)));
14409
+ return ACTION(() => C.astFactory.graphQuads(name, triples ?? C.astFactory.patternBgp([], C.astFactory.sourceLocationNoMaterialize()), C.astFactory.sourceLocation(graph2, close)));
14301
14410
  },
14302
- gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F3 }) => {
14411
+ gImpl: ({ SUBRULE, PRINT_WORD, PRINT_ON_EMPTY }) => (ast, C) => {
14412
+ const { astFactory: F3, indentInc } = C;
14303
14413
  F3.printFilter(ast, () => PRINT_WORD("GRAPH"));
14304
14414
  SUBRULE(varOrTerm, ast.graph);
14305
- F3.printFilter(ast, () => PRINT_WORD("{"));
14415
+ F3.printFilter(ast, () => {
14416
+ C[traqulaIndentation] += indentInc;
14417
+ PRINT_WORD("{\n");
14418
+ });
14306
14419
  SUBRULE(triplesBlock, ast.triples);
14307
- F3.printFilter(ast, () => PRINT_WORD("}"));
14420
+ F3.printFilter(ast, () => {
14421
+ C[traqulaIndentation] -= indentInc;
14422
+ PRINT_ON_EMPTY("}\n");
14423
+ });
14308
14424
  }
14309
14425
  };
14310
14426
 
@@ -14327,7 +14443,7 @@ var queryOrUpdate = {
14327
14443
  ...subType,
14328
14444
  type: "query",
14329
14445
  ...values3 && { values: values3 },
14330
- loc: C.factory.sourceLocation(prologueValues.at(0), subType, values3)
14446
+ loc: C.astFactory.sourceLocation(prologueValues.at(0), subType, values3)
14331
14447
  }));
14332
14448
  } },
14333
14449
  { ALT: () => {
@@ -14351,7 +14467,7 @@ var queryOrUpdate = {
14351
14467
  const update2 = {
14352
14468
  type: "update",
14353
14469
  updates,
14354
- loc: C.factory.sourceLocation(...updates[0].context, updates[0].operation, ...updates.at(-1).context, updates.at(-1)?.operation)
14470
+ loc: C.astFactory.sourceLocation(...updates[0].context, updates[0].operation, ...updates.at(-1).context, updates.at(-1)?.operation)
14355
14471
  };
14356
14472
  updateNoReuseBlankNodeLabels(update2);
14357
14473
  return update2;
@@ -14359,7 +14475,7 @@ var queryOrUpdate = {
14359
14475
  } }
14360
14476
  ]);
14361
14477
  },
14362
- gImpl: ({ SUBRULE }) => (ast, { factory: F3 }) => {
14478
+ gImpl: ({ SUBRULE }) => (ast, { astFactory: F3 }) => {
14363
14479
  if (F3.isQuery(ast)) {
14364
14480
  SUBRULE(query, ast);
14365
14481
  } else {
@@ -14463,8 +14579,78 @@ var LANG_DIR = createToken2({
14463
14579
  });
14464
14580
  var sparql12LexerBuilder = LexerBuilder.create(lexer_exports.sparql11LexerBuilder).addBefore(lexer_exports.symbols.logicAnd, tilde, annotationOpen, annotationClose, tripleTermOpen, tripleTermClose, reificationOpen, reificationClose, version).addBefore(lexer_exports.builtIn.langmatches, buildInLangDir, buildInStrLangDir, buildInHasLangDir, buildInHasLang, buildInIsTRIPLE, buildInTRIPLE, buildInSUBJECT, buildInPREDICATE, buildInOBJECT).addBefore(lexer_exports.terminals.langTag, LANG_DIR).delete(lexer_exports.terminals.langTag);
14465
14581
 
14582
+ // ../../packages/rules-sparql-1-2/lib/AstFactory.js
14583
+ var AstFactory2 = class extends AstFactory {
14584
+ termTriple(subject, predicate, object3, loc) {
14585
+ return {
14586
+ type: "term",
14587
+ subType: "triple",
14588
+ subject,
14589
+ predicate,
14590
+ object: object3,
14591
+ loc
14592
+ };
14593
+ }
14594
+ isTermTriple(obj) {
14595
+ return this.isOfSubType(obj, "term", "triple");
14596
+ }
14597
+ tripleCollectionReifiedTriple(loc, subject, predicate, object3, reifier2) {
14598
+ return {
14599
+ type: "tripleCollection",
14600
+ subType: "reifiedTriple",
14601
+ triples: [this.triple(subject, predicate, object3)],
14602
+ identifier: reifier2 ?? this.blankNode(void 0, this.sourceLocationNoMaterialize()),
14603
+ loc
14604
+ };
14605
+ }
14606
+ isTripleCollectionReifiedTriple(obj) {
14607
+ return this.isOfSubType(obj, "tripleCollection", "reifiedTriple");
14608
+ }
14609
+ tripleCollectionBlankNodeProperties(identifier, triples, loc) {
14610
+ return {
14611
+ type: "tripleCollection",
14612
+ subType: "blankNodeProperties",
14613
+ triples,
14614
+ identifier,
14615
+ loc
14616
+ };
14617
+ }
14618
+ /**
14619
+ * Overwritten triple constructor to always contain an empty annotations list
14620
+ */
14621
+ triple = (subject, predicate, object3, loc) => ({
14622
+ type: "triple",
14623
+ subject,
14624
+ predicate,
14625
+ object: object3,
14626
+ annotations: [],
14627
+ loc: loc ?? this.sourceLocation(subject, predicate, object3)
14628
+ });
14629
+ annotatedTriple(subject, predicate, object3, annotations, loc) {
14630
+ return {
14631
+ type: "triple",
14632
+ subject,
14633
+ predicate,
14634
+ object: object3,
14635
+ annotations: annotations ?? [],
14636
+ loc: loc ?? this.sourceLocation(subject, predicate, object3, ...annotations ?? [])
14637
+ };
14638
+ }
14639
+ contextDefinitionVersion(version2, loc) {
14640
+ return {
14641
+ type: "contextDef",
14642
+ subType: "version",
14643
+ version: version2,
14644
+ loc
14645
+ };
14646
+ }
14647
+ isContextDefinitionVersion(obj) {
14648
+ return this.isOfSubType(obj, "contextDef", "version");
14649
+ }
14650
+ };
14651
+
14466
14652
  // ../../packages/rules-sparql-1-2/lib/validators.js
14467
- var F2 = new Factory();
14653
+ var F2 = new AstFactory2();
14468
14654
  function isLangDir(dir) {
14469
14655
  return dir === "ltr" || dir === "rtl";
14470
14656
  }
@@ -14486,11 +14672,11 @@ var versionDecl = {
14486
14672
  impl: ({ ACTION, SUBRULE, CONSUME }) => (C) => {
14487
14673
  const versionToken = CONSUME(version);
14488
14674
  const identifier = SUBRULE(versionSpecifier);
14489
- return ACTION(() => C.factory.contextDefinitionVersion(identifier.val, C.factory.sourceLocation(versionToken, identifier)));
14675
+ return ACTION(() => C.astFactory.contextDefinitionVersion(identifier.val, C.astFactory.sourceLocation(versionToken, identifier)));
14490
14676
  },
14491
- gImpl: ({ PRINT_WORDS }) => (ast, { factory: F3 }) => {
14677
+ gImpl: ({ PRINT_WORDS }) => (ast, { astFactory: F3 }) => {
14492
14678
  F3.printFilter(ast, () => {
14493
- PRINT_WORDS("VERSION", `${grammar_exports.stringEscapedLexical(ast.version)}`);
14679
+ PRINT_WORDS("VERSION", `${grammar_exports.stringEscapedLexical(ast.version)}`, "\n");
14494
14680
  });
14495
14681
  }
14496
14682
  };
@@ -14501,7 +14687,7 @@ var versionSpecifier = {
14501
14687
  { ALT: () => CONSUME(lexer_exports.terminals.stringLiteral1) },
14502
14688
  { ALT: () => CONSUME(lexer_exports.terminals.stringLiteral2) }
14503
14689
  ]);
14504
- return ACTION(() => C.factory.wrap(token.image.slice(1, -1), C.factory.sourceLocation(token)));
14690
+ return ACTION(() => C.astFactory.wrap(token.image.slice(1, -1), C.astFactory.sourceLocation(token)));
14505
14691
  }
14506
14692
  };
14507
14693
  var prologue2 = {
@@ -14517,7 +14703,7 @@ var prologue2 = {
14517
14703
  ]));
14518
14704
  return result;
14519
14705
  },
14520
- gImpl: ({ SUBRULE }) => (ast, { factory: F3 }) => {
14706
+ gImpl: ({ SUBRULE }) => (ast, { astFactory: F3 }) => {
14521
14707
  for (const context of ast) {
14522
14708
  if (F3.isContextDefinitionBase(context)) {
14523
14709
  SUBRULE(grammar_exports.baseDecl, context);
@@ -14534,7 +14720,7 @@ function reifiedTripleBlockImpl(name, allowPath) {
14534
14720
  name,
14535
14721
  impl: ({ ACTION, SUBRULE }) => (C) => {
14536
14722
  const triple = SUBRULE(reifiedTriple);
14537
- const properties = SUBRULE(allowPath ? grammar_exports.propertyListPath : grammar_exports.propertyList, ACTION(() => C.factory.dematerialized(triple.identifier)));
14723
+ const properties = SUBRULE(allowPath ? grammar_exports.propertyListPath : grammar_exports.propertyList, ACTION(() => C.astFactory.dematerialized(triple.identifier)));
14538
14724
  return ACTION(() => [triple, ...properties]);
14539
14725
  }
14540
14726
  };
@@ -14557,7 +14743,7 @@ var reifier = {
14557
14743
  if (reifier2 === void 0 && !C.parseMode.has("canCreateBlankNodes")) {
14558
14744
  throw new Error("Cannot create blanknodes in current parse mode");
14559
14745
  }
14560
- return C.factory.wrap(reifier2 ?? C.factory.blankNode(void 0, C.factory.sourceLocation()), C.factory.sourceLocation(tildeToken, reifier2));
14746
+ return C.astFactory.wrap(reifier2 ?? C.astFactory.blankNode(void 0, C.astFactory.sourceLocation()), C.astFactory.sourceLocation(tildeToken, reifier2));
14561
14747
  });
14562
14748
  }
14563
14749
  };
@@ -14587,7 +14773,7 @@ function objectImpl2(name, allowPaths) {
14587
14773
  const objectVal = SUBRULE(allowPaths ? graphNodePath2 : graphNode2);
14588
14774
  const annotationVal = SUBRULE(allowPaths ? annotationPath : annotation);
14589
14775
  return ACTION(() => {
14590
- const F3 = C.factory;
14776
+ const F3 = C.astFactory;
14591
14777
  if (F3.isPathPure(predicate) && annotationVal.length > 0) {
14592
14778
  throw new Error("Note 17 violation");
14593
14779
  }
@@ -14616,7 +14802,7 @@ function annotationImpl(name, allowPaths) {
14616
14802
  if (!currentReifier && !C.parseMode.has("canCreateBlankNodes")) {
14617
14803
  throw new Error("Cannot create blanknodes in current parse mode");
14618
14804
  }
14619
- currentReifier = currentReifier ?? C.factory.blankNode(void 0, C.factory.sourceLocation());
14805
+ currentReifier = currentReifier ?? C.astFactory.blankNode(void 0, C.astFactory.sourceLocation());
14620
14806
  });
14621
14807
  const block = SUBRULE(allowPaths ? annotationBlockPath : annotationBlock, currentReifier);
14622
14808
  ACTION(() => {
@@ -14628,7 +14814,7 @@ function annotationImpl(name, allowPaths) {
14628
14814
  });
14629
14815
  return annotations;
14630
14816
  },
14631
- gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F3 }) => {
14817
+ gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { astFactory: F3 }) => {
14632
14818
  for (const annotation2 of ast) {
14633
14819
  if (F3.isTripleCollectionBlankNodeProperties(annotation2)) {
14634
14820
  SUBRULE(annotationBlockPath, annotation2);
@@ -14649,11 +14835,18 @@ function annotationBlockImpl(name, allowPaths) {
14649
14835
  const open = CONSUME(annotationOpen);
14650
14836
  const res = SUBRULE(allowPaths ? grammar_exports.propertyListPathNotEmpty : grammar_exports.propertyListNotEmpty, arg);
14651
14837
  const close = CONSUME(annotationClose);
14652
- return ACTION(() => C.factory.tripleCollectionBlankNodeProperties(arg, res, C.factory.sourceLocation(open, close)));
14838
+ return ACTION(() => C.astFactory.tripleCollectionBlankNodeProperties(arg, res, C.astFactory.sourceLocation(open, close)));
14653
14839
  },
14654
- gImpl: ({ SUBRULE, PRINT_WORD, HANDLE_LOC }) => (ast, { factory: F3 }) => {
14655
- F3.printFilter(ast, () => PRINT_WORD("{|"));
14656
- for (const triple of ast.triples) {
14840
+ gImpl: ({ SUBRULE, PRINT_WORD, HANDLE_LOC, PRINT_ON_EMPTY }) => (ast, C) => {
14841
+ const { astFactory: F3, indentInc } = C;
14842
+ F3.printFilter(ast, () => {
14843
+ PRINT_WORD("{|");
14844
+ if (ast.triples.length > 1) {
14845
+ C[traqulaIndentation] += indentInc;
14846
+ PRINT_WORD("\n");
14847
+ }
14848
+ });
14849
+ function printTriple(triple) {
14657
14850
  HANDLE_LOC(triple, () => {
14658
14851
  if (F3.isTerm(triple.predicate)) {
14659
14852
  SUBRULE(graphNodePath2, triple.predicate);
@@ -14661,10 +14854,21 @@ function annotationBlockImpl(name, allowPaths) {
14661
14854
  SUBRULE(grammar_exports.pathGenerator, triple.predicate, void 0);
14662
14855
  }
14663
14856
  SUBRULE(graphNodePath2, triple.object);
14664
- F3.printFilter(ast, () => PRINT_WORD(";"));
14665
14857
  });
14666
14858
  }
14667
- F3.printFilter(ast, () => PRINT_WORD("|}"));
14859
+ const [head2, ...tail] = ast.triples;
14860
+ printTriple(head2);
14861
+ for (const triple of tail) {
14862
+ F3.printFilter(ast, () => PRINT_WORD(";\n"));
14863
+ printTriple(triple);
14864
+ }
14865
+ F3.printFilter(ast, () => {
14866
+ if (ast.triples.length > 1) {
14867
+ PRINT_ON_EMPTY("|}\n");
14868
+ } else {
14869
+ PRINT_WORD("|}");
14870
+ }
14871
+ });
14668
14872
  }
14669
14873
  };
14670
14874
  }
@@ -14684,7 +14888,7 @@ var graphNodePath2 = {
14684
14888
  { ALT: () => $.SUBRULE(reifiedTriple) }
14685
14889
  ]),
14686
14890
  gImpl: ($) => (ast, C) => {
14687
- if (C.factory.isTripleCollectionReifiedTriple(ast)) {
14891
+ if (C.astFactory.isTripleCollectionReifiedTriple(ast)) {
14688
14892
  $.SUBRULE(reifiedTriple, ast);
14689
14893
  } else {
14690
14894
  grammar_exports.graphNodePath.gImpl($)(ast, C);
@@ -14702,7 +14906,7 @@ var varOrTerm2 = {
14702
14906
  { ALT: () => SUBRULE(grammar_exports.blankNode) },
14703
14907
  { ALT: () => {
14704
14908
  const token = CONSUME(lexer_exports.terminals.nil);
14705
- return ACTION(() => C.factory.namedNode(C.factory.sourceLocation(token), CommonIRIs.NIL));
14909
+ return ACTION(() => C.astFactory.namedNode(C.astFactory.sourceLocation(token), CommonIRIs.NIL));
14706
14910
  } },
14707
14911
  { ALT: () => SUBRULE(tripleTerm) }
14708
14912
  ])
@@ -14721,10 +14925,10 @@ var reifiedTriple = {
14721
14925
  if (reifierVal === void 0 && !C.parseMode.has("canCreateBlankNodes")) {
14722
14926
  throw new Error("Cannot create blanknodes in current parse mode");
14723
14927
  }
14724
- return C.factory.tripleCollectionReifiedTriple(C.factory.sourceLocation(open, close), subject, predicate, object3, reifierVal?.val);
14928
+ return C.astFactory.tripleCollectionReifiedTriple(C.astFactory.sourceLocation(open, close), subject, predicate, object3, reifierVal?.val);
14725
14929
  });
14726
14930
  },
14727
- gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F3 }) => {
14931
+ gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { astFactory: F3 }) => {
14728
14932
  F3.printFilter(ast, () => PRINT_WORD("<<"));
14729
14933
  const triple = ast.triples[0];
14730
14934
  SUBRULE(graphNodePath2, triple.subject);
@@ -14763,9 +14967,9 @@ var tripleTerm = {
14763
14967
  const predicate = SUBRULE(grammar_exports.verb);
14764
14968
  const object3 = SUBRULE(tripleTermObject);
14765
14969
  const close = CONSUME(tripleTermClose);
14766
- return ACTION(() => C.factory.termTriple(subject, predicate, object3, C.factory.sourceLocation(open, close)));
14970
+ return ACTION(() => C.astFactory.termTriple(subject, predicate, object3, C.astFactory.sourceLocation(open, close)));
14767
14971
  },
14768
- gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F3 }) => {
14972
+ gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { astFactory: F3 }) => {
14769
14973
  F3.printFilter(ast, () => PRINT_WORD("<<("));
14770
14974
  SUBRULE(graphNodePath2, ast.subject);
14771
14975
  SUBRULE(graphNodePath2, ast.predicate);
@@ -14798,12 +15002,12 @@ var tripleTermData = {
14798
15002
  { ALT: () => SUBRULE(grammar_exports.iri) },
14799
15003
  { ALT: () => {
14800
15004
  const token = CONSUME(lexer_exports.a);
14801
- return ACTION(() => C.factory.namedNode(C.factory.sourceLocation(token), CommonIRIs.TYPE));
15005
+ return ACTION(() => C.astFactory.namedNode(C.astFactory.sourceLocation(token), CommonIRIs.TYPE));
14802
15006
  } }
14803
15007
  ]);
14804
15008
  const object3 = SUBRULE(tripleTermDataObject);
14805
15009
  const close = CONSUME(tripleTermClose);
14806
- return ACTION(() => C.factory.termTriple(subject, predicate, object3, C.factory.sourceLocation(open, close)));
15010
+ return ACTION(() => C.astFactory.termTriple(subject, predicate, object3, C.astFactory.sourceLocation(open, close)));
14807
15011
  }
14808
15012
  };
14809
15013
  var tripleTermDataSubject = {
@@ -14835,7 +15039,7 @@ var exprTripleTerm = {
14835
15039
  const predicate = SUBRULE(grammar_exports.verb);
14836
15040
  const object3 = SUBRULE(exprTripleTermObject);
14837
15041
  const close = CONSUME(tripleTermClose);
14838
- return ACTION(() => C.factory.termTriple(subject, predicate, object3, C.factory.sourceLocation(open, close)));
15042
+ return ACTION(() => C.astFactory.termTriple(subject, predicate, object3, C.astFactory.sourceLocation(open, close)));
14839
15043
  }
14840
15044
  };
14841
15045
  var exprTripleTermSubject = {
@@ -14885,7 +15089,7 @@ var rdfLiteral2 = {
14885
15089
  { ALT: () => {
14886
15090
  const langTag2 = CONSUME(LANG_DIR);
14887
15091
  return ACTION(() => {
14888
- const literal = C.factory.literalTerm(C.factory.sourceLocation(value, langTag2), value.value, langTag2.image.slice(1).toLowerCase());
15092
+ const literal = C.astFactory.literalTerm(C.astFactory.sourceLocation(value, langTag2), value.value, langTag2.image.slice(1).toLowerCase());
14889
15093
  langTagHasCorrectRange(literal);
14890
15094
  return literal;
14891
15095
  });
@@ -14893,7 +15097,7 @@ var rdfLiteral2 = {
14893
15097
  { ALT: () => {
14894
15098
  CONSUME(lexer_exports.symbols.hathat);
14895
15099
  const iriVal = SUBRULE(grammar_exports.iri);
14896
- return ACTION(() => C.factory.literalTerm(C.factory.sourceLocation(value, iriVal), value.value, iriVal));
15100
+ return ACTION(() => C.astFactory.literalTerm(C.astFactory.sourceLocation(value, iriVal), value.value, iriVal));
14897
15101
  } }
14898
15102
  ])) ?? value;
14899
15103
  }
@@ -14905,7 +15109,7 @@ var unaryExpression2 = {
14905
15109
  { ALT: () => {
14906
15110
  const operator = CONSUME(lexer_exports.symbols.exclamation);
14907
15111
  const expr = SUBRULE1(unaryExpression2);
14908
- return ACTION(() => C.factory.expressionOperation("!", [expr], C.factory.sourceLocation(operator, expr)));
15112
+ return ACTION(() => C.astFactory.expressionOperation("!", [expr], C.astFactory.sourceLocation(operator, expr)));
14909
15113
  } },
14910
15114
  { ALT: () => {
14911
15115
  const operator = OR2([
@@ -14913,34 +15117,36 @@ var unaryExpression2 = {
14913
15117
  { ALT: () => CONSUME(lexer_exports.symbols.opMinus) }
14914
15118
  ]);
14915
15119
  const expr = SUBRULE2(primaryExpression2);
14916
- return ACTION(() => C.factory.expressionOperation(operator.image === "!" ? "!" : operator.image === "+" ? "UPLUS" : "UMINUS", [expr], C.factory.sourceLocation(operator, expr)));
15120
+ return ACTION(() => C.astFactory.expressionOperation(operator.image === "!" ? "!" : operator.image === "+" ? "UPLUS" : "UMINUS", [expr], C.astFactory.sourceLocation(operator, expr)));
14917
15121
  } }
14918
15122
  ])
14919
15123
  };
14920
15124
  var generateTriplesBlock = {
14921
15125
  name: "triplesBlock",
14922
- gImpl: ({ SUBRULE, PRINT_WORD, HANDLE_LOC }) => (ast, { factory: F3 }) => {
15126
+ gImpl: ({ SUBRULE, PRINT_WORD, HANDLE_LOC }) => (ast, { astFactory: F3 }) => {
14923
15127
  for (const [index, triple] of ast.triples.entries()) {
14924
15128
  HANDLE_LOC(triple, () => {
14925
15129
  const nextTriple = ast.triples.at(index);
14926
15130
  if (F3.isTripleCollection(triple)) {
14927
15131
  SUBRULE(graphNodePath2, triple);
14928
- F3.printFilter(triple, () => PRINT_WORD("."));
15132
+ F3.printFilter(triple, () => PRINT_WORD(".\n"));
14929
15133
  } else {
14930
15134
  SUBRULE(graphNodePath2, triple.subject);
15135
+ F3.printFilter(ast, () => PRINT_WORD(""));
14931
15136
  if (F3.isPathPure(triple.predicate)) {
14932
15137
  SUBRULE(grammar_exports.pathGenerator, triple.predicate, void 0);
14933
15138
  } else {
14934
15139
  SUBRULE(graphNodePath2, triple.predicate);
14935
15140
  }
15141
+ F3.printFilter(ast, () => PRINT_WORD(""));
14936
15142
  SUBRULE(graphNodePath2, triple.object);
14937
15143
  SUBRULE(annotationPath, triple.annotations ?? []);
14938
15144
  if (nextTriple === void 0 || F3.isTripleCollection(nextTriple) || !F3.isSourceLocationNoMaterialize(nextTriple.subject.loc)) {
14939
- F3.printFilter(ast, () => PRINT_WORD("."));
15145
+ F3.printFilter(ast, () => PRINT_WORD(".\n"));
14940
15146
  } else if (F3.isSourceLocationNoMaterialize(nextTriple.predicate.loc)) {
14941
15147
  F3.printFilter(ast, () => PRINT_WORD(","));
14942
15148
  } else {
14943
- F3.printFilter(ast, () => PRINT_WORD(";"));
15149
+ F3.printFilter(ast, () => PRINT_WORD(";\n"));
14944
15150
  }
14945
15151
  }
14946
15152
  });
@@ -14950,7 +15156,7 @@ var generateTriplesBlock = {
14950
15156
  var generateGraphTerm = {
14951
15157
  name: "graphTerm",
14952
15158
  gImpl: ($) => (ast, C) => {
14953
- if (C.factory.isTermTriple(ast)) {
15159
+ if (C.astFactory.isTermTriple(ast)) {
14954
15160
  $.SUBRULE(tripleTerm, ast);
14955
15161
  } else {
14956
15162
  grammar_exports.graphTerm.gImpl($)(ast, C);
@@ -14958,86 +15164,18 @@ var generateGraphTerm = {
14958
15164
  }
14959
15165
  };
14960
15166
 
14961
- // ../../packages/rules-sparql-1-2/lib/Factory.js
14962
- var Factory2 = class extends Factory {
14963
- termTriple(subject, predicate, object3, loc) {
14964
- return {
14965
- type: "term",
14966
- subType: "triple",
14967
- subject,
14968
- predicate,
14969
- object: object3,
14970
- loc
14971
- };
14972
- }
14973
- isTermTriple(obj) {
14974
- return this.isOfSubType(obj, "term", "triple");
14975
- }
14976
- tripleCollectionReifiedTriple(loc, subject, predicate, object3, reifier2) {
14977
- return {
14978
- type: "tripleCollection",
14979
- subType: "reifiedTriple",
14980
- triples: [this.triple(subject, predicate, object3)],
14981
- identifier: reifier2 ?? this.blankNode(void 0, this.sourceLocationNoMaterialize()),
14982
- loc
14983
- };
14984
- }
14985
- isTripleCollectionReifiedTriple(obj) {
14986
- return this.isOfSubType(obj, "tripleCollection", "reifiedTriple");
14987
- }
14988
- tripleCollectionBlankNodeProperties(identifier, triples, loc) {
14989
- return {
14990
- type: "tripleCollection",
14991
- subType: "blankNodeProperties",
14992
- triples,
14993
- identifier,
14994
- loc
14995
- };
14996
- }
14997
- /**
14998
- * Overwritten triple constructor to always contain an empty annotations list
14999
- */
15000
- triple = (subject, predicate, object3, loc) => ({
15001
- type: "triple",
15002
- subject,
15003
- predicate,
15004
- object: object3,
15005
- annotations: [],
15006
- loc: loc ?? this.sourceLocation(subject, predicate, object3)
15007
- });
15008
- annotatedTriple(subject, predicate, object3, annotations, loc) {
15009
- return {
15010
- type: "triple",
15011
- subject,
15012
- predicate,
15013
- object: object3,
15014
- annotations: annotations ?? [],
15015
- loc: loc ?? this.sourceLocation(subject, predicate, object3, ...annotations ?? [])
15016
- };
15017
- }
15018
- contextDefinitionVersion(version2, loc) {
15019
- return {
15020
- type: "contextDef",
15021
- subType: "version",
15022
- version: version2,
15023
- loc
15024
- };
15025
- }
15026
- isContextDefinitionVersion(obj) {
15027
- return this.isOfSubType(obj, "contextDef", "version");
15028
- }
15029
- };
15030
-
15031
15167
  // ../../packages/rules-sparql-1-2/lib/parserUtils.js
15032
15168
  function completeParseContext2(context) {
15033
15169
  return {
15034
- factory: context.factory ?? new Factory2(),
15170
+ astFactory: context.astFactory ?? new AstFactory2(),
15035
15171
  baseIRI: context.baseIRI,
15036
15172
  prefixes: { ...context.prefixes },
15037
15173
  origSource: context.origSource ?? "",
15038
15174
  offset: context.offset,
15039
15175
  parseMode: context.parseMode ? new Set(context.parseMode) : /* @__PURE__ */ new Set(["canParseVars", "canCreateBlankNodes"]),
15040
- skipValidation: context.skipValidation ?? false
15176
+ skipValidation: context.skipValidation ?? false,
15177
+ indentInc: context.indentInc ?? 2,
15178
+ [traqulaIndentation]: context[traqulaIndentation] ?? 0
15041
15179
  };
15042
15180
  }
15043
15181
 
@@ -15045,7 +15183,7 @@ function completeParseContext2(context) {
15045
15183
  var sparql12GeneratorBuilder = GeneratorBuilder.create(sparql11GeneratorBuilder).widenContext().typePatch().addRule(grammar_exports2.tripleTerm).addRule(grammar_exports2.reifiedTriple).patchRule(grammar_exports2.graphNodePath).addRule(grammar_exports2.annotationBlockPath).addRule(grammar_exports2.annotationPath).addRule(grammar_exports2.versionDecl).patchRule(grammar_exports2.prologue).patchRule(grammar_exports2.generateTriplesBlock).patchRule(grammar_exports2.generateGraphTerm);
15046
15184
  var Generator = class {
15047
15185
  generator = sparql12GeneratorBuilder.build();
15048
- F = new Factory2();
15186
+ F = new AstFactory2();
15049
15187
  generate(ast, context = {}) {
15050
15188
  return this.generator.queryOrUpdate(ast, completeParseContext2(context));
15051
15189
  }