@traqula/rules-sparql-1-2 0.0.16 → 0.0.17

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
@@ -21,6 +21,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
21
21
  var index_exports = {};
22
22
  __export(index_exports, {
23
23
  AstFactory: () => AstFactory2,
24
+ AstTransformer: () => AstTransformer2,
24
25
  completeParseContext: () => completeParseContext,
25
26
  findPatternBoundedVars: () => findPatternBoundedVars2,
26
27
  gram: () => grammar_exports2,
@@ -9526,6 +9527,11 @@ var LexerBuilder = class _LexerBuilder {
9526
9527
 
9527
9528
  // ../core/lib/Transformers.js
9528
9529
  var TransformerType = class {
9530
+ clone(obj) {
9531
+ const newObj = Object.create(Object.getPrototypeOf(obj));
9532
+ Object.defineProperties(newObj, Object.getOwnPropertyDescriptors(obj));
9533
+ return newObj;
9534
+ }
9529
9535
  safeObjectVisit(value, mapper) {
9530
9536
  if (value && typeof value === "object") {
9531
9537
  if (Array.isArray(value)) {
@@ -9535,104 +9541,213 @@ var TransformerType = class {
9535
9541
  }
9536
9542
  return value;
9537
9543
  }
9538
- transformNode(curObject, nodeCallBacks) {
9539
- let continueCheck;
9540
- let transformation;
9541
- const casted = curObject;
9542
- if (casted.type) {
9543
- continueCheck = nodeCallBacks[casted.type]?.continue;
9544
- transformation = nodeCallBacks[casted.type]?.transform;
9545
- }
9546
- let shouldContinue = true;
9547
- if (continueCheck) {
9548
- shouldContinue = continueCheck(curObject);
9549
- }
9550
- if (!shouldContinue) {
9551
- return curObject;
9552
- }
9553
- const copy3 = { ...curObject };
9554
- for (const [key, value] of Object.entries(copy3)) {
9555
- copy3[key] = this.safeObjectVisit(value, (obj) => this.transformNode(obj, nodeCallBacks));
9556
- }
9557
- if (transformation) {
9558
- return transformation(copy3);
9559
- }
9560
- return copy3;
9544
+ /**
9545
+ * Recursively transforms all objects that are not arrays. Mapper is called on deeper objects first.
9546
+ * @param startObject object to start iterating from
9547
+ * @param mapper mapper to transform the various objects - argument is a copy of the original
9548
+ * @param preVisitor callback that is evaluated before iterating deeper.
9549
+ * If continues is false, we do not iterate deeper, current object is still mapped. - default: true
9550
+ * If shortcut is true, we do not iterate deeper, nor do we branch out, this mapper will be the last one called.
9551
+ * - Default false
9552
+ */
9553
+ transformObject(startObject, mapper, preVisitor = () => ({})) {
9554
+ let didShortCut = false;
9555
+ const recurse = (curObject) => {
9556
+ const copy3 = this.clone(curObject);
9557
+ const context = preVisitor(copy3);
9558
+ didShortCut = context.shortcut ?? false;
9559
+ const continues = context.continue ?? true;
9560
+ if (continues && !didShortCut) {
9561
+ for (const [key, value] of Object.entries(copy3)) {
9562
+ if (didShortCut) {
9563
+ return copy3;
9564
+ }
9565
+ copy3[key] = this.safeObjectVisit(value, (obj) => recurse(obj));
9566
+ }
9567
+ }
9568
+ return mapper(copy3);
9569
+ };
9570
+ return recurse(startObject);
9561
9571
  }
9562
- visitNode(curObject, nodeCallBacks) {
9563
- let callback;
9564
- const casted = curObject;
9565
- if (casted.type) {
9566
- callback = nodeCallBacks[casted.type];
9567
- }
9568
- let shouldIterate = true;
9569
- if (callback) {
9570
- shouldIterate = callback(curObject);
9571
- }
9572
- if (shouldIterate) {
9573
- for (const value of Object.values(curObject)) {
9574
- this.safeObjectVisit(value, (obj) => this.visitNode(obj, nodeCallBacks));
9572
+ /**
9573
+ * Visitor that visits all objects. Visits deeper objects first.
9574
+ */
9575
+ visitObject(startObject, visitor, preVisitor = () => ({})) {
9576
+ let didShortCut = false;
9577
+ const recurse = (curObject) => {
9578
+ const context = preVisitor(curObject);
9579
+ didShortCut = context.shortcut ?? false;
9580
+ const continues = context.continue ?? true;
9581
+ if (continues && !didShortCut) {
9582
+ for (const value of Object.values(curObject)) {
9583
+ if (didShortCut) {
9584
+ return;
9585
+ }
9586
+ this.safeObjectVisit(value, (obj) => recurse(obj));
9587
+ }
9575
9588
  }
9576
- }
9589
+ visitor(curObject);
9590
+ };
9591
+ recurse(startObject);
9592
+ }
9593
+ transformNode(startObject, nodeCallBacks) {
9594
+ const transformWrapper = (curObject) => {
9595
+ const casted = curObject;
9596
+ if (casted.type) {
9597
+ const ogFunc = nodeCallBacks[casted.type]?.transform;
9598
+ if (ogFunc) {
9599
+ return ogFunc(casted);
9600
+ }
9601
+ }
9602
+ return curObject;
9603
+ };
9604
+ const preTransformWrapper = (curObject) => {
9605
+ const casted = curObject;
9606
+ if (casted.type) {
9607
+ const ogFunc = nodeCallBacks[casted.type]?.preVisitor;
9608
+ if (ogFunc) {
9609
+ return ogFunc(casted);
9610
+ }
9611
+ }
9612
+ return {};
9613
+ };
9614
+ return this.transformObject(startObject, transformWrapper, preTransformWrapper);
9615
+ }
9616
+ visitNode(startObject, nodeCallBacks) {
9617
+ const visitWrapper = (curObject) => {
9618
+ const casted = curObject;
9619
+ if (casted.type) {
9620
+ const ogFunc = nodeCallBacks[casted.type]?.visitor;
9621
+ if (ogFunc) {
9622
+ ogFunc(casted);
9623
+ }
9624
+ }
9625
+ };
9626
+ const preVisitWrapper = (curObject) => {
9627
+ const casted = curObject;
9628
+ if (casted.type) {
9629
+ const ogFunc = nodeCallBacks[casted.type]?.preVisitor;
9630
+ if (ogFunc) {
9631
+ return ogFunc(casted);
9632
+ }
9633
+ }
9634
+ return {};
9635
+ };
9636
+ this.visitObject(startObject, visitWrapper, preVisitWrapper);
9637
+ }
9638
+ traverseNodes(currentNode, traverse) {
9639
+ let didShortCut = false;
9640
+ const recurse = (curNode) => {
9641
+ const traverser = traverse[curNode.type];
9642
+ if (traverser) {
9643
+ const { next, shortcut } = traverser(curNode);
9644
+ didShortCut = shortcut ?? false;
9645
+ if (!didShortCut) {
9646
+ for (const node of next ?? []) {
9647
+ if (didShortCut) {
9648
+ return;
9649
+ }
9650
+ recurse(node);
9651
+ }
9652
+ }
9653
+ }
9654
+ };
9655
+ recurse(currentNode);
9577
9656
  }
9578
9657
  };
9579
9658
  var TransformerSubType = class extends TransformerType {
9580
- // Public visitObjects(curObject: object, visitor: (current: object) => void): void {
9581
- // for (const value of Object.values(curObject)) {
9582
- // this.safeObjectVisit(value, obj => this.visitObjects(obj, visitor));
9583
- // }
9584
- // }
9585
- transformNodeSpecific(curObject, nodeCallBacks, nodeSpecificCallBacks = {}) {
9586
- let continueCheck;
9587
- let transformation;
9588
- const casted = curObject;
9589
- if (casted.type && casted.subType) {
9590
- const specific = nodeSpecificCallBacks[casted.type];
9591
- if (specific) {
9592
- continueCheck = specific[casted.subType]?.continue;
9593
- transformation = specific[casted.subType]?.transform;
9594
- }
9595
- }
9596
- let shouldContinue = true;
9597
- if (continueCheck) {
9598
- shouldContinue = continueCheck(curObject);
9599
- }
9600
- if (!shouldContinue) {
9601
- return curObject;
9602
- }
9603
- const copy3 = { ...curObject };
9604
- for (const [key, value] of Object.entries(copy3)) {
9605
- copy3[key] = this.safeObjectVisit(value, (obj) => this.transformNodeSpecific(obj, nodeCallBacks, nodeSpecificCallBacks));
9606
- }
9607
- if (transformation) {
9608
- return transformation(copy3);
9609
- }
9610
- return copy3;
9659
+ transformNodeSpecific(startObject, nodeCallBacks, nodeSpecificCallBacks) {
9660
+ const transformWrapper = (curObject) => {
9661
+ let ogTransform;
9662
+ const casted = curObject;
9663
+ if (casted.type && casted.subType) {
9664
+ const specific = nodeSpecificCallBacks[casted.type];
9665
+ if (specific) {
9666
+ ogTransform = specific[casted.subType]?.transform;
9667
+ }
9668
+ if (!ogTransform) {
9669
+ ogTransform = nodeCallBacks[casted.type]?.transform;
9670
+ }
9671
+ }
9672
+ return ogTransform ? ogTransform(casted) : curObject;
9673
+ };
9674
+ const preVisitWrapper = (curObject) => {
9675
+ let ogPreVisit;
9676
+ const casted = curObject;
9677
+ if (casted.type && casted.subType) {
9678
+ const specific = nodeSpecificCallBacks[casted.type];
9679
+ if (specific) {
9680
+ ogPreVisit = specific[casted.subType]?.preVisitor;
9681
+ }
9682
+ if (!ogPreVisit) {
9683
+ ogPreVisit = nodeCallBacks[casted.type]?.preVisitor;
9684
+ }
9685
+ }
9686
+ return ogPreVisit ? ogPreVisit(casted) : curObject;
9687
+ };
9688
+ return this.transformObject(startObject, transformWrapper, preVisitWrapper);
9611
9689
  }
9612
9690
  /**
9613
9691
  * When both nodeCallBack and NodeSpecific callBack are matched, will only look at nodeSpecifCallback
9614
9692
  */
9615
- visitNodeSpecific(curObject, nodeCallBacks, nodeSpecificCallBacks = {}) {
9616
- let callback;
9617
- const casted = curObject;
9618
- if (casted.type && casted.subType) {
9619
- const specific = nodeSpecificCallBacks[casted.type];
9620
- if (specific) {
9621
- callback = specific[casted.subType];
9693
+ visitNodeSpecific(startObject, nodeCallBacks, nodeSpecificCallBacks) {
9694
+ const visitWrapper = (curObject) => {
9695
+ let ogTransform;
9696
+ const casted = curObject;
9697
+ if (casted.type && casted.subType) {
9698
+ const specific = nodeSpecificCallBacks[casted.type];
9699
+ if (specific) {
9700
+ ogTransform = specific[casted.subType]?.visitor;
9701
+ }
9702
+ if (!ogTransform) {
9703
+ ogTransform = nodeCallBacks[casted.type]?.visitor;
9704
+ }
9622
9705
  }
9623
- }
9624
- if (!callback && casted.type) {
9625
- callback = nodeCallBacks[curObject.type];
9626
- }
9627
- let shouldIterate = true;
9628
- if (callback) {
9629
- shouldIterate = callback(curObject) ?? true;
9630
- }
9631
- if (shouldIterate) {
9632
- for (const value of Object.values(curObject)) {
9633
- this.safeObjectVisit(value, (obj) => this.visitNodeSpecific(obj, nodeCallBacks, nodeSpecificCallBacks));
9706
+ if (ogTransform) {
9707
+ ogTransform(casted);
9634
9708
  }
9635
- }
9709
+ };
9710
+ const preVisitWrapper = (curObject) => {
9711
+ let ogPreVisit;
9712
+ const casted = curObject;
9713
+ if (casted.type && casted.subType) {
9714
+ const specific = nodeSpecificCallBacks[casted.type];
9715
+ if (specific) {
9716
+ ogPreVisit = specific[casted.subType]?.preVisitor;
9717
+ }
9718
+ if (!ogPreVisit) {
9719
+ ogPreVisit = nodeCallBacks[casted.type]?.preVisitor;
9720
+ }
9721
+ }
9722
+ return ogPreVisit ? ogPreVisit(casted) : curObject;
9723
+ };
9724
+ this.visitObject(startObject, visitWrapper, preVisitWrapper);
9725
+ }
9726
+ traverseSubNodes(currentNode, traverseNode, traverseSubNode) {
9727
+ let didShortCut = false;
9728
+ const recurse = (curNode) => {
9729
+ let traverser;
9730
+ const subObj = traverseSubNode[curNode.type];
9731
+ if (subObj) {
9732
+ traverser = subObj[curNode.subType];
9733
+ }
9734
+ if (!traverser) {
9735
+ traverser = traverseNode[curNode.type];
9736
+ }
9737
+ if (traverser) {
9738
+ const { next, shortcut } = traverser(curNode);
9739
+ didShortCut = shortcut ?? false;
9740
+ if (!didShortCut) {
9741
+ for (const node of next ?? []) {
9742
+ if (didShortCut) {
9743
+ return;
9744
+ }
9745
+ recurse(node);
9746
+ }
9747
+ }
9748
+ }
9749
+ };
9750
+ recurse(currentNode);
9636
9751
  }
9637
9752
  };
9638
9753
 
@@ -11128,12 +11243,12 @@ var CommonIRIs;
11128
11243
  CommonIRIs2["NIL"] = "http://www.w3.org/1999/02/22-rdf-syntax-ns#nil";
11129
11244
  CommonIRIs2["TYPE"] = "http://www.w3.org/1999/02/22-rdf-syntax-ns#type";
11130
11245
  })(CommonIRIs || (CommonIRIs = {}));
11131
- var TransformerSparql11 = class extends TransformerSubType {
11246
+ var AstTransformer = class extends TransformerSubType {
11132
11247
  };
11133
11248
 
11134
11249
  // ../rules-sparql-1-1/lib/validation/validators.js
11135
11250
  var F = new AstFactory();
11136
- var transformer = new TransformerSparql11();
11251
+ var transformer = new AstTransformer();
11137
11252
  function getAggregatesOfExpression(expression2) {
11138
11253
  if (F.isExpressionAggregate(expression2)) {
11139
11254
  return [expression2];
@@ -11212,77 +11327,69 @@ function queryIsGood(query2) {
11212
11327
  }
11213
11328
  }
11214
11329
  }
11330
+ function notUndefined(some2) {
11331
+ return some2 !== void 0;
11332
+ }
11215
11333
  function findPatternBoundedVars(iter, boundedVars) {
11216
- if (F.isQuery(iter) || F.isUpdate(iter)) {
11217
- if (F.isQuerySelect(iter) || F.isQueryDescribe(iter)) {
11218
- if (iter.where && iter.variables.some((x) => F.isWildcard(x))) {
11219
- findPatternBoundedVars(iter.where, boundedVars);
11220
- } else {
11221
- for (const v of iter.variables) {
11222
- findPatternBoundedVars(v, boundedVars);
11223
- }
11224
- }
11225
- if (iter.solutionModifiers.group) {
11226
- const grouping = iter.solutionModifiers.group;
11227
- for (const g of grouping.groupings) {
11228
- if ("variable" in g) {
11229
- findPatternBoundedVars(g.variable, boundedVars);
11230
- }
11231
- }
11232
- }
11233
- if (iter.values?.values && iter.values.values.length > 0) {
11234
- const values3 = iter.values.values;
11235
- for (const v of Object.keys(values3[0])) {
11334
+ transformer.traverseSubNodes(iter, {
11335
+ query: (op) => ({ next: [
11336
+ op.solutionModifiers.group
11337
+ ].filter(notUndefined) }),
11338
+ triple: (op) => ({ next: [op.subject, op.predicate, op.object] }),
11339
+ path: (op) => ({ next: op.items }),
11340
+ tripleCollection: (op) => ({ next: [op.identifier, ...op.triples] })
11341
+ }, {
11342
+ query: {
11343
+ select: (op) => ({ next: [
11344
+ ...op.variables.some((x) => F.isWildcard(x)) ? [op.where] : op.variables,
11345
+ op.solutionModifiers.group,
11346
+ op.values
11347
+ ].filter(notUndefined) }),
11348
+ describe: (op) => ({ next: [
11349
+ ...op.variables.some((x) => F.isWildcard(x)) ? [op.where] : op.variables,
11350
+ op.solutionModifiers.group,
11351
+ op.values
11352
+ ].filter(notUndefined) })
11353
+ },
11354
+ solutionModifier: {
11355
+ group: (op) => ({
11356
+ next: op.groupings.filter((g) => "variable" in g).map((x) => x.variable)
11357
+ }),
11358
+ having: (op) => ({ next: op.having }),
11359
+ order: (op) => ({ next: op.orderDefs.map((x) => x.expression) })
11360
+ },
11361
+ pattern: {
11362
+ values: (op) => {
11363
+ for (const v of Object.keys(op.values.at(0) ?? {})) {
11236
11364
  boundedVars.add(v);
11237
11365
  }
11366
+ return {};
11367
+ },
11368
+ bgp: (op) => ({ next: op.triples }),
11369
+ group: (op) => ({ next: op.patterns }),
11370
+ union: (op) => ({ next: op.patterns }),
11371
+ optional: (op) => ({ next: op.patterns }),
11372
+ service: (op) => ({ next: [op.name, ...op.patterns] }),
11373
+ bind: (op) => ({ next: [op.variable] }),
11374
+ graph: (op) => ({ next: [op.name, ...op.patterns] }),
11375
+ minus: (op) => ({ next: op.patterns.slice(0, 1) })
11376
+ },
11377
+ term: {
11378
+ variable: (op) => {
11379
+ boundedVars.add(op.value);
11380
+ return {};
11238
11381
  }
11239
11382
  }
11240
- } else if (F.isTerm(iter)) {
11241
- if (F.isTermVariable(iter)) {
11242
- boundedVars.add(iter.value);
11243
- }
11244
- } else if (F.isTriple(iter)) {
11245
- findPatternBoundedVars(iter.subject, boundedVars);
11246
- findPatternBoundedVars(iter.predicate, boundedVars);
11247
- findPatternBoundedVars(iter.object, boundedVars);
11248
- } else if (F.isPath(iter)) {
11249
- if (!F.isTerm(iter)) {
11250
- for (const item of iter.items) {
11251
- findPatternBoundedVars(item, boundedVars);
11252
- }
11253
- }
11254
- } else if (F.isTripleCollection(iter) || F.isPatternBgp(iter)) {
11255
- for (const triple of iter.triples) {
11256
- findPatternBoundedVars(triple, boundedVars);
11257
- }
11258
- } else if (F.isPatternGroup(iter) || F.isPatternUnion(iter) || F.isPatternOptional(iter) || F.isPatternService(iter)) {
11259
- for (const pattern of iter.patterns) {
11260
- findPatternBoundedVars(pattern, boundedVars);
11261
- }
11262
- if (F.isPatternService(iter)) {
11263
- findPatternBoundedVars(iter.name, boundedVars);
11264
- }
11265
- } else if (F.isPatternBind(iter)) {
11266
- findPatternBoundedVars(iter.variable, boundedVars);
11267
- } else if (F.isPatternValues(iter)) {
11268
- for (const variable of Object.keys(iter.values.at(0) ?? {})) {
11269
- boundedVars.add(variable);
11270
- }
11271
- } else if (F.isPatternGraph(iter)) {
11272
- findPatternBoundedVars(iter.name, boundedVars);
11273
- for (const pattern of iter.patterns) {
11274
- findPatternBoundedVars(pattern, boundedVars);
11275
- }
11276
- }
11383
+ });
11277
11384
  }
11278
11385
  function checkNote13(patterns) {
11279
11386
  for (const [index, pattern] of patterns.entries()) {
11280
11387
  if (F.isPatternBind(pattern) && index > 0 && F.isPatternBgp(patterns[index - 1])) {
11281
11388
  const bgp = patterns[index - 1];
11282
11389
  const variables = [];
11283
- transformer.visitNodeSpecific(bgp, {}, { term: { variable: (var_2) => {
11390
+ transformer.visitNodeSpecific(bgp, {}, { term: { variable: { visitor: (var_2) => {
11284
11391
  variables.push(var_2);
11285
- } } });
11392
+ } } } });
11286
11393
  if (variables.some((var_2) => var_2.value === pattern.variable.value)) {
11287
11394
  throw new Error(`Variable used to bind is already bound (?${pattern.variable.value})`);
11288
11395
  }
@@ -11308,12 +11415,12 @@ function updateNoReuseBlankNodeLabels(updateQuery) {
11308
11415
  const operation = update2.operation;
11309
11416
  if (operation.subType === "insertdata") {
11310
11417
  const blankNodesHere = /* @__PURE__ */ new Set();
11311
- transformer.visitNodeSpecific(operation, {}, { term: { blankNode: (blankNode2) => {
11418
+ transformer.visitNodeSpecific(operation, {}, { term: { blankNode: { visitor: (blankNode2) => {
11312
11419
  blankNodesHere.add(blankNode2.label);
11313
11420
  if (blankLabelsUsedInInsertData.has(blankNode2.label)) {
11314
11421
  throw new Error("Detected reuse blank node across different INSERT DATA clauses");
11315
11422
  }
11316
- } } });
11423
+ } } } });
11317
11424
  for (const blankNode2 of blankNodesHere) {
11318
11425
  blankLabelsUsedInInsertData.add(blankNode2);
11319
11426
  }
@@ -15018,6 +15125,8 @@ function completeParseContext(context) {
15018
15125
  [traqulaIndentation]: context[traqulaIndentation] ?? 0
15019
15126
  };
15020
15127
  }
15128
+ var AstTransformer2 = class extends TransformerSubType {
15129
+ };
15021
15130
  /*! Bundled license information:
15022
15131
 
15023
15132
  lodash-es/lodash.js:
@@ -1,4 +1,6 @@
1
+ import { TransformerSubType } from '@traqula/core';
1
2
  import type { SparqlContext, SparqlGeneratorContext } from './sparql12HelperTypes.js';
3
+ import type { Sparql12Nodes } from './sparql12Types.js';
2
4
  export declare function completeParseContext(context: Partial<SparqlContext & SparqlGeneratorContext & {
3
5
  origSource: string;
4
6
  offset?: number;
@@ -6,3 +8,5 @@ export declare function completeParseContext(context: Partial<SparqlContext & Sp
6
8
  origSource: string;
7
9
  offset?: number;
8
10
  };
11
+ export declare class AstTransformer extends TransformerSubType<Sparql12Nodes> {
12
+ }
@@ -1,4 +1,4 @@
1
- import { traqulaIndentation } from '@traqula/core';
1
+ import { TransformerSubType, traqulaIndentation } from '@traqula/core';
2
2
  import { AstFactory } from './AstFactory.js';
3
3
  export function completeParseContext(context) {
4
4
  return {
@@ -13,4 +13,6 @@ export function completeParseContext(context) {
13
13
  [traqulaIndentation]: context[traqulaIndentation] ?? 0,
14
14
  };
15
15
  }
16
+ export class AstTransformer extends TransformerSubType {
17
+ }
16
18
  //# sourceMappingURL=parserUtils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"parserUtils.js","sourceRoot":"","sources":["parserUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAG7C,MAAM,UAAU,oBAAoB,CAClC,OAAkG;IAElG,OAAO;QACL,UAAU,EAAE,OAAO,CAAC,UAAU,IAAI,IAAI,UAAU,EAAE;QAClD,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,QAAQ,EAAE,EAAE,GAAG,OAAO,CAAC,QAAQ,EAAE;QACjC,UAAU,EAAE,OAAO,CAAC,UAAU,IAAI,EAAE;QACpC,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,SAAS,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAE,cAAc,EAAE,qBAAqB,CAAE,CAAC;QAC9G,cAAc,EAAE,OAAO,CAAC,cAAc,IAAI,KAAK;QAC/C,SAAS,EAAE,OAAO,CAAC,SAAS,IAAI,CAAC;QACjC,CAAC,kBAAkB,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC,IAAI,CAAC;KACvD,CAAC;AACJ,CAAC","sourcesContent":["import { traqulaIndentation } from '@traqula/core';\nimport { AstFactory } from './AstFactory.js';\nimport type { SparqlContext, SparqlGeneratorContext } from './sparql12HelperTypes.js';\n\nexport function completeParseContext(\n context: Partial<SparqlContext & SparqlGeneratorContext & { origSource: string; offset?: number }>,\n): SparqlContext & SparqlGeneratorContext & { origSource: string; offset?: number } {\n return {\n astFactory: context.astFactory ?? new AstFactory(),\n baseIRI: context.baseIRI,\n prefixes: { ...context.prefixes },\n origSource: context.origSource ?? '',\n offset: context.offset,\n parseMode: context.parseMode ? new Set(context.parseMode) : new Set([ 'canParseVars', 'canCreateBlankNodes' ]),\n skipValidation: context.skipValidation ?? false,\n indentInc: context.indentInc ?? 2,\n [traqulaIndentation]: context[traqulaIndentation] ?? 0,\n };\n}\n"]}
1
+ {"version":3,"file":"parserUtils.js","sourceRoot":"","sources":["parserUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAI7C,MAAM,UAAU,oBAAoB,CAClC,OAAkG;IAElG,OAAO;QACL,UAAU,EAAE,OAAO,CAAC,UAAU,IAAI,IAAI,UAAU,EAAE;QAClD,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,QAAQ,EAAE,EAAE,GAAG,OAAO,CAAC,QAAQ,EAAE;QACjC,UAAU,EAAE,OAAO,CAAC,UAAU,IAAI,EAAE;QACpC,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,SAAS,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAE,cAAc,EAAE,qBAAqB,CAAE,CAAC;QAC9G,cAAc,EAAE,OAAO,CAAC,cAAc,IAAI,KAAK;QAC/C,SAAS,EAAE,OAAO,CAAC,SAAS,IAAI,CAAC;QACjC,CAAC,kBAAkB,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC,IAAI,CAAC;KACvD,CAAC;AACJ,CAAC;AAED,MAAM,OAAO,cAAe,SAAQ,kBAAiC;CAAG","sourcesContent":["import { TransformerSubType, traqulaIndentation } from '@traqula/core';\nimport { AstFactory } from './AstFactory.js';\nimport type { SparqlContext, SparqlGeneratorContext } from './sparql12HelperTypes.js';\nimport type { Sparql12Nodes } from './sparql12Types.js';\n\nexport function completeParseContext(\n context: Partial<SparqlContext & SparqlGeneratorContext & { origSource: string; offset?: number }>,\n): SparqlContext & SparqlGeneratorContext & { origSource: string; offset?: number } {\n return {\n astFactory: context.astFactory ?? new AstFactory(),\n baseIRI: context.baseIRI,\n prefixes: { ...context.prefixes },\n origSource: context.origSource ?? '',\n offset: context.offset,\n parseMode: context.parseMode ? new Set(context.parseMode) : new Set([ 'canParseVars', 'canCreateBlankNodes' ]),\n skipValidation: context.skipValidation ?? false,\n indentInc: context.indentInc ?? 2,\n [traqulaIndentation]: context[traqulaIndentation] ?? 0,\n };\n}\n\nexport class AstTransformer extends TransformerSubType<Sparql12Nodes> {}\n"]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@traqula/rules-sparql-1-2",
3
3
  "type": "module",
4
- "version": "0.0.16",
4
+ "version": "0.0.17",
5
5
  "description": "Traqula Lexer and Grammar Rules for sparql 1.2",
6
6
  "lsd:module": true,
7
7
  "license": "MIT",
@@ -42,8 +42,8 @@
42
42
  "build:transpile": " node \"../../node_modules/esbuild/bin/esbuild\" --format=cjs --bundle --log-level=error --outfile=lib/index.cjs lib/index.ts"
43
43
  },
44
44
  "dependencies": {
45
- "@traqula/core": "^0.0.16",
46
- "@traqula/rules-sparql-1-1": "^0.0.16"
45
+ "@traqula/core": "^0.0.17",
46
+ "@traqula/rules-sparql-1-1": "^0.0.17"
47
47
  },
48
- "gitHead": "2de4ee608a2337bed63ecc5cf336b1a57c39e45f"
48
+ "gitHead": "e4c1ef096da34d42ff86ac01d9affd428754c0b1"
49
49
  }