@traqula/rules-sparql-1-2 0.0.3 → 0.0.5

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
@@ -34,16 +34,16 @@ __export(grammar_exports2, {
34
34
  annotationBlock: () => annotationBlock,
35
35
  annotationBlockPath: () => annotationBlockPath,
36
36
  annotationPath: () => annotationPath,
37
+ buildInHasLang: () => buildInHasLang2,
38
+ buildInHasLangDir: () => buildInHasLangDir2,
39
+ buildInIsTriple: () => buildInIsTriple,
40
+ buildInLangDir: () => buildInLangDir2,
41
+ buildInLangStrDir: () => buildInLangStrDir,
42
+ buildInObject: () => buildInObject,
43
+ buildInPredicate: () => buildInPredicate,
44
+ buildInSubject: () => buildInSubject,
45
+ buildInTriple: () => buildInTriple,
37
46
  builtInCall: () => builtInCall2,
38
- builtinHasLang: () => builtinHasLang2,
39
- builtinHasLangDir: () => builtinHasLangDir2,
40
- builtinIsTriple: () => builtinIsTriple,
41
- builtinLangDir: () => builtinLangDir2,
42
- builtinLangStrDir: () => builtinLangStrDir,
43
- builtinObject: () => builtinObject,
44
- builtinPredicate: () => builtinPredicate,
45
- builtinSubject: () => builtinSubject,
46
- builtinTriple: () => builtinTriple,
47
47
  dataBlockValue: () => dataBlockValue2,
48
48
  exprTripleTerm: () => exprTripleTerm,
49
49
  exprTripleTermObject: () => exprTripleTermObject,
@@ -260,6 +260,7 @@ __export(grammar_exports, {
260
260
  quads: () => quads,
261
261
  quadsNotTriples: () => quadsNotTriples,
262
262
  query: () => query,
263
+ queryOrUpdate: () => queryOrUpdate,
263
264
  queryUnit: () => queryUnit,
264
265
  rdfLiteral: () => rdfLiteral,
265
266
  regexExpression: () => regexExpression,
@@ -308,7 +309,7 @@ __export(lexer_exports, {
308
309
  ask: () => ask,
309
310
  baseDecl: () => baseDecl,
310
311
  bind: () => bind,
311
- builtIn: () => BuildinCalls_exports,
312
+ builtIn: () => BuiltInCalls_exports,
312
313
  by: () => by,
313
314
  clear: () => clear,
314
315
  construct: () => construct,
@@ -345,7 +346,7 @@ __export(lexer_exports, {
345
346
  separator: () => separator,
346
347
  service: () => service,
347
348
  silent: () => silent,
348
- sparql11Tokens: () => sparql11Tokens,
349
+ sparql11LexerBuilder: () => sparql11LexerBuilder,
349
350
  symbols: () => symbols_exports,
350
351
  terminals: () => terminals_exports,
351
352
  to: () => to,
@@ -357,10 +358,10 @@ __export(lexer_exports, {
357
358
  where: () => where
358
359
  });
359
360
 
360
- // ../rules-sparql-1-1/lib/lexer/BuildinCalls.ts
361
- var BuildinCalls_exports = {};
362
- __export(BuildinCalls_exports, {
363
- BuildInCalls: () => BuildInCalls,
361
+ // ../rules-sparql-1-1/lib/lexer/BuiltInCalls.ts
362
+ var BuiltInCalls_exports = {};
363
+ __export(BuiltInCalls_exports, {
364
+ BuiltInCalls: () => BuiltInCalls,
364
365
  abs: () => abs,
365
366
  allBuiltInCalls: () => allBuiltInCalls,
366
367
  avg: () => avg,
@@ -753,10 +754,10 @@ var coreJsData = root_default["__core-js_shared__"];
753
754
  var coreJsData_default = coreJsData;
754
755
 
755
756
  // ../../node_modules/lodash-es/_isMasked.js
756
- var maskSrcKey = function() {
757
+ var maskSrcKey = (function() {
757
758
  var uid = /[^.]+$/.exec(coreJsData_default && coreJsData_default.keys && coreJsData_default.keys.IE_PROTO || "");
758
759
  return uid ? "Symbol(src)_1." + uid : "";
759
- }();
760
+ })();
760
761
  function isMasked(func) {
761
762
  return !!maskSrcKey && maskSrcKey in func;
762
763
  }
@@ -818,7 +819,7 @@ var WeakMap_default = WeakMap;
818
819
 
819
820
  // ../../node_modules/lodash-es/_baseCreate.js
820
821
  var objectCreate = Object.create;
821
- var baseCreate = /* @__PURE__ */ function() {
822
+ var baseCreate = /* @__PURE__ */ (function() {
822
823
  function object3() {
823
824
  }
824
825
  return function(proto) {
@@ -833,7 +834,7 @@ var baseCreate = /* @__PURE__ */ function() {
833
834
  object3.prototype = void 0;
834
835
  return result;
835
836
  };
836
- }();
837
+ })();
837
838
  var baseCreate_default = baseCreate;
838
839
 
839
840
  // ../../node_modules/lodash-es/_apply.js
@@ -898,14 +899,14 @@ function constant(value) {
898
899
  var constant_default = constant;
899
900
 
900
901
  // ../../node_modules/lodash-es/_defineProperty.js
901
- var defineProperty = function() {
902
+ var defineProperty = (function() {
902
903
  try {
903
904
  var func = getNative_default(Object, "defineProperty");
904
905
  func({}, "", {});
905
906
  return func;
906
907
  } catch (e) {
907
908
  }
908
- }();
909
+ })();
909
910
  var defineProperty_default = defineProperty;
910
911
 
911
912
  // ../../node_modules/lodash-es/_baseSetToString.js
@@ -1143,9 +1144,9 @@ var baseIsArguments_default = baseIsArguments;
1143
1144
  var objectProto6 = Object.prototype;
1144
1145
  var hasOwnProperty4 = objectProto6.hasOwnProperty;
1145
1146
  var propertyIsEnumerable = objectProto6.propertyIsEnumerable;
1146
- var isArguments = baseIsArguments_default(/* @__PURE__ */ function() {
1147
+ var isArguments = baseIsArguments_default(/* @__PURE__ */ (function() {
1147
1148
  return arguments;
1148
- }()) ? baseIsArguments_default : function(value) {
1149
+ })()) ? baseIsArguments_default : function(value) {
1149
1150
  return isObjectLike_default(value) && hasOwnProperty4.call(value, "callee") && !propertyIsEnumerable.call(value, "callee");
1150
1151
  };
1151
1152
  var isArguments_default = isArguments;
@@ -1211,7 +1212,7 @@ var freeExports2 = typeof exports == "object" && exports && !exports.nodeType &&
1211
1212
  var freeModule2 = freeExports2 && typeof module == "object" && module && !module.nodeType && module;
1212
1213
  var moduleExports2 = freeModule2 && freeModule2.exports === freeExports2;
1213
1214
  var freeProcess = moduleExports2 && freeGlobal_default.process;
1214
- var nodeUtil = function() {
1215
+ var nodeUtil = (function() {
1215
1216
  try {
1216
1217
  var types = freeModule2 && freeModule2.require && freeModule2.require("util").types;
1217
1218
  if (types) {
@@ -1220,7 +1221,7 @@ var nodeUtil = function() {
1220
1221
  return freeProcess && freeProcess.binding && freeProcess.binding("util");
1221
1222
  } catch (e) {
1222
1223
  }
1223
- }();
1224
+ })();
1224
1225
  var nodeUtil_default = nodeUtil;
1225
1226
 
1226
1227
  // ../../node_modules/lodash-es/isTypedArray.js
@@ -9765,6 +9766,7 @@ applyMixins(Parser, [
9765
9766
 
9766
9767
  // ../core/lib/lexer-builder/LexerBuilder.ts
9767
9768
  var LexerBuilder = class _LexerBuilder {
9769
+ tokens;
9768
9770
  static create(starter) {
9769
9771
  return new _LexerBuilder(starter);
9770
9772
  }
@@ -9922,71 +9924,71 @@ var Transformer = class {
9922
9924
  }
9923
9925
  };
9924
9926
 
9925
- // ../rules-sparql-1-1/lib/lexer/BuildinCalls.ts
9926
- var BuildInCalls = /* @__PURE__ */ ((BuildInCalls2) => {
9927
- BuildInCalls2["Str"] = "builtInStr";
9928
- BuildInCalls2["Lang"] = "builtInLang";
9929
- BuildInCalls2["Langmatches"] = "builtInLangmatches";
9930
- BuildInCalls2["Datatype"] = "builtInDatatype";
9931
- BuildInCalls2["Bound"] = "builtInBound";
9932
- BuildInCalls2["Iri"] = "builtInIri";
9933
- BuildInCalls2["Uri"] = "builtInUri";
9934
- BuildInCalls2["Bnode"] = "builtInBnode";
9935
- BuildInCalls2["Rand"] = "builtInRand";
9936
- BuildInCalls2["Abs"] = "builtInAbs";
9937
- BuildInCalls2["Ceil"] = "builtInCeil";
9938
- BuildInCalls2["Floor"] = "builtInFloor";
9939
- BuildInCalls2["Round"] = "builtInRound";
9940
- BuildInCalls2["Concat"] = "builtInConcat";
9941
- BuildInCalls2["Strlen"] = "builtInStrlen";
9942
- BuildInCalls2["Ucase"] = "builtInUcase";
9943
- BuildInCalls2["Lcase"] = "builtInLcase";
9944
- BuildInCalls2["Encode_for_uri"] = "builtInEncode_for_uri";
9945
- BuildInCalls2["Contains"] = "builtInContains";
9946
- BuildInCalls2["Strstarts"] = "builtInStrstarts";
9947
- BuildInCalls2["Strends"] = "builtInStrends";
9948
- BuildInCalls2["Strbefore"] = "builtInStrbefore";
9949
- BuildInCalls2["Strafter"] = "builtInStrafter";
9950
- BuildInCalls2["Year"] = "builtInYear";
9951
- BuildInCalls2["Month"] = "builtInMonth";
9952
- BuildInCalls2["Day"] = "builtInDay";
9953
- BuildInCalls2["Hours"] = "builtInHours";
9954
- BuildInCalls2["Minutes"] = "builtInMinutes";
9955
- BuildInCalls2["Seconds"] = "builtInSeconds";
9956
- BuildInCalls2["Timezone"] = "builtInTimezone";
9957
- BuildInCalls2["Tz"] = "builtInTz";
9958
- BuildInCalls2["Now"] = "builtInNow";
9959
- BuildInCalls2["Uuid"] = "builtInUuid";
9960
- BuildInCalls2["Struuid"] = "builtInStruuid";
9961
- BuildInCalls2["Md5"] = "builtInMd5";
9962
- BuildInCalls2["Sha1"] = "builtInSha1";
9963
- BuildInCalls2["Sha256"] = "builtInSha256";
9964
- BuildInCalls2["Sha384"] = "builtInSha384";
9965
- BuildInCalls2["Sha512"] = "builtInSha512";
9966
- BuildInCalls2["Coalesce"] = "builtInCoalesce";
9967
- BuildInCalls2["If"] = "builtInIf";
9968
- BuildInCalls2["Strlang"] = "builtInStrlang";
9969
- BuildInCalls2["Strdt"] = "builtInStrdt";
9970
- BuildInCalls2["Sameterm"] = "builtInSameterm";
9971
- BuildInCalls2["Isiri"] = "builtInIsiri";
9972
- BuildInCalls2["Isuri"] = "builtInIsuri";
9973
- BuildInCalls2["Isblank"] = "builtInIsblank";
9974
- BuildInCalls2["Isliteral"] = "builtInIsliteral";
9975
- BuildInCalls2["Isnumeric"] = "builtInIsnumeric";
9976
- BuildInCalls2["Regex"] = "builtInRegex";
9977
- BuildInCalls2["Substr"] = "builtInSubstr";
9978
- BuildInCalls2["Replace"] = "builtInReplace";
9979
- BuildInCalls2["Exists"] = "builtInExists";
9980
- BuildInCalls2["Notexists"] = "builtInNotexists";
9981
- BuildInCalls2["Count"] = "builtInCount";
9982
- BuildInCalls2["Sum"] = "builtInSum";
9983
- BuildInCalls2["Min"] = "builtInMin";
9984
- BuildInCalls2["Max"] = "builtInMax";
9985
- BuildInCalls2["Avg"] = "builtInAvg";
9986
- BuildInCalls2["Sample"] = "builtInSample";
9987
- BuildInCalls2["Group_concat"] = "builtInGroup_concat";
9988
- return BuildInCalls2;
9989
- })(BuildInCalls || {});
9927
+ // ../rules-sparql-1-1/lib/lexer/BuiltInCalls.ts
9928
+ var BuiltInCalls = /* @__PURE__ */ ((BuiltInCalls2) => {
9929
+ BuiltInCalls2["Str"] = "builtInStr";
9930
+ BuiltInCalls2["Lang"] = "builtInLang";
9931
+ BuiltInCalls2["Langmatches"] = "builtInLangmatches";
9932
+ BuiltInCalls2["Datatype"] = "builtInDatatype";
9933
+ BuiltInCalls2["Bound"] = "builtInBound";
9934
+ BuiltInCalls2["Iri"] = "builtInIri";
9935
+ BuiltInCalls2["Uri"] = "builtInUri";
9936
+ BuiltInCalls2["Bnode"] = "builtInBnode";
9937
+ BuiltInCalls2["Rand"] = "builtInRand";
9938
+ BuiltInCalls2["Abs"] = "builtInAbs";
9939
+ BuiltInCalls2["Ceil"] = "builtInCeil";
9940
+ BuiltInCalls2["Floor"] = "builtInFloor";
9941
+ BuiltInCalls2["Round"] = "builtInRound";
9942
+ BuiltInCalls2["Concat"] = "builtInConcat";
9943
+ BuiltInCalls2["Strlen"] = "builtInStrlen";
9944
+ BuiltInCalls2["Ucase"] = "builtInUcase";
9945
+ BuiltInCalls2["Lcase"] = "builtInLcase";
9946
+ BuiltInCalls2["Encode_for_uri"] = "builtInEncode_for_uri";
9947
+ BuiltInCalls2["Contains"] = "builtInContains";
9948
+ BuiltInCalls2["Strstarts"] = "builtInStrstarts";
9949
+ BuiltInCalls2["Strends"] = "builtInStrends";
9950
+ BuiltInCalls2["Strbefore"] = "builtInStrbefore";
9951
+ BuiltInCalls2["Strafter"] = "builtInStrafter";
9952
+ BuiltInCalls2["Year"] = "builtInYear";
9953
+ BuiltInCalls2["Month"] = "builtInMonth";
9954
+ BuiltInCalls2["Day"] = "builtInDay";
9955
+ BuiltInCalls2["Hours"] = "builtInHours";
9956
+ BuiltInCalls2["Minutes"] = "builtInMinutes";
9957
+ BuiltInCalls2["Seconds"] = "builtInSeconds";
9958
+ BuiltInCalls2["Timezone"] = "builtInTimezone";
9959
+ BuiltInCalls2["Tz"] = "builtInTz";
9960
+ BuiltInCalls2["Now"] = "builtInNow";
9961
+ BuiltInCalls2["Uuid"] = "builtInUuid";
9962
+ BuiltInCalls2["Struuid"] = "builtInStruuid";
9963
+ BuiltInCalls2["Md5"] = "builtInMd5";
9964
+ BuiltInCalls2["Sha1"] = "builtInSha1";
9965
+ BuiltInCalls2["Sha256"] = "builtInSha256";
9966
+ BuiltInCalls2["Sha384"] = "builtInSha384";
9967
+ BuiltInCalls2["Sha512"] = "builtInSha512";
9968
+ BuiltInCalls2["Coalesce"] = "builtInCoalesce";
9969
+ BuiltInCalls2["If"] = "builtInIf";
9970
+ BuiltInCalls2["Strlang"] = "builtInStrlang";
9971
+ BuiltInCalls2["Strdt"] = "builtInStrdt";
9972
+ BuiltInCalls2["Sameterm"] = "builtInSameterm";
9973
+ BuiltInCalls2["Isiri"] = "builtInIsiri";
9974
+ BuiltInCalls2["Isuri"] = "builtInIsuri";
9975
+ BuiltInCalls2["Isblank"] = "builtInIsblank";
9976
+ BuiltInCalls2["Isliteral"] = "builtInIsliteral";
9977
+ BuiltInCalls2["Isnumeric"] = "builtInIsnumeric";
9978
+ BuiltInCalls2["Regex"] = "builtInRegex";
9979
+ BuiltInCalls2["Substr"] = "builtInSubstr";
9980
+ BuiltInCalls2["Replace"] = "builtInReplace";
9981
+ BuiltInCalls2["Exists"] = "builtInExists";
9982
+ BuiltInCalls2["Notexists"] = "builtInNotexists";
9983
+ BuiltInCalls2["Count"] = "builtInCount";
9984
+ BuiltInCalls2["Sum"] = "builtInSum";
9985
+ BuiltInCalls2["Min"] = "builtInMin";
9986
+ BuiltInCalls2["Max"] = "builtInMax";
9987
+ BuiltInCalls2["Avg"] = "builtInAvg";
9988
+ BuiltInCalls2["Sample"] = "builtInSample";
9989
+ BuiltInCalls2["Group_concat"] = "builtInGroup_concat";
9990
+ return BuiltInCalls2;
9991
+ })(BuiltInCalls || {});
9990
9992
  function capitalize(string2) {
9991
9993
  return string2.charAt(0).toUpperCase() + string2.slice(1);
9992
9994
  }
@@ -10490,7 +10492,7 @@ var allBaseTokens = LexerBuilder.create().add(
10490
10492
  notIn,
10491
10493
  separator
10492
10494
  );
10493
- var sparql11Tokens = LexerBuilder.create(allTerminals).merge(allBaseTokens).merge(allBuiltInCalls).merge(allGraphTokens).merge(allSymbols).moveBefore(datatype, dataClause).moveAfter(avg, a).moveBefore(a, graphAll).moveAfter(groupConcat, groupByGroup);
10495
+ var sparql11LexerBuilder = LexerBuilder.create(allTerminals).merge(allBaseTokens).merge(allBuiltInCalls).merge(allGraphTokens).merge(allSymbols).moveBefore(datatype, dataClause).moveAfter(avg, a).moveBefore(a, graphAll).moveAfter(groupConcat, groupByGroup);
10494
10496
 
10495
10497
  // ../rules-sparql-1-1/lib/factoryMixins/ContextFactory.ts
10496
10498
  var nodeType = "contextDef";
@@ -10935,10 +10937,7 @@ function SolutionModifiersFactoryMixin(Base) {
10935
10937
  var nodeType8 = "term";
10936
10938
  function TermFactoryMixin(Base) {
10937
10939
  return class TermFactory extends Base {
10938
- constructor() {
10939
- super(...arguments);
10940
- this.__blankNodeCounter = 0;
10941
- }
10940
+ __blankNodeCounter = 0;
10942
10941
  resetBlankNodeCounter() {
10943
10942
  this.__blankNodeCounter = 0;
10944
10943
  }
@@ -11441,7 +11440,7 @@ function stringEscapedLexical(str2) {
11441
11440
  var rdfLiteral = {
11442
11441
  name: "rdfLiteral",
11443
11442
  impl: ({ ACTION, SUBRULE1, CONSUME, OPTION, OR }) => (C) => {
11444
- const value = SUBRULE1(string, void 0);
11443
+ const value = SUBRULE1(string);
11445
11444
  return OPTION(() => OR([
11446
11445
  { ALT: () => {
11447
11446
  const lang2 = CONSUME(terminals_exports.langTag);
@@ -11453,7 +11452,7 @@ var rdfLiteral = {
11453
11452
  } },
11454
11453
  { ALT: () => {
11455
11454
  CONSUME(symbols_exports.hathat);
11456
- const iriVal = SUBRULE1(iri2, void 0);
11455
+ const iriVal = SUBRULE1(iri2);
11457
11456
  return ACTION(() => C.factory.literalTerm(
11458
11457
  C.factory.sourceLocation(value, iriVal),
11459
11458
  value.value,
@@ -11469,7 +11468,7 @@ var rdfLiteral = {
11469
11468
  factory.printFilter(ast, () => PRINT("@", ast.langOrIri));
11470
11469
  } else {
11471
11470
  factory.printFilter(ast, () => PRINT("^^"));
11472
- SUBRULE(iri2, ast.langOrIri, void 0);
11471
+ SUBRULE(iri2, ast.langOrIri);
11473
11472
  }
11474
11473
  }
11475
11474
  }
@@ -11477,9 +11476,9 @@ var rdfLiteral = {
11477
11476
  var numericLiteral = {
11478
11477
  name: "numericLiteral",
11479
11478
  impl: ({ SUBRULE, OR }) => () => OR([
11480
- { ALT: () => SUBRULE(numericLiteralUnsigned, void 0) },
11481
- { ALT: () => SUBRULE(numericLiteralPositive, void 0) },
11482
- { ALT: () => SUBRULE(numericLiteralNegative, void 0) }
11479
+ { ALT: () => SUBRULE(numericLiteralUnsigned) },
11480
+ { ALT: () => SUBRULE(numericLiteralPositive) },
11481
+ { ALT: () => SUBRULE(numericLiteralNegative) }
11483
11482
  ])
11484
11483
  };
11485
11484
  var numericLiteralUnsigned = {
@@ -11587,10 +11586,10 @@ var string = {
11587
11586
  var iri2 = {
11588
11587
  name: "iri",
11589
11588
  impl: ({ SUBRULE, OR }) => () => OR([
11590
- { ALT: () => SUBRULE(iriFull, void 0) },
11591
- { ALT: () => SUBRULE(prefixedName, void 0) }
11589
+ { ALT: () => SUBRULE(iriFull) },
11590
+ { ALT: () => SUBRULE(prefixedName) }
11592
11591
  ]),
11593
- gImpl: ({ SUBRULE }) => (ast, { factory: F3 }) => F3.isTermNamedPrefixed(ast) ? SUBRULE(prefixedName, ast, void 0) : SUBRULE(iriFull, ast, void 0)
11592
+ gImpl: ({ SUBRULE }) => (ast, { factory: F3 }) => F3.isTermNamedPrefixed(ast) ? SUBRULE(prefixedName, ast) : SUBRULE(iriFull, ast)
11594
11593
  };
11595
11594
  var iriFull = {
11596
11595
  name: "iriFull",
@@ -11654,93 +11653,25 @@ var verbA = {
11654
11653
  }
11655
11654
  };
11656
11655
 
11657
- // ../rules-sparql-1-1/lib/grammar/dataSetClause.ts
11658
- function datasetClauseUsing(name, token) {
11659
- return {
11660
- name,
11661
- impl: ({ ACTION, SUBRULE, CONSUME, OR }) => (C) => {
11662
- const start = CONSUME(token);
11663
- return OR([
11664
- { ALT: () => {
11665
- const iri3 = SUBRULE(defaultGraphClause, void 0);
11666
- return ACTION(() => C.factory.wrap({ clauseType: "default", value: iri3 }, C.factory.sourceLocation(start, iri3)));
11667
- } },
11668
- { ALT: () => {
11669
- const namedClause = SUBRULE(namedGraphClause, void 0);
11670
- return ACTION(() => C.factory.wrap({
11671
- clauseType: "named",
11672
- value: namedClause.val
11673
- }, C.factory.sourceLocation(start, namedClause)));
11674
- } }
11675
- ]);
11676
- }
11677
- };
11678
- }
11679
- var datasetClause = datasetClauseUsing("datasetClause", from);
11680
- var defaultGraphClause = {
11681
- name: "defaultGraphClause",
11682
- impl: ({ SUBRULE }) => () => SUBRULE(sourceSelector, void 0)
11683
- };
11684
- var usingClause2 = datasetClauseUsing("usingClause", usingClause);
11685
- function datasetClauseUsingStar(name, subRule, fromUsing) {
11686
- return {
11687
- name,
11688
- impl: ({ ACTION, MANY, SUBRULE }) => (C) => {
11689
- const clauses = [];
11690
- MANY(() => {
11691
- const clause = SUBRULE(subRule, void 0);
11692
- clauses.push(clause);
11693
- });
11694
- return ACTION(() => C.factory.datasetClauses(
11695
- clauses.map((clause) => clause.val),
11696
- C.factory.sourceLocation(...clauses)
11697
- ));
11698
- },
11699
- gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F3 }) => {
11700
- for (const clause of ast.clauses) {
11701
- F3.printFilter(ast, () => PRINT_WORD(fromUsing));
11702
- if (clause.clauseType === "named") {
11703
- F3.printFilter(ast, () => PRINT_WORD("NAMED"));
11704
- }
11705
- SUBRULE(iri2, clause.value, void 0);
11706
- }
11707
- }
11708
- };
11709
- }
11710
- var datasetClauseStar = datasetClauseUsingStar("datasetClauses", datasetClause, "FROM");
11711
- var usingClauseStar = datasetClauseUsingStar("usingClauses", usingClause2, "USING");
11712
- var namedGraphClause = {
11713
- name: "namedGraphClause",
11714
- impl: ({ ACTION, SUBRULE, CONSUME }) => (C) => {
11715
- const named2 = CONSUME(graph_exports.named);
11716
- const iri3 = SUBRULE(sourceSelector, void 0);
11717
- return ACTION(() => C.factory.wrap(iri3, C.factory.sourceLocation(named2, iri3)));
11718
- }
11719
- };
11720
- var sourceSelector = {
11721
- name: "sourceSelector",
11722
- impl: ({ SUBRULE }) => () => SUBRULE(iri2, void 0)
11723
- };
11724
-
11725
11656
  // ../rules-sparql-1-1/lib/grammar/general.ts
11726
11657
  var prologue = {
11727
11658
  name: "prologue",
11728
11659
  impl: ({ SUBRULE, MANY, OR }) => () => {
11729
11660
  const result = [];
11730
11661
  MANY(() => OR([
11731
- { ALT: () => result.push(SUBRULE(baseDecl2, void 0)) },
11662
+ { ALT: () => result.push(SUBRULE(baseDecl2)) },
11732
11663
  // TODO: the [spec](https://www.w3.org/TR/sparql11-query/#iriRefs) says you cannot redefine prefixes.
11733
11664
  // We might need to check this.
11734
- { ALT: () => result.push(SUBRULE(prefixDecl2, void 0)) }
11665
+ { ALT: () => result.push(SUBRULE(prefixDecl2)) }
11735
11666
  ]));
11736
11667
  return result;
11737
11668
  },
11738
11669
  gImpl: ({ SUBRULE }) => (ast, { factory: F3 }) => {
11739
11670
  for (const context of ast) {
11740
11671
  if (F3.isContextDefinitionBase(context)) {
11741
- SUBRULE(baseDecl2, context, void 0);
11672
+ SUBRULE(baseDecl2, context);
11742
11673
  } else if (F3.isContextDefinitionPrefix(context)) {
11743
- SUBRULE(prefixDecl2, context, void 0);
11674
+ SUBRULE(prefixDecl2, context);
11744
11675
  }
11745
11676
  }
11746
11677
  }
@@ -11749,12 +11680,12 @@ var baseDecl2 = {
11749
11680
  name: "baseDecl",
11750
11681
  impl: ({ ACTION, CONSUME, SUBRULE }) => (C) => {
11751
11682
  const base = CONSUME(baseDecl);
11752
- const val = SUBRULE(iriFull, void 0);
11683
+ const val = SUBRULE(iriFull);
11753
11684
  return ACTION(() => C.factory.contextDefinitionBase(C.factory.sourceLocation(base, val), val));
11754
11685
  },
11755
11686
  gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F3 }) => {
11756
11687
  F3.printFilter(ast, () => PRINT_WORD("BASE"));
11757
- SUBRULE(iri2, ast.value, void 0);
11688
+ SUBRULE(iri2, ast.value);
11758
11689
  }
11759
11690
  };
11760
11691
  var prefixDecl2 = {
@@ -11762,41 +11693,41 @@ var prefixDecl2 = {
11762
11693
  impl: ({ ACTION, CONSUME, SUBRULE }) => (C) => {
11763
11694
  const prefix = CONSUME(prefixDecl);
11764
11695
  const name = CONSUME(terminals_exports.pNameNs).image.slice(0, -1);
11765
- const value = SUBRULE(iriFull, void 0);
11696
+ const value = SUBRULE(iriFull);
11766
11697
  return ACTION(() => C.factory.contextDefinitionPrefix(C.factory.sourceLocation(prefix, value), name, value));
11767
11698
  },
11768
11699
  gImpl: ({ SUBRULE, PRINT_WORDS }) => (ast, { factory: F3 }) => {
11769
11700
  F3.printFilter(ast, () => {
11770
11701
  PRINT_WORDS("PREFIX", `${ast.key}:`);
11771
11702
  });
11772
- SUBRULE(iri2, ast.value, void 0);
11703
+ SUBRULE(iri2, ast.value);
11773
11704
  }
11774
11705
  };
11775
11706
  var verb = {
11776
11707
  name: "verb",
11777
11708
  impl: ({ SUBRULE, OR }) => () => OR([
11778
- { ALT: () => SUBRULE(varOrIri, void 0) },
11779
- { ALT: () => SUBRULE(verbA, void 0) }
11709
+ { ALT: () => SUBRULE(varOrIri) },
11710
+ { ALT: () => SUBRULE(verbA) }
11780
11711
  ])
11781
11712
  };
11782
11713
  var varOrTerm = {
11783
11714
  name: "varOrTerm",
11784
11715
  impl: ({ SUBRULE, OR }) => (C) => OR([
11785
- { GATE: () => C.parseMode.has("canParseVars"), ALT: () => SUBRULE(var_, void 0) },
11786
- { ALT: () => SUBRULE(graphTerm, void 0) }
11716
+ { GATE: () => C.parseMode.has("canParseVars"), ALT: () => SUBRULE(var_) },
11717
+ { ALT: () => SUBRULE(graphTerm) }
11787
11718
  ]),
11788
11719
  gImpl: ({ SUBRULE }) => (ast, { factory: F3 }) => {
11789
11720
  if (F3.isTermVariable(ast)) {
11790
- return SUBRULE(var_, ast, void 0);
11721
+ return SUBRULE(var_, ast);
11791
11722
  }
11792
- return SUBRULE(graphTerm, ast, void 0);
11723
+ return SUBRULE(graphTerm, ast);
11793
11724
  }
11794
11725
  };
11795
11726
  var varOrIri = {
11796
11727
  name: "varOrIri",
11797
11728
  impl: ({ SUBRULE, OR }) => (C) => OR([
11798
- { GATE: () => C.parseMode.has("canParseVars"), ALT: () => SUBRULE(var_, void 0) },
11799
- { ALT: () => SUBRULE(iri2, void 0) }
11729
+ { GATE: () => C.parseMode.has("canParseVars"), ALT: () => SUBRULE(var_) },
11730
+ { ALT: () => SUBRULE(iri2) }
11800
11731
  ])
11801
11732
  };
11802
11733
  var var_ = {
@@ -11815,11 +11746,11 @@ var var_ = {
11815
11746
  var graphTerm = {
11816
11747
  name: "graphTerm",
11817
11748
  impl: ({ ACTION, SUBRULE, CONSUME, OR }) => (C) => OR([
11818
- { ALT: () => SUBRULE(iri2, void 0) },
11819
- { ALT: () => SUBRULE(rdfLiteral, void 0) },
11820
- { ALT: () => SUBRULE(numericLiteral, void 0) },
11821
- { ALT: () => SUBRULE(booleanLiteral, void 0) },
11822
- { GATE: () => C.parseMode.has("canCreateBlankNodes"), ALT: () => SUBRULE(blankNode, void 0) },
11749
+ { ALT: () => SUBRULE(iri2) },
11750
+ { ALT: () => SUBRULE(rdfLiteral) },
11751
+ { ALT: () => SUBRULE(numericLiteral) },
11752
+ { ALT: () => SUBRULE(booleanLiteral) },
11753
+ { GATE: () => C.parseMode.has("canCreateBlankNodes"), ALT: () => SUBRULE(blankNode) },
11823
11754
  { ALT: () => {
11824
11755
  const tokenNil = CONSUME(terminals_exports.nil);
11825
11756
  return ACTION(() => C.factory.namedNode(C.factory.sourceLocation(tokenNil), "http://www.w3.org/1999/02/22-rdf-syntax-ns#nil" /* NIL */));
@@ -11827,1275 +11758,1344 @@ var graphTerm = {
11827
11758
  ]),
11828
11759
  gImpl: ({ SUBRULE }) => (ast, { factory: F3 }) => {
11829
11760
  if (F3.isTermNamed(ast)) {
11830
- SUBRULE(iri2, ast, void 0);
11761
+ SUBRULE(iri2, ast);
11831
11762
  } else if (F3.isTermLiteral(ast)) {
11832
- SUBRULE(rdfLiteral, ast, void 0);
11763
+ SUBRULE(rdfLiteral, ast);
11833
11764
  } else if (F3.isTermBlank(ast)) {
11834
- SUBRULE(blankNode, ast, void 0);
11765
+ SUBRULE(blankNode, ast);
11835
11766
  }
11836
11767
  }
11837
11768
  };
11838
11769
 
11839
- // ../rules-sparql-1-1/lib/grammar/propertyPaths.ts
11840
- var path = {
11841
- name: "path",
11842
- impl: ({ SUBRULE }) => () => SUBRULE(pathAlternative, void 0)
11843
- };
11844
- var pathGenerator = {
11845
- name: "path",
11846
- gImpl: ({ PRINT, SUBRULE }) => (ast, { factory: F3 }, braces = true) => {
11847
- if (F3.isTerm(ast) && F3.isTermNamed(ast)) {
11848
- SUBRULE(iri2, ast, void 0);
11849
- } else {
11850
- F3.printFilter(ast, () => braces && PRINT("("));
11851
- switch (ast.subType) {
11852
- case "|":
11853
- case "/": {
11854
- const [head2, ...tail] = ast.items;
11855
- SUBRULE(pathGenerator, head2, braces);
11856
- for (const val of tail) {
11857
- F3.printFilter(ast, () => PRINT(ast.subType));
11858
- SUBRULE(pathGenerator, val, braces);
11859
- }
11860
- break;
11861
- }
11862
- case "^":
11863
- F3.printFilter(ast, () => PRINT("^"));
11864
- SUBRULE(pathGenerator, ast.items[0], braces);
11865
- break;
11866
- case "?":
11867
- case "*":
11868
- case "+":
11869
- SUBRULE(pathGenerator, ast.items[0], braces);
11870
- F3.printFilter(ast, () => PRINT(ast.subType));
11871
- break;
11872
- case "!":
11873
- F3.printFilter(ast, () => PRINT("!"));
11874
- F3.printFilter(ast, () => PRINT("("));
11875
- SUBRULE(pathGenerator, ast.items[0], false);
11876
- F3.printFilter(ast, () => PRINT(")"));
11877
- break;
11878
- }
11879
- F3.printFilter(ast, () => braces && PRINT(")"));
11770
+ // ../rules-sparql-1-1/lib/grammar/dataSetClause.ts
11771
+ function datasetClauseUsing(name, token) {
11772
+ return {
11773
+ name,
11774
+ impl: ({ ACTION, SUBRULE, CONSUME, OR }) => (C) => {
11775
+ const start = CONSUME(token);
11776
+ return OR([
11777
+ { ALT: () => {
11778
+ const iri3 = SUBRULE(defaultGraphClause);
11779
+ return ACTION(() => C.factory.wrap({ clauseType: "default", value: iri3 }, C.factory.sourceLocation(start, iri3)));
11780
+ } },
11781
+ { ALT: () => {
11782
+ const namedClause = SUBRULE(namedGraphClause);
11783
+ return ACTION(() => C.factory.wrap({
11784
+ clauseType: "named",
11785
+ value: namedClause.val
11786
+ }, C.factory.sourceLocation(start, namedClause)));
11787
+ } }
11788
+ ]);
11880
11789
  }
11881
- }
11790
+ };
11791
+ }
11792
+ var datasetClause = datasetClauseUsing("datasetClause", from);
11793
+ var defaultGraphClause = {
11794
+ name: "defaultGraphClause",
11795
+ impl: ({ SUBRULE }) => () => SUBRULE(sourceSelector)
11882
11796
  };
11883
- function pathChainHelper(name, SEP, subType, subRule) {
11797
+ var usingClause2 = datasetClauseUsing("usingClause", usingClause);
11798
+ function datasetClauseUsingStar(name, subRule, fromUsing) {
11884
11799
  return {
11885
11800
  name,
11886
- impl: ({ ACTION, CONSUME, SUBRULE1, SUBRULE2, MANY }) => (C) => {
11887
- const head2 = SUBRULE1(subRule, void 0);
11888
- let tailEnd = head2;
11889
- const tail = [];
11801
+ impl: ({ ACTION, MANY, SUBRULE }) => (C) => {
11802
+ const clauses = [];
11890
11803
  MANY(() => {
11891
- CONSUME(SEP);
11892
- tailEnd = SUBRULE2(subRule, void 0);
11893
- tail.push(tailEnd);
11804
+ const clause = SUBRULE(subRule);
11805
+ clauses.push(clause);
11894
11806
  });
11895
- return ACTION(() => tail.length === 0 ? head2 : C.factory.path(subType, [head2, ...tail], C.factory.sourceLocation(head2, tailEnd)));
11807
+ return ACTION(() => C.factory.datasetClauses(
11808
+ clauses.map((clause) => clause.val),
11809
+ C.factory.sourceLocation(...clauses)
11810
+ ));
11811
+ },
11812
+ gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F3 }) => {
11813
+ for (const clause of ast.clauses) {
11814
+ F3.printFilter(ast, () => PRINT_WORD(fromUsing));
11815
+ if (clause.clauseType === "named") {
11816
+ F3.printFilter(ast, () => PRINT_WORD("NAMED"));
11817
+ }
11818
+ SUBRULE(iri2, clause.value);
11819
+ }
11896
11820
  }
11897
11821
  };
11898
11822
  }
11899
- var pathEltOrInverse = {
11900
- name: "pathEltOrInverse",
11901
- impl: ({ ACTION, CONSUME, SUBRULE1, SUBRULE2, OR }) => (C) => OR([
11902
- { ALT: () => SUBRULE1(pathElt, void 0) },
11903
- { ALT: () => {
11904
- const hat2 = CONSUME(symbols_exports.hat);
11905
- const item = SUBRULE2(pathElt, void 0);
11906
- return ACTION(() => C.factory.path("^", [item], C.factory.sourceLocation(hat2, item)));
11907
- } }
11908
- ])
11909
- };
11910
- var pathSequence = pathChainHelper("pathSequence", symbols_exports.slash, "/", pathEltOrInverse);
11911
- var pathAlternative = pathChainHelper("pathAlternative", symbols_exports.pipe, "|", pathSequence);
11912
- var pathElt = {
11913
- name: "pathElt",
11914
- impl: ({ ACTION, SUBRULE, OPTION }) => (C) => {
11915
- const item = SUBRULE(pathPrimary, void 0);
11916
- const modification = OPTION(() => SUBRULE(pathMod, void 0));
11917
- return ACTION(() => modification === void 0 ? item : C.factory.path(modification.image, [item], C.factory.sourceLocation(item, modification)));
11918
- }
11919
- };
11920
- var pathMod = {
11921
- name: "pathMod",
11922
- impl: ({ CONSUME, OR }) => () => OR([
11923
- { ALT: () => CONSUME(symbols_exports.question) },
11924
- { ALT: () => CONSUME(symbols_exports.star) },
11925
- { ALT: () => CONSUME(symbols_exports.opPlus) }
11926
- ])
11927
- };
11928
- var pathPrimary = {
11929
- name: "pathPrimary",
11930
- impl: ({ SUBRULE, CONSUME, OR }) => () => OR([
11931
- { ALT: () => SUBRULE(iri2, void 0) },
11932
- { ALT: () => SUBRULE(verbA, void 0) },
11933
- { ALT: () => SUBRULE(pathNegatedPropertySet, void 0) },
11934
- { ALT: () => {
11935
- CONSUME(symbols_exports.LParen);
11936
- const resRecursive = SUBRULE(path, void 0);
11937
- CONSUME(symbols_exports.RParen);
11938
- return resRecursive;
11939
- } }
11940
- ])
11941
- };
11942
- var pathNegatedPropertySet = {
11943
- name: "pathNegatedPropertySet",
11944
- impl: ({ ACTION, CONSUME, SUBRULE1, SUBRULE2, SUBRULE3, OR, MANY }) => (C) => {
11945
- const exclamation2 = CONSUME(symbols_exports.exclamation);
11946
- return OR([
11947
- { ALT: () => {
11948
- const noAlternative = SUBRULE1(pathOneInPropertySet, void 0);
11949
- return ACTION(() => C.factory.path("!", [noAlternative], C.factory.sourceLocation(exclamation2, noAlternative)));
11950
- } },
11951
- { ALT: () => {
11952
- const open = CONSUME(symbols_exports.LParen);
11953
- const head2 = SUBRULE2(pathOneInPropertySet, void 0);
11954
- const tail = [];
11955
- MANY(() => {
11956
- CONSUME(symbols_exports.pipe);
11957
- const item = SUBRULE3(pathOneInPropertySet, void 0);
11958
- tail.push(item);
11959
- });
11960
- const close = CONSUME(symbols_exports.RParen);
11961
- return ACTION(() => {
11962
- const F3 = C.factory;
11963
- if (tail.length === 0) {
11964
- return F3.path("!", [head2], F3.sourceLocation(exclamation2, close));
11965
- }
11966
- return F3.path(
11967
- "!",
11968
- [F3.path("|", [head2, ...tail], F3.sourceLocation(open, close))],
11969
- F3.sourceLocation(exclamation2, close)
11970
- );
11971
- });
11972
- } }
11973
- ]);
11823
+ var datasetClauseStar = datasetClauseUsingStar("datasetClauses", datasetClause, "FROM");
11824
+ var usingClauseStar = datasetClauseUsingStar("usingClauses", usingClause2, "USING");
11825
+ var namedGraphClause = {
11826
+ name: "namedGraphClause",
11827
+ impl: ({ ACTION, SUBRULE, CONSUME }) => (C) => {
11828
+ const named2 = CONSUME(graph_exports.named);
11829
+ const iri3 = SUBRULE(sourceSelector);
11830
+ return ACTION(() => C.factory.wrap(iri3, C.factory.sourceLocation(named2, iri3)));
11974
11831
  }
11975
11832
  };
11976
- var pathOneInPropertySet = {
11977
- name: "pathOneInPropertySet",
11978
- impl: ({ ACTION, CONSUME, SUBRULE1, SUBRULE2, OR1, OR2 }) => (C) => OR1([
11979
- { ALT: () => SUBRULE1(iri2, void 0) },
11980
- { ALT: () => SUBRULE1(verbA, void 0) },
11981
- { ALT: () => {
11982
- const hat2 = CONSUME(symbols_exports.hat);
11983
- const item = OR2([
11984
- { ALT: () => SUBRULE2(iri2, void 0) },
11985
- { ALT: () => SUBRULE2(verbA, void 0) }
11986
- ]);
11987
- return ACTION(() => C.factory.path("^", [item], C.factory.sourceLocation(hat2, item)));
11988
- } }
11989
- ])
11833
+ var sourceSelector = {
11834
+ name: "sourceSelector",
11835
+ impl: ({ SUBRULE }) => () => SUBRULE(iri2)
11990
11836
  };
11991
11837
 
11992
- // ../rules-sparql-1-1/lib/grammar/tripleBlock.ts
11993
- function triplesDotSeperated(triplesSameSubjectSubrule) {
11994
- return ({ ACTION, AT_LEAST_ONE, SUBRULE, CONSUME, OPTION }) => (C) => {
11995
- const triples = [];
11996
- let parsedDot = true;
11997
- let dotToken;
11998
- AT_LEAST_ONE({
11999
- GATE: () => parsedDot,
12000
- DEF: () => {
12001
- parsedDot = false;
12002
- const template = SUBRULE(triplesSameSubjectSubrule, void 0);
12003
- ACTION(() => {
12004
- triples.push(...template);
12005
- });
12006
- OPTION(() => {
12007
- dotToken = CONSUME(symbols_exports.dot);
12008
- parsedDot = true;
12009
- });
12010
- }
12011
- });
12012
- return ACTION(() => C.factory.patternBgp(triples, C.factory.sourceLocation(...triples, dotToken)));
12013
- };
12014
- }
12015
- var triplesBlock = {
12016
- name: "triplesBlock",
12017
- impl: (implArgs) => (C) => triplesDotSeperated(triplesSameSubjectPath)(implArgs)(C, void 0),
12018
- gImpl: ({ SUBRULE, PRINT_WORD, HANDLE_LOC }) => (ast, { factory: F3 }) => {
12019
- for (const [index, triple] of ast.triples.entries()) {
12020
- HANDLE_LOC(triple, () => {
12021
- const nextTriple = ast.triples.at(index);
12022
- if (F3.isTripleCollection(triple)) {
12023
- SUBRULE(graphNodePath, triple, void 0);
12024
- F3.printFilter(triple, () => PRINT_WORD("."));
12025
- } else {
12026
- SUBRULE(graphNodePath, triple.subject, void 0);
12027
- if (F3.isTerm(triple.predicate) && F3.isTermVariable(triple.predicate)) {
12028
- SUBRULE(varOrTerm, triple.predicate, void 0);
12029
- } else {
12030
- SUBRULE(pathGenerator, triple.predicate, void 0);
12031
- }
12032
- SUBRULE(graphNodePath, triple.object, void 0);
12033
- if (nextTriple === void 0 || F3.isTripleCollection(nextTriple) || !F3.isSourceLocationNoMaterialize(nextTriple.subject.loc)) {
12034
- F3.printFilter(ast, () => PRINT_WORD("."));
12035
- } else if (F3.isSourceLocationNoMaterialize(nextTriple.predicate.loc)) {
12036
- F3.printFilter(ast, () => PRINT_WORD(","));
12037
- } else {
12038
- F3.printFilter(ast, () => PRINT_WORD(";"));
12039
- }
12040
- }
12041
- });
12042
- }
12043
- }
12044
- };
12045
- function triplesSameSubjectImpl(name, allowPaths) {
11838
+ // ../rules-sparql-1-1/lib/expressionHelpers.ts
11839
+ function funcExpr1(func) {
12046
11840
  return {
12047
- name,
12048
- impl: ({ ACTION, SUBRULE, OR }) => (C) => OR([
12049
- { ALT: () => {
12050
- const subject = SUBRULE(varOrTerm, void 0);
12051
- const res = SUBRULE(
12052
- allowPaths ? propertyListPathNotEmpty : propertyListNotEmpty,
12053
- { subject: ACTION(() => C.factory.dematerialized(subject)) }
12054
- );
12055
- return ACTION(() => {
12056
- if (res.length > 0) {
12057
- res[0].subject = subject;
12058
- res[0].loc = C.factory.sourceLocation(subject, res[0]);
12059
- }
12060
- return res;
12061
- });
12062
- } },
12063
- { ALT: () => {
12064
- const subjectNode = SUBRULE(allowPaths ? triplesNodePath : triplesNode, void 0);
12065
- const restNode = SUBRULE(
12066
- allowPaths ? propertyListPath : propertyList,
12067
- { subject: ACTION(() => C.factory.graphNodeIdentifier(subjectNode)) }
12068
- );
12069
- return ACTION(() => {
12070
- if (restNode.length === 0) {
12071
- return [subjectNode];
12072
- }
12073
- restNode[0].subject = subjectNode;
12074
- restNode[0].loc = C.factory.sourceLocation(subjectNode, restNode[0]);
12075
- return restNode;
12076
- });
12077
- } }
12078
- ])
11841
+ name: unCapitalize(func.name),
11842
+ impl: ({ ACTION, SUBRULE, CONSUME }) => (C) => {
11843
+ const operator = CONSUME(func);
11844
+ CONSUME(symbols_exports.LParen);
11845
+ const arg = SUBRULE(expression);
11846
+ const close = CONSUME(symbols_exports.RParen);
11847
+ return ACTION(() => C.factory.expressionOperation(operator.image, [arg], C.factory.sourceLocation(operator, close)));
11848
+ }
12079
11849
  };
12080
11850
  }
12081
- var triplesSameSubject = triplesSameSubjectImpl("triplesSameSubject", false);
12082
- var triplesSameSubjectPath = triplesSameSubjectImpl("triplesSameSubjectPath", true);
12083
- var triplesTemplate = {
12084
- name: "triplesTemplate",
12085
- impl: triplesDotSeperated(triplesSameSubject)
12086
- };
12087
- function propertyListImpl(name, allowPaths) {
11851
+ function funcExpr2(func) {
12088
11852
  return {
12089
- name,
12090
- impl: ({ SUBRULE, OPTION }) => (_, arg) => OPTION(() => SUBRULE(allowPaths ? propertyListPathNotEmpty : propertyListNotEmpty, arg)) ?? []
11853
+ name: unCapitalize(func.name),
11854
+ impl: ({ ACTION, CONSUME, SUBRULE1, SUBRULE2 }) => (C) => {
11855
+ const operator = CONSUME(func);
11856
+ CONSUME(symbols_exports.LParen);
11857
+ const arg1 = SUBRULE1(expression);
11858
+ CONSUME(symbols_exports.comma);
11859
+ const arg2 = SUBRULE2(expression);
11860
+ const close = CONSUME(symbols_exports.RParen);
11861
+ return ACTION(() => C.factory.expressionOperation(operator.image, [arg1, arg2], C.factory.sourceLocation(operator, close)));
11862
+ }
12091
11863
  };
12092
11864
  }
12093
- var propertyList = propertyListImpl("propertyList", false);
12094
- var propertyListPath = propertyListImpl("propertyListPath", true);
12095
- function propertyListNotEmptyImplementation(name, allowPaths) {
11865
+ function funcExpr3(func) {
12096
11866
  return {
12097
- name,
12098
- impl: ({ ACTION, CONSUME, AT_LEAST_ONE, SUBRULE1, MANY2, OR1 }) => (_, arg) => {
12099
- const result = [];
12100
- let parsedSemi = true;
12101
- AT_LEAST_ONE({
12102
- GATE: () => parsedSemi,
12103
- DEF: () => {
12104
- parsedSemi = false;
12105
- const predicate = allowPaths ? OR1([
12106
- { ALT: () => SUBRULE1(verbPath, void 0) },
12107
- { ALT: () => SUBRULE1(verbSimple, void 0) }
12108
- ]) : SUBRULE1(verb, void 0);
12109
- const triples = SUBRULE1(
12110
- allowPaths ? objectListPath : objectList,
12111
- ACTION(() => ({ subject: arg.subject, predicate }))
12112
- );
12113
- MANY2(() => {
12114
- CONSUME(symbols_exports.semi);
12115
- parsedSemi = true;
12116
- });
12117
- ACTION(() => {
12118
- result.push(...triples);
12119
- });
12120
- }
12121
- });
12122
- return result;
11867
+ name: unCapitalize(func.name),
11868
+ impl: ({ ACTION, CONSUME, CONSUME1, CONSUME2, SUBRULE1, SUBRULE2, SUBRULE3 }) => (C) => {
11869
+ const operator = CONSUME(func);
11870
+ CONSUME(symbols_exports.LParen);
11871
+ const arg1 = SUBRULE1(expression);
11872
+ CONSUME1(symbols_exports.comma);
11873
+ const arg2 = SUBRULE2(expression);
11874
+ CONSUME2(symbols_exports.comma);
11875
+ const arg3 = SUBRULE3(expression);
11876
+ const close = CONSUME(symbols_exports.RParen);
11877
+ return ACTION(() => C.factory.expressionOperation(operator.image, [arg1, arg2, arg3], C.factory.sourceLocation(operator, close)));
12123
11878
  }
12124
11879
  };
12125
11880
  }
12126
- var propertyListNotEmpty = propertyListNotEmptyImplementation("propertyListNotEmpty", false);
12127
- var propertyListPathNotEmpty = propertyListNotEmptyImplementation("propertyListPathNotEmpty", true);
12128
- var verbPath = {
12129
- name: "verbPath",
12130
- impl: ({ SUBRULE }) => () => SUBRULE(path, void 0)
12131
- };
12132
- var verbSimple = {
12133
- name: "verbSimple",
12134
- impl: ({ SUBRULE }) => () => SUBRULE(var_, void 0)
12135
- };
12136
- function objectListImpl(name, allowPaths) {
11881
+ function funcVar1(func) {
12137
11882
  return {
12138
- name,
12139
- impl: ({ ACTION, SUBRULE, AT_LEAST_ONE_SEP }) => (_, arg) => {
12140
- const objects = [];
12141
- AT_LEAST_ONE_SEP({
12142
- SEP: symbols_exports.comma,
12143
- DEF: () => {
12144
- const objectTriple = SUBRULE(allowPaths ? objectPath : object, arg);
12145
- ACTION(() => {
12146
- objects.push(objectTriple);
12147
- });
12148
- }
12149
- });
12150
- return objects;
11883
+ name: unCapitalize(func.name),
11884
+ impl: ({ ACTION, SUBRULE, CONSUME }) => (C) => {
11885
+ const operator = CONSUME(func);
11886
+ CONSUME(symbols_exports.LParen);
11887
+ const arg = SUBRULE(var_);
11888
+ const close = CONSUME(symbols_exports.RParen);
11889
+ return ACTION(() => C.factory.expressionOperation(operator.image, [arg], C.factory.sourceLocation(operator, close)));
12151
11890
  }
12152
11891
  };
12153
11892
  }
12154
- var objectList = objectListImpl("objectList", false);
12155
- var objectListPath = objectListImpl("objectListPath", true);
12156
- function objectImpl(name, allowPaths) {
11893
+ function funcExprOrNil1(func) {
12157
11894
  return {
12158
- name,
12159
- impl: ({ ACTION, SUBRULE }) => (C, arg) => {
12160
- const node = SUBRULE(allowPaths ? graphNodePath : graphNode, void 0);
12161
- return ACTION(() => C.factory.triple(arg.subject, arg.predicate, node));
11895
+ name: unCapitalize(func.name),
11896
+ impl: ({ ACTION, CONSUME, OR, SUBRULE }) => (C) => {
11897
+ const operator = CONSUME(func);
11898
+ return OR([
11899
+ { ALT: () => {
11900
+ CONSUME(symbols_exports.LParen);
11901
+ const arg = SUBRULE(expression);
11902
+ const close = CONSUME(symbols_exports.RParen);
11903
+ return ACTION(() => C.factory.expressionOperation(operator.image, [arg], C.factory.sourceLocation(operator, close)));
11904
+ } },
11905
+ { ALT: () => {
11906
+ const nil2 = CONSUME(terminals_exports.nil);
11907
+ return ACTION(() => C.factory.expressionOperation(operator.image, [], C.factory.sourceLocation(operator, nil2)));
11908
+ } }
11909
+ ]);
12162
11910
  }
12163
11911
  };
12164
11912
  }
12165
- var object = objectImpl("object", false);
12166
- var objectPath = objectImpl("objectPath", true);
12167
- function collectionImpl(name, allowPaths) {
11913
+ function funcNil1(func) {
12168
11914
  return {
12169
- name,
12170
- impl: ({ ACTION, AT_LEAST_ONE, SUBRULE, CONSUME }) => (C) => {
12171
- const terms = [];
12172
- const startToken = CONSUME(symbols_exports.LParen);
12173
- AT_LEAST_ONE(() => {
12174
- terms.push(SUBRULE(allowPaths ? graphNodePath : graphNode, void 0));
12175
- });
12176
- const endToken = CONSUME(symbols_exports.RParen);
12177
- return ACTION(() => {
12178
- const F3 = C.factory;
12179
- const triples = [];
12180
- const predFirst = F3.namedNode(F3.sourceLocationNoMaterialize(), "http://www.w3.org/1999/02/22-rdf-syntax-ns#first" /* FIRST */, void 0);
12181
- const predRest = F3.namedNode(F3.sourceLocationNoMaterialize(), "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest" /* REST */, void 0);
12182
- const predNil = F3.namedNode(F3.sourceLocationNoMaterialize(), "http://www.w3.org/1999/02/22-rdf-syntax-ns#nil" /* NIL */, void 0);
12183
- const listHead = F3.blankNode(void 0, F3.sourceLocationNoMaterialize());
12184
- let iterHead = listHead;
12185
- for (const [index, term] of terms.entries()) {
12186
- const lastInList = index === terms.length - 1;
12187
- const headTriple = F3.triple(
12188
- iterHead,
12189
- predFirst,
12190
- term
12191
- );
12192
- triples.push(headTriple);
12193
- if (lastInList) {
12194
- const nilTriple = F3.triple(iterHead, predRest, predNil);
12195
- triples.push(nilTriple);
12196
- } else {
12197
- const tail = F3.blankNode(void 0, F3.sourceLocationNoMaterialize());
12198
- const linkTriple = F3.triple(iterHead, predRest, tail);
12199
- triples.push(linkTriple);
12200
- iterHead = tail;
12201
- }
12202
- }
12203
- return F3.tripleCollectionList(listHead, triples, F3.sourceLocation(startToken, endToken));
12204
- });
12205
- },
12206
- gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F3 }) => {
12207
- F3.printFilter(ast, () => PRINT_WORD("("));
12208
- for (const [idx, triple] of ast.triples.entries()) {
12209
- if (idx % 2 === 0) {
12210
- SUBRULE(allowPaths ? graphNodePath : graphNode, triple.object, void 0);
12211
- }
12212
- }
12213
- F3.printFilter(ast, () => PRINT_WORD(")"));
11915
+ name: unCapitalize(func.name),
11916
+ impl: ({ ACTION, CONSUME }) => (C) => {
11917
+ const operator = CONSUME(func);
11918
+ const nil2 = CONSUME(terminals_exports.nil);
11919
+ return ACTION(() => C.factory.expressionOperation(operator.image, [], C.factory.sourceLocation(operator, nil2)));
12214
11920
  }
12215
11921
  };
12216
11922
  }
12217
- var collection = collectionImpl("collection", false);
12218
- var collectionPath = collectionImpl("collectionPath", true);
12219
- function triplesNodeImpl(name, allowPaths) {
11923
+ function funcExprList1(func) {
12220
11924
  return {
12221
- name,
12222
- impl: ({ SUBRULE, OR }) => () => OR([
12223
- { ALT: () => SUBRULE(allowPaths ? collectionPath : collection, void 0) },
12224
- { ALT: () => SUBRULE(allowPaths ? blankNodePropertyListPath : blankNodePropertyList, void 0) }
12225
- ]),
12226
- gImpl: ({ SUBRULE }) => (ast) => ast.subType === "list" ? SUBRULE(allowPaths ? collectionPath : collection, ast, void 0) : SUBRULE(allowPaths ? blankNodePropertyListPath : blankNodePropertyList, ast, void 0)
11925
+ name: unCapitalize(func.name),
11926
+ impl: ({ ACTION, CONSUME, SUBRULE }) => (C) => {
11927
+ const operator = CONSUME(func);
11928
+ const args = SUBRULE(expressionList);
11929
+ return ACTION(() => C.factory.expressionOperation(operator.image, args.val, C.factory.sourceLocation(operator, args)));
11930
+ }
12227
11931
  };
12228
11932
  }
12229
- var triplesNode = triplesNodeImpl("triplesNode", false);
12230
- var triplesNodePath = triplesNodeImpl("triplesNodePath", true);
12231
- function blankNodePropertyListImpl(name, allowPaths) {
12232
- const propertyPathNotEmptyImpl = allowPaths ? propertyListPathNotEmpty : propertyListNotEmpty;
11933
+ function funcExpr2or3(func) {
12233
11934
  return {
12234
- name,
12235
- impl: ({ ACTION, SUBRULE, CONSUME }) => (C) => {
12236
- const startToken = CONSUME(symbols_exports.LSquare);
12237
- const blankNode2 = ACTION(() => C.factory.blankNode(void 0, C.factory.sourceLocationNoMaterialize()));
12238
- const propList = SUBRULE(propertyPathNotEmptyImpl, { subject: blankNode2 });
12239
- const endToken = CONSUME(symbols_exports.RSquare);
12240
- return ACTION(() => C.factory.tripleCollectionBlankNodeProperties(
12241
- blankNode2,
12242
- propList,
12243
- C.factory.sourceLocation(startToken, endToken)
11935
+ name: unCapitalize(func.name),
11936
+ impl: ({ ACTION, CONSUME, SUBRULE1, SUBRULE2, SUBRULE3, CONSUME1, OPTION, CONSUME2 }) => (C) => {
11937
+ const operator = CONSUME(func);
11938
+ CONSUME(symbols_exports.LParen);
11939
+ const arg1 = SUBRULE1(expression);
11940
+ CONSUME1(symbols_exports.comma);
11941
+ const arg2 = SUBRULE2(expression);
11942
+ const arg3 = OPTION(() => {
11943
+ CONSUME2(symbols_exports.comma);
11944
+ return SUBRULE3(expression);
11945
+ });
11946
+ const close = CONSUME(symbols_exports.RParen);
11947
+ return ACTION(() => C.factory.expressionOperation(
11948
+ operator.image,
11949
+ arg3 ? [arg1, arg2, arg3] : [arg1, arg2],
11950
+ C.factory.sourceLocation(operator, close)
12244
11951
  ));
12245
- },
12246
- gImpl: ({ SUBRULE, PRINT, PRINT_WORD, HANDLE_LOC }) => (ast, { factory: F3 }) => {
12247
- F3.printFilter(ast, () => PRINT("["));
12248
- for (const triple of ast.triples) {
12249
- HANDLE_LOC(triple, () => {
12250
- if (F3.isTerm(triple.predicate) && F3.isTermVariable(triple.predicate)) {
12251
- SUBRULE(varOrTerm, triple.predicate, void 0);
12252
- } else {
12253
- SUBRULE(pathGenerator, triple.predicate, void 0);
12254
- }
12255
- SUBRULE(graphNodePath, triple.object, void 0);
12256
- F3.printFilter(ast, () => PRINT_WORD(";"));
12257
- });
12258
- }
12259
- F3.printFilter(ast, () => PRINT("]"));
12260
11952
  }
12261
11953
  };
12262
11954
  }
12263
- var blankNodePropertyList = blankNodePropertyListImpl("blankNodePropertyList", false);
12264
- var blankNodePropertyListPath = blankNodePropertyListImpl("blankNodePropertyListPath", true);
12265
- function graphNodeImpl(name, allowPaths) {
12266
- const triplesNodeRule = allowPaths ? triplesNodePath : triplesNode;
11955
+ function funcExpr3or4(func) {
12267
11956
  return {
12268
- name,
12269
- impl: ({ SUBRULE, OR }) => (C) => OR([
12270
- { ALT: () => SUBRULE(varOrTerm, void 0) },
12271
- {
12272
- GATE: () => C.parseMode.has("canCreateBlankNodes"),
12273
- ALT: () => SUBRULE(triplesNodeRule, void 0)
12274
- }
12275
- ]),
12276
- gImpl: ({ SUBRULE }) => (ast, { factory: F3 }) => {
12277
- if (F3.isTerm(ast)) {
12278
- SUBRULE(varOrTerm, ast, void 0);
12279
- } else {
12280
- SUBRULE(triplesNodeRule, ast, void 0);
12281
- }
11957
+ name: unCapitalize(func.name),
11958
+ impl: ({
11959
+ ACTION,
11960
+ CONSUME,
11961
+ SUBRULE1,
11962
+ SUBRULE2,
11963
+ SUBRULE3,
11964
+ SUBRULE4,
11965
+ CONSUME1,
11966
+ OPTION,
11967
+ CONSUME2,
11968
+ CONSUME3
11969
+ }) => (C) => {
11970
+ const operator = CONSUME(func);
11971
+ CONSUME(symbols_exports.LParen);
11972
+ const arg1 = SUBRULE1(expression);
11973
+ CONSUME1(symbols_exports.comma);
11974
+ const arg2 = SUBRULE2(expression);
11975
+ CONSUME2(symbols_exports.comma);
11976
+ const arg3 = SUBRULE3(expression);
11977
+ const arg4 = OPTION(() => {
11978
+ CONSUME3(symbols_exports.comma);
11979
+ return SUBRULE4(expression);
11980
+ });
11981
+ const close = CONSUME(symbols_exports.RParen);
11982
+ return ACTION(() => C.factory.expressionOperation(
11983
+ operator.image,
11984
+ arg4 ? [arg1, arg2, arg3, arg4] : [arg1, arg2, arg3],
11985
+ C.factory.sourceLocation(operator, close)
11986
+ ));
11987
+ }
11988
+ };
11989
+ }
11990
+ function funcGroupGraphPattern(func) {
11991
+ return {
11992
+ name: unCapitalize(func.name),
11993
+ impl: ({ ACTION, SUBRULE, CONSUME }) => (C) => {
11994
+ const operator = CONSUME(func);
11995
+ const group = SUBRULE(groupGraphPattern);
11996
+ return ACTION(() => C.factory.expressionPatternOperation(
11997
+ operator.image,
11998
+ group,
11999
+ C.factory.sourceLocation(operator, group)
12000
+ ));
12001
+ }
12002
+ };
12003
+ }
12004
+ function baseAggregateFunc(func) {
12005
+ return {
12006
+ name: unCapitalize(func.name),
12007
+ impl: ({ ACTION, CONSUME, SUBRULE, OPTION }) => (C) => {
12008
+ const operator = CONSUME(func);
12009
+ CONSUME(symbols_exports.LParen);
12010
+ const distinct2 = OPTION(() => CONSUME(distinct));
12011
+ const expr1 = SUBRULE(expression);
12012
+ const close = CONSUME(symbols_exports.RParen);
12013
+ return ACTION(() => C.factory.aggregate(
12014
+ operator.image,
12015
+ distinct2 !== void 0,
12016
+ expr1,
12017
+ void 0,
12018
+ C.factory.sourceLocation(operator, close)
12019
+ ));
12282
12020
  }
12283
12021
  };
12284
12022
  }
12285
- var graphNode = graphNodeImpl("graphNode", false);
12286
- var graphNodePath = graphNodeImpl("graphNodePath", true);
12287
12023
 
12288
- // ../rules-sparql-1-1/lib/grammar/whereClause.ts
12289
- var whereClause = {
12290
- name: "whereClause",
12291
- impl: ({ ACTION, SUBRULE, CONSUME, OPTION }) => (C) => {
12292
- const where2 = OPTION(() => CONSUME(where));
12293
- const group = SUBRULE(groupGraphPattern, void 0);
12294
- return ACTION(() => C.factory.wrap(group, C.factory.sourceLocation(where2, group)));
12295
- },
12296
- gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F3 }) => {
12297
- F3.printFilter(ast, () => PRINT_WORD("WHERE"));
12298
- SUBRULE(groupGraphPattern, ast.val, void 0);
12024
+ // ../rules-sparql-1-1/lib/grammar/builtIn.ts
12025
+ var builtInStr = funcExpr1(BuiltInCalls_exports.str);
12026
+ var builtInLang = funcExpr1(BuiltInCalls_exports.lang);
12027
+ var builtInLangmatches = funcExpr2(BuiltInCalls_exports.langmatches);
12028
+ var builtInDatatype = funcExpr1(BuiltInCalls_exports.datatype);
12029
+ var builtInBound = funcVar1(BuiltInCalls_exports.bound);
12030
+ var builtInIri = funcExpr1(BuiltInCalls_exports.iri);
12031
+ var builtInUri = funcExpr1(BuiltInCalls_exports.uri);
12032
+ var builtInBnodeSparqlJs = funcExprOrNil1(BuiltInCalls_exports.bnode);
12033
+ var builtInRand = funcNil1(BuiltInCalls_exports.rand);
12034
+ var builtInAbs = funcExpr1(BuiltInCalls_exports.abs);
12035
+ var builtInCeil = funcExpr1(BuiltInCalls_exports.ceil);
12036
+ var builtInFloor = funcExpr1(BuiltInCalls_exports.floor);
12037
+ var builtInRound = funcExpr1(BuiltInCalls_exports.round);
12038
+ var builtInConcat = funcExprList1(BuiltInCalls_exports.concat);
12039
+ var builtInStrlen = funcExpr1(BuiltInCalls_exports.strlen);
12040
+ var builtInUcase = funcExpr1(BuiltInCalls_exports.ucase);
12041
+ var builtInLcase = funcExpr1(BuiltInCalls_exports.lcase);
12042
+ var builtInEncode_for_uri = funcExpr1(BuiltInCalls_exports.encode_for_uri);
12043
+ var builtInContains = funcExpr2(BuiltInCalls_exports.contains);
12044
+ var builtInStrstarts = funcExpr2(BuiltInCalls_exports.strstarts);
12045
+ var builtInStrends = funcExpr2(BuiltInCalls_exports.strends);
12046
+ var builtInStrbefore = funcExpr2(BuiltInCalls_exports.strbefore);
12047
+ var builtInStrafter = funcExpr2(BuiltInCalls_exports.strafter);
12048
+ var builtInYear = funcExpr1(BuiltInCalls_exports.year);
12049
+ var builtInMonth = funcExpr1(BuiltInCalls_exports.month);
12050
+ var builtInDay = funcExpr1(BuiltInCalls_exports.day);
12051
+ var builtInHours = funcExpr1(BuiltInCalls_exports.hours);
12052
+ var builtInMinutes = funcExpr1(BuiltInCalls_exports.minutes);
12053
+ var builtInSeconds = funcExpr1(BuiltInCalls_exports.seconds);
12054
+ var builtInTimezone = funcExpr1(BuiltInCalls_exports.timezone);
12055
+ var builtInTz = funcExpr1(BuiltInCalls_exports.tz);
12056
+ var builtInNow = funcNil1(BuiltInCalls_exports.now);
12057
+ var builtInUuid = funcNil1(BuiltInCalls_exports.uuid);
12058
+ var builtInStruuid = funcNil1(BuiltInCalls_exports.struuid);
12059
+ var builtInMd5 = funcExpr1(BuiltInCalls_exports.md5);
12060
+ var builtInSha1 = funcExpr1(BuiltInCalls_exports.sha1);
12061
+ var builtInSha256 = funcExpr1(BuiltInCalls_exports.sha256);
12062
+ var builtInSha384 = funcExpr1(BuiltInCalls_exports.sha384);
12063
+ var builtInSha512 = funcExpr1(BuiltInCalls_exports.sha512);
12064
+ var builtInCoalesce = funcExprList1(BuiltInCalls_exports.coalesce);
12065
+ var builtInIf = funcExpr3(BuiltInCalls_exports.if_);
12066
+ var builtInStrlang = funcExpr2(BuiltInCalls_exports.strlang);
12067
+ var builtInStrdt = funcExpr2(BuiltInCalls_exports.strdt);
12068
+ var builtInSameterm = funcExpr2(BuiltInCalls_exports.sameterm);
12069
+ var builtInIsiri = funcExpr1(BuiltInCalls_exports.isiri);
12070
+ var builtInIsuri = funcExpr1(BuiltInCalls_exports.isuri);
12071
+ var builtInIsblank = funcExpr1(BuiltInCalls_exports.isblank);
12072
+ var builtInIsliteral = funcExpr1(BuiltInCalls_exports.isliteral);
12073
+ var builtInIsnumeric = funcExpr1(BuiltInCalls_exports.isnumeric);
12074
+ function builtInCallList(SUBRULE) {
12075
+ return [
12076
+ { ALT: () => SUBRULE(aggregate) },
12077
+ { ALT: () => SUBRULE(builtInStr) },
12078
+ { ALT: () => SUBRULE(builtInLang) },
12079
+ { ALT: () => SUBRULE(builtInLangmatches) },
12080
+ { ALT: () => SUBRULE(builtInDatatype) },
12081
+ { ALT: () => SUBRULE(builtInBound) },
12082
+ { ALT: () => SUBRULE(builtInIri) },
12083
+ { ALT: () => SUBRULE(builtInUri) },
12084
+ { ALT: () => SUBRULE(builtInBnodeSparqlJs) },
12085
+ { ALT: () => SUBRULE(builtInRand) },
12086
+ { ALT: () => SUBRULE(builtInAbs) },
12087
+ { ALT: () => SUBRULE(builtInCeil) },
12088
+ { ALT: () => SUBRULE(builtInFloor) },
12089
+ { ALT: () => SUBRULE(builtInRound) },
12090
+ { ALT: () => SUBRULE(builtInConcat) },
12091
+ { ALT: () => SUBRULE(substringExpression) },
12092
+ { ALT: () => SUBRULE(builtInStrlen) },
12093
+ { ALT: () => SUBRULE(strReplaceExpression) },
12094
+ { ALT: () => SUBRULE(builtInUcase) },
12095
+ { ALT: () => SUBRULE(builtInLcase) },
12096
+ { ALT: () => SUBRULE(builtInEncode_for_uri) },
12097
+ { ALT: () => SUBRULE(builtInContains) },
12098
+ { ALT: () => SUBRULE(builtInStrstarts) },
12099
+ { ALT: () => SUBRULE(builtInStrends) },
12100
+ { ALT: () => SUBRULE(builtInStrbefore) },
12101
+ { ALT: () => SUBRULE(builtInStrafter) },
12102
+ { ALT: () => SUBRULE(builtInYear) },
12103
+ { ALT: () => SUBRULE(builtInMonth) },
12104
+ { ALT: () => SUBRULE(builtInDay) },
12105
+ { ALT: () => SUBRULE(builtInHours) },
12106
+ { ALT: () => SUBRULE(builtInMinutes) },
12107
+ { ALT: () => SUBRULE(builtInSeconds) },
12108
+ { ALT: () => SUBRULE(builtInTimezone) },
12109
+ { ALT: () => SUBRULE(builtInTz) },
12110
+ { ALT: () => SUBRULE(builtInNow) },
12111
+ { ALT: () => SUBRULE(builtInUuid) },
12112
+ { ALT: () => SUBRULE(builtInStruuid) },
12113
+ { ALT: () => SUBRULE(builtInMd5) },
12114
+ { ALT: () => SUBRULE(builtInSha1) },
12115
+ { ALT: () => SUBRULE(builtInSha256) },
12116
+ { ALT: () => SUBRULE(builtInSha384) },
12117
+ { ALT: () => SUBRULE(builtInSha512) },
12118
+ { ALT: () => SUBRULE(builtInCoalesce) },
12119
+ { ALT: () => SUBRULE(builtInIf) },
12120
+ { ALT: () => SUBRULE(builtInStrlang) },
12121
+ { ALT: () => SUBRULE(builtInStrdt) },
12122
+ { ALT: () => SUBRULE(builtInSameterm) },
12123
+ { ALT: () => SUBRULE(builtInIsiri) },
12124
+ { ALT: () => SUBRULE(builtInIsuri) },
12125
+ { ALT: () => SUBRULE(builtInIsblank) },
12126
+ { ALT: () => SUBRULE(builtInIsliteral) },
12127
+ { ALT: () => SUBRULE(builtInIsnumeric) },
12128
+ { ALT: () => SUBRULE(regexExpression) },
12129
+ { ALT: () => SUBRULE(existsFunc) },
12130
+ { ALT: () => SUBRULE(notExistsFunc) }
12131
+ ];
12132
+ }
12133
+ var builtInCall = {
12134
+ name: "builtInCall",
12135
+ impl: ({ OR, SUBRULE, cache }) => () => {
12136
+ const cached = cache.get(builtInCall);
12137
+ if (cached) {
12138
+ return OR(cached);
12139
+ }
12140
+ const builtIns = builtInCallList(SUBRULE);
12141
+ cache.set(builtInCall, builtIns);
12142
+ return OR(builtIns);
12299
12143
  }
12300
12144
  };
12301
- var groupGraphPattern = {
12302
- name: "groupGraphPattern",
12303
- impl: ({ ACTION, SUBRULE, CONSUME, OR }) => (C) => {
12304
- const open = CONSUME(symbols_exports.LCurly);
12305
- const patterns = OR([
12306
- { ALT: () => [SUBRULE(subSelect, void 0)] },
12307
- { ALT: () => SUBRULE(groupGraphPatternSub, void 0) }
12145
+ var regexExpression = funcExpr2or3(BuiltInCalls_exports.regex);
12146
+ var substringExpression = funcExpr2or3(BuiltInCalls_exports.substr);
12147
+ var strReplaceExpression = funcExpr3or4(BuiltInCalls_exports.replace);
12148
+ var existsFunc = funcGroupGraphPattern(BuiltInCalls_exports.exists);
12149
+ var notExistsFunc = funcGroupGraphPattern(BuiltInCalls_exports.notexists);
12150
+ var aggregateCount = {
12151
+ name: unCapitalize(BuiltInCalls_exports.count.name),
12152
+ impl: ({ ACTION, CONSUME, SUBRULE, OR, OPTION }) => (C) => {
12153
+ const operatorToken = CONSUME(BuiltInCalls_exports.count);
12154
+ CONSUME(symbols_exports.LParen);
12155
+ const distinctToken = OPTION(() => CONSUME(distinct));
12156
+ const expressionVal = OR([
12157
+ { ALT: () => {
12158
+ const starToken = CONSUME(symbols_exports.star);
12159
+ return ACTION(() => C.factory.wildcard(C.factory.sourceLocation(starToken)));
12160
+ } },
12161
+ { ALT: () => SUBRULE(expression) }
12308
12162
  ]);
12309
- const close = CONSUME(symbols_exports.RCurly);
12310
- return ACTION(() => C.factory.patternGroup(patterns, C.factory.sourceLocation(open, close)));
12311
- },
12312
- gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F3 }) => {
12313
- F3.printFilter(ast, () => PRINT_WORD("{"));
12314
- for (const pattern of ast.patterns) {
12315
- SUBRULE(generatePattern, pattern, void 0);
12316
- }
12317
- F3.printFilter(ast, () => PRINT_WORD("}"));
12163
+ const closeToken = CONSUME(symbols_exports.RParen);
12164
+ return ACTION(() => {
12165
+ const F3 = C.factory;
12166
+ if (C.factory.isWildcard(expressionVal)) {
12167
+ return F3.aggregate(
12168
+ operatorToken.image,
12169
+ Boolean(distinctToken),
12170
+ expressionVal,
12171
+ void 0,
12172
+ C.factory.sourceLocation(operatorToken, closeToken)
12173
+ );
12174
+ }
12175
+ return F3.aggregate(
12176
+ operatorToken.image,
12177
+ Boolean(distinctToken),
12178
+ expressionVal,
12179
+ void 0,
12180
+ C.factory.sourceLocation(operatorToken, closeToken)
12181
+ );
12182
+ });
12318
12183
  }
12319
12184
  };
12320
- var generatePattern = {
12321
- name: "generatePattern",
12322
- gImpl: ({ SUBRULE }) => (ast, { factory: F3 }) => {
12323
- if (ast.type === "query") {
12324
- SUBRULE(query, F3.querySelect({
12325
- context: [],
12326
- datasets: F3.datasetClauses([], F3.sourceLocation()),
12327
- where: ast.where,
12328
- variables: ast.variables,
12329
- solutionModifiers: ast.solutionModifiers,
12330
- values: ast.values,
12331
- distinct: ast.distinct,
12332
- reduced: ast.reduced
12333
- }, ast.loc), void 0);
12334
- } else if (ast.subType === "group") {
12335
- SUBRULE(groupGraphPattern, ast, void 0);
12336
- } else if (ast.subType === "bgp") {
12337
- SUBRULE(triplesBlock, ast, void 0);
12338
- } else {
12339
- SUBRULE(graphPatternNotTriples, ast, void 0);
12340
- }
12185
+ var aggregateSum = baseAggregateFunc(BuiltInCalls_exports.sum);
12186
+ var aggregateMin = baseAggregateFunc(BuiltInCalls_exports.min);
12187
+ var aggregateMax = baseAggregateFunc(BuiltInCalls_exports.max);
12188
+ var aggregateAvg = baseAggregateFunc(BuiltInCalls_exports.avg);
12189
+ var aggregateSample = baseAggregateFunc(BuiltInCalls_exports.sample);
12190
+ var aggregateGroup_concat = {
12191
+ name: unCapitalize(BuiltInCalls_exports.groupConcat.name),
12192
+ impl: ({ ACTION, CONSUME, OPTION1, SUBRULE, OPTION2 }) => (C) => {
12193
+ const operatorToken = CONSUME(BuiltInCalls_exports.groupConcat);
12194
+ CONSUME(symbols_exports.LParen);
12195
+ const distinctToken = OPTION1(() => CONSUME(distinct));
12196
+ const expr = SUBRULE(expression);
12197
+ const sep = OPTION2(() => {
12198
+ CONSUME(symbols_exports.semi);
12199
+ CONSUME(separator);
12200
+ CONSUME(symbols_exports.equal);
12201
+ return SUBRULE(string);
12202
+ });
12203
+ const closeToken = CONSUME(symbols_exports.RParen);
12204
+ return ACTION(() => {
12205
+ const F3 = C.factory;
12206
+ return F3.aggregate(
12207
+ operatorToken.image,
12208
+ Boolean(distinctToken),
12209
+ expr,
12210
+ sep?.value ?? " ",
12211
+ F3.sourceLocation(operatorToken, closeToken)
12212
+ );
12213
+ });
12341
12214
  }
12342
12215
  };
12343
- var groupGraphPatternSub = {
12344
- name: "groupGraphPatternSub",
12345
- impl: ({ ACTION, SUBRULE, CONSUME, MANY, SUBRULE1, SUBRULE2, OPTION1, OPTION2, OPTION3 }) => () => {
12346
- const patterns = [];
12347
- const bgpPattern = OPTION1(() => SUBRULE1(triplesBlock, void 0));
12348
- if (bgpPattern) {
12349
- patterns.push(bgpPattern);
12350
- }
12351
- MANY(() => {
12352
- const notTriples = SUBRULE(graphPatternNotTriples, void 0);
12353
- patterns.push(notTriples);
12354
- OPTION2(() => CONSUME(symbols_exports.dot));
12355
- const moreTriples = OPTION3(() => SUBRULE2(triplesBlock, void 0));
12356
- if (moreTriples) {
12357
- patterns.push(moreTriples);
12216
+ var aggregate = {
12217
+ name: "aggregate",
12218
+ impl: ({ ACTION, SUBRULE, OR }) => (C) => {
12219
+ const wasInAggregate = ACTION(() => C.parseMode.has("inAggregate"));
12220
+ ACTION(() => C.parseMode.add("inAggregate"));
12221
+ const result = OR([
12222
+ { ALT: () => SUBRULE(aggregateCount) },
12223
+ { ALT: () => SUBRULE(aggregateSum) },
12224
+ { ALT: () => SUBRULE(aggregateMin) },
12225
+ { ALT: () => SUBRULE(aggregateMax) },
12226
+ { ALT: () => SUBRULE(aggregateAvg) },
12227
+ { ALT: () => SUBRULE(aggregateSample) },
12228
+ { ALT: () => SUBRULE(aggregateGroup_concat) }
12229
+ ]);
12230
+ ACTION(() => !wasInAggregate && C.parseMode.delete("inAggregate"));
12231
+ ACTION(() => {
12232
+ if (!C.parseMode.has("canParseAggregate")) {
12233
+ throw new Error("Aggregates are only allowed in SELECT, HAVING, and ORDER BY clauses.");
12234
+ }
12235
+ if (C.parseMode.has("inAggregate")) {
12236
+ throw new Error("An aggregate function is not allowed within an aggregate function.");
12358
12237
  }
12359
12238
  });
12360
- ACTION(() => checkNote13(patterns));
12361
- return patterns;
12362
- }
12363
- };
12364
- var graphPatternNotTriples = {
12365
- name: "graphPatternNotTriples",
12366
- impl: ({ SUBRULE, OR }) => () => OR([
12367
- { ALT: () => SUBRULE(groupOrUnionGraphPattern, void 0) },
12368
- { ALT: () => SUBRULE(optionalGraphPattern, void 0) },
12369
- { ALT: () => SUBRULE(minusGraphPattern, void 0) },
12370
- { ALT: () => SUBRULE(graphGraphPattern, void 0) },
12371
- { ALT: () => SUBRULE(serviceGraphPattern, void 0) },
12372
- { ALT: () => SUBRULE(filter3, void 0) },
12373
- { ALT: () => SUBRULE(bind2, void 0) },
12374
- { ALT: () => SUBRULE(inlineData, void 0) }
12375
- ]),
12376
- gImpl: ({ SUBRULE }) => (ast) => {
12377
- switch (ast.subType) {
12378
- case "group":
12379
- case "union":
12380
- SUBRULE(groupOrUnionGraphPattern, ast, void 0);
12381
- break;
12382
- case "optional":
12383
- SUBRULE(optionalGraphPattern, ast, void 0);
12384
- break;
12385
- case "minus":
12386
- SUBRULE(minusGraphPattern, ast, void 0);
12387
- break;
12388
- case "graph":
12389
- SUBRULE(graphGraphPattern, ast, void 0);
12390
- break;
12391
- case "service":
12392
- SUBRULE(serviceGraphPattern, ast, void 0);
12393
- break;
12394
- case "filter":
12395
- SUBRULE(filter3, ast, void 0);
12396
- break;
12397
- case "bind":
12398
- SUBRULE(bind2, ast, void 0);
12399
- break;
12400
- case "values":
12401
- SUBRULE(inlineData, ast, void 0);
12402
- break;
12239
+ return result;
12240
+ },
12241
+ gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F3 }) => {
12242
+ F3.printFilter(ast, () => {
12243
+ PRINT_WORD(ast.aggregation, "(");
12244
+ if (ast.distinct) {
12245
+ PRINT_WORD("DISTINCT");
12246
+ }
12247
+ });
12248
+ const arg = ast.expression[0];
12249
+ if (F3.isWildcard(arg)) {
12250
+ F3.printFilter(ast, () => PRINT_WORD("*"));
12251
+ } else {
12252
+ SUBRULE(expression, arg);
12253
+ }
12254
+ if (F3.isExpressionAggregateSeparator(ast)) {
12255
+ F3.printFilter(ast, () => PRINT_WORD(";", "SEPARATOR", "=", stringEscapedLexical(ast.separator)));
12403
12256
  }
12257
+ F3.printFilter(ast, () => PRINT_WORD(")"));
12404
12258
  }
12405
12259
  };
12406
- var optionalGraphPattern = {
12407
- name: "optionalGraphPattern",
12408
- impl: ({ ACTION, SUBRULE, CONSUME }) => (C) => {
12409
- const optional2 = CONSUME(optional);
12410
- const group = SUBRULE(groupGraphPattern, void 0);
12411
- return ACTION(() => C.factory.patternOptional(group.patterns, C.factory.sourceLocation(optional2, group)));
12412
- },
12413
- gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F3 }) => {
12414
- F3.printFilter(ast, () => PRINT_WORD("OPTIONAL"));
12415
- SUBRULE(groupGraphPattern, F3.patternGroup(ast.patterns, ast.loc), void 0);
12416
- }
12417
- };
12418
- var graphGraphPattern = {
12419
- name: "graphGraphPattern",
12420
- impl: ({ ACTION, SUBRULE, CONSUME }) => (C) => {
12421
- const graph2 = CONSUME(graph_exports.graph);
12422
- const name = SUBRULE(varOrIri, void 0);
12423
- const group = SUBRULE(groupGraphPattern, void 0);
12424
- return ACTION(() => C.factory.patternGraph(name, group.patterns, C.factory.sourceLocation(graph2, group)));
12425
- },
12426
- gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F3 }) => {
12427
- F3.printFilter(ast, () => PRINT_WORD("GRAPH"));
12428
- SUBRULE(varOrTerm, ast.name, void 0);
12429
- SUBRULE(groupGraphPattern, F3.patternGroup(ast.patterns, ast.loc), void 0);
12430
- }
12431
- };
12432
- var serviceGraphPattern = {
12433
- name: "serviceGraphPattern",
12434
- impl: ({ ACTION, SUBRULE1, CONSUME, OPTION }) => (C) => {
12435
- const service2 = CONSUME(service);
12436
- const silent2 = OPTION(() => {
12437
- CONSUME(silent);
12438
- return true;
12439
- }) ?? false;
12440
- const name = SUBRULE1(varOrIri, void 0);
12441
- const group = SUBRULE1(groupGraphPattern, void 0);
12442
- return ACTION(() => C.factory.patternService(name, group.patterns, silent2, C.factory.sourceLocation(service2, group)));
12443
- },
12444
- gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F3 }) => {
12445
- F3.printFilter(ast, () => {
12446
- PRINT_WORD("SERVICE");
12447
- if (ast.silent) {
12448
- PRINT_WORD("SILENT");
12449
- }
12450
- });
12451
- SUBRULE(varOrTerm, ast.name, void 0);
12452
- SUBRULE(groupGraphPattern, F3.patternGroup(ast.patterns, ast.loc), void 0);
12453
- }
12454
- };
12455
- var bind2 = {
12456
- name: "bind",
12457
- impl: ({ ACTION, SUBRULE, CONSUME }) => (C) => {
12458
- const bind3 = CONSUME(bind);
12459
- CONSUME(symbols_exports.LParen);
12460
- const expressionVal = SUBRULE(expression, void 0);
12461
- CONSUME(as);
12462
- const variable = SUBRULE(var_, void 0);
12463
- const close = CONSUME(symbols_exports.RParen);
12464
- return ACTION(() => C.factory.patternBind(expressionVal, variable, C.factory.sourceLocation(bind3, close)));
12465
- },
12466
- gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F3 }) => {
12467
- F3.printFilter(ast, () => PRINT_WORD("BIND", "("));
12468
- SUBRULE(expression, ast.expression, void 0);
12469
- F3.printFilter(ast, () => PRINT_WORD("AS"));
12470
- SUBRULE(var_, ast.variable, void 0);
12471
- F3.printFilter(ast, () => PRINT_WORD(")"));
12472
- }
12260
+
12261
+ // ../rules-sparql-1-1/lib/grammar/propertyPaths.ts
12262
+ var path = {
12263
+ name: "path",
12264
+ impl: ({ SUBRULE }) => () => SUBRULE(pathAlternative)
12473
12265
  };
12474
- var inlineData = {
12475
- name: "inlineData",
12476
- impl: ({ ACTION, SUBRULE, CONSUME }) => (C) => {
12477
- const values3 = CONSUME(values2);
12478
- const datablock = SUBRULE(dataBlock, void 0);
12479
- return ACTION(() => C.factory.patternValues(datablock.val, C.factory.sourceLocation(values3, datablock)));
12480
- },
12481
- gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F3 }) => {
12482
- const variables = Object.keys(ast.values[0]);
12483
- F3.printFilter(ast, () => {
12484
- PRINT_WORD("VALUES", "(");
12485
- for (const variable of variables) {
12486
- PRINT_WORD(`?${variable}`);
12487
- }
12488
- PRINT_WORD(")", "{");
12489
- });
12490
- for (const mapping of ast.values) {
12491
- F3.printFilter(ast, () => PRINT_WORD("("));
12492
- for (const variable of variables) {
12493
- if (mapping[variable] === void 0) {
12494
- F3.printFilter(ast, () => PRINT_WORD("UNDEF"));
12495
- } else {
12496
- SUBRULE(graphNodePath, mapping[variable], void 0);
12266
+ var pathGenerator = {
12267
+ name: "path",
12268
+ gImpl: ({ PRINT, SUBRULE }) => (ast, { factory: F3 }, braces = true) => {
12269
+ if (F3.isTerm(ast) && F3.isTermNamed(ast)) {
12270
+ SUBRULE(iri2, ast);
12271
+ } else {
12272
+ F3.printFilter(ast, () => braces && PRINT("("));
12273
+ switch (ast.subType) {
12274
+ case "|":
12275
+ case "/": {
12276
+ const [head2, ...tail] = ast.items;
12277
+ SUBRULE(pathGenerator, head2, braces);
12278
+ for (const val of tail) {
12279
+ F3.printFilter(ast, () => PRINT(ast.subType));
12280
+ SUBRULE(pathGenerator, val, braces);
12281
+ }
12282
+ break;
12497
12283
  }
12284
+ case "^":
12285
+ F3.printFilter(ast, () => PRINT("^"));
12286
+ SUBRULE(pathGenerator, ast.items[0], braces);
12287
+ break;
12288
+ case "?":
12289
+ case "*":
12290
+ case "+":
12291
+ SUBRULE(pathGenerator, ast.items[0], braces);
12292
+ F3.printFilter(ast, () => PRINT(ast.subType));
12293
+ break;
12294
+ case "!":
12295
+ F3.printFilter(ast, () => PRINT("!"));
12296
+ F3.printFilter(ast, () => PRINT("("));
12297
+ SUBRULE(pathGenerator, ast.items[0], false);
12298
+ F3.printFilter(ast, () => PRINT(")"));
12299
+ break;
12498
12300
  }
12499
- F3.printFilter(ast, () => PRINT_WORD(")"));
12301
+ F3.printFilter(ast, () => braces && PRINT(")"));
12500
12302
  }
12501
- F3.printFilter(ast, () => PRINT_WORD("}"));
12502
12303
  }
12503
12304
  };
12504
- var dataBlock = {
12505
- name: "dataBlock",
12506
- impl: ({ SUBRULE, OR }) => () => OR([
12507
- { ALT: () => SUBRULE(inlineDataOneVar, void 0) },
12508
- { ALT: () => SUBRULE(inlineDataFull, void 0) }
12305
+ function pathChainHelper(name, SEP, subType, subRule) {
12306
+ return {
12307
+ name,
12308
+ impl: ({ ACTION, CONSUME, SUBRULE1, SUBRULE2, MANY }) => (C) => {
12309
+ const head2 = SUBRULE1(subRule);
12310
+ let tailEnd = head2;
12311
+ const tail = [];
12312
+ MANY(() => {
12313
+ CONSUME(SEP);
12314
+ tailEnd = SUBRULE2(subRule);
12315
+ tail.push(tailEnd);
12316
+ });
12317
+ return ACTION(() => tail.length === 0 ? head2 : C.factory.path(subType, [head2, ...tail], C.factory.sourceLocation(head2, tailEnd)));
12318
+ }
12319
+ };
12320
+ }
12321
+ var pathEltOrInverse = {
12322
+ name: "pathEltOrInverse",
12323
+ impl: ({ ACTION, CONSUME, SUBRULE1, SUBRULE2, OR }) => (C) => OR([
12324
+ { ALT: () => SUBRULE1(pathElt) },
12325
+ { ALT: () => {
12326
+ const hat2 = CONSUME(symbols_exports.hat);
12327
+ const item = SUBRULE2(pathElt);
12328
+ return ACTION(() => C.factory.path("^", [item], C.factory.sourceLocation(hat2, item)));
12329
+ } }
12509
12330
  ])
12510
12331
  };
12511
- var inlineDataOneVar = {
12512
- name: "inlineDataOneVar",
12513
- impl: ({ ACTION, SUBRULE, CONSUME, MANY }) => (C) => {
12514
- const res = [];
12515
- const varVal = SUBRULE(var_, void 0);
12516
- CONSUME(symbols_exports.LCurly);
12517
- MANY(() => {
12518
- const value = SUBRULE(dataBlockValue, void 0);
12519
- ACTION(() => {
12520
- res.push({ [varVal.value]: value });
12521
- });
12522
- });
12523
- const close = CONSUME(symbols_exports.RCurly);
12524
- return ACTION(() => C.factory.wrap(res, C.factory.sourceLocation(varVal, close)));
12332
+ var pathSequence = pathChainHelper("pathSequence", symbols_exports.slash, "/", pathEltOrInverse);
12333
+ var pathAlternative = pathChainHelper("pathAlternative", symbols_exports.pipe, "|", pathSequence);
12334
+ var pathElt = {
12335
+ name: "pathElt",
12336
+ impl: ({ ACTION, SUBRULE, OPTION }) => (C) => {
12337
+ const item = SUBRULE(pathPrimary);
12338
+ const modification = OPTION(() => SUBRULE(pathMod));
12339
+ return ACTION(() => modification === void 0 ? item : C.factory.path(modification.image, [item], C.factory.sourceLocation(item, modification)));
12525
12340
  }
12526
12341
  };
12527
- var inlineDataFull = {
12528
- name: "inlineDataFull",
12529
- impl: ({
12530
- ACTION,
12531
- OR,
12532
- MANY1,
12533
- MANY2,
12534
- MANY3,
12535
- MANY4,
12536
- SUBRULE,
12537
- CONSUME1,
12538
- CONSUME2
12539
- }) => (C) => {
12540
- const res = [];
12541
- const vars = [];
12342
+ var pathMod = {
12343
+ name: "pathMod",
12344
+ impl: ({ CONSUME, OR }) => () => OR([
12345
+ { ALT: () => CONSUME(symbols_exports.question) },
12346
+ { ALT: () => CONSUME(symbols_exports.star) },
12347
+ { ALT: () => CONSUME(symbols_exports.opPlus) }
12348
+ ])
12349
+ };
12350
+ var pathPrimary = {
12351
+ name: "pathPrimary",
12352
+ impl: ({ SUBRULE, CONSUME, OR }) => () => OR([
12353
+ { ALT: () => SUBRULE(iri2) },
12354
+ { ALT: () => SUBRULE(verbA) },
12355
+ { ALT: () => SUBRULE(pathNegatedPropertySet) },
12356
+ { ALT: () => {
12357
+ CONSUME(symbols_exports.LParen);
12358
+ const resRecursive = SUBRULE(path);
12359
+ CONSUME(symbols_exports.RParen);
12360
+ return resRecursive;
12361
+ } }
12362
+ ])
12363
+ };
12364
+ var pathNegatedPropertySet = {
12365
+ name: "pathNegatedPropertySet",
12366
+ impl: ({ ACTION, CONSUME, SUBRULE1, SUBRULE2, SUBRULE3, OR, MANY }) => (C) => {
12367
+ const exclamation2 = CONSUME(symbols_exports.exclamation);
12542
12368
  return OR([
12543
12369
  { ALT: () => {
12544
- const nil2 = CONSUME1(terminals_exports.nil);
12545
- CONSUME1(symbols_exports.LCurly);
12546
- MANY1(() => {
12547
- CONSUME2(terminals_exports.nil);
12548
- res.push({});
12549
- });
12550
- const close = CONSUME1(symbols_exports.RCurly);
12551
- return ACTION(() => C.factory.wrap(res, C.factory.sourceLocation(nil2, close)));
12370
+ const noAlternative = SUBRULE1(pathOneInPropertySet);
12371
+ return ACTION(() => C.factory.path("!", [noAlternative], C.factory.sourceLocation(exclamation2, noAlternative)));
12552
12372
  } },
12553
12373
  { ALT: () => {
12554
- const open = CONSUME1(symbols_exports.LParen);
12555
- MANY2(() => {
12556
- vars.push(SUBRULE(var_, void 0));
12374
+ const open = CONSUME(symbols_exports.LParen);
12375
+ const head2 = SUBRULE2(pathOneInPropertySet);
12376
+ const tail = [];
12377
+ MANY(() => {
12378
+ CONSUME(symbols_exports.pipe);
12379
+ const item = SUBRULE3(pathOneInPropertySet);
12380
+ tail.push(item);
12557
12381
  });
12558
- CONSUME1(symbols_exports.RParen);
12559
- CONSUME2(symbols_exports.LCurly);
12560
- MANY3(() => {
12561
- let parsedValues = 0;
12562
- const currentRow = {};
12563
- CONSUME2(symbols_exports.LParen);
12564
- MANY4(() => {
12565
- if (parsedValues >= vars.length) {
12566
- throw new Error("Number of dataBlockValues does not match number of variables. Too much values.");
12567
- }
12568
- const value = SUBRULE(dataBlockValue, void 0);
12569
- ACTION(() => {
12570
- currentRow[vars[parsedValues].value] = value;
12571
- parsedValues++;
12572
- });
12573
- });
12574
- CONSUME2(symbols_exports.RParen);
12575
- ACTION(() => {
12576
- res.push(currentRow);
12577
- if (vars.length !== parsedValues) {
12578
- throw new Error("Number of dataBlockValues does not match number of variables. Too few values.");
12579
- }
12580
- });
12382
+ const close = CONSUME(symbols_exports.RParen);
12383
+ return ACTION(() => {
12384
+ const F3 = C.factory;
12385
+ if (tail.length === 0) {
12386
+ return F3.path("!", [head2], F3.sourceLocation(exclamation2, close));
12387
+ }
12388
+ return F3.path(
12389
+ "!",
12390
+ [F3.path("|", [head2, ...tail], F3.sourceLocation(open, close))],
12391
+ F3.sourceLocation(exclamation2, close)
12392
+ );
12581
12393
  });
12582
- const close = CONSUME2(symbols_exports.RCurly);
12583
- return ACTION(() => C.factory.wrap(res, C.factory.sourceLocation(open, close)));
12584
12394
  } }
12585
12395
  ]);
12586
12396
  }
12587
12397
  };
12588
- var dataBlockValue = {
12589
- name: "dataBlockValue",
12590
- impl: ({ SUBRULE, CONSUME, OR }) => () => OR([
12591
- { ALT: () => SUBRULE(iri2, void 0) },
12592
- { ALT: () => SUBRULE(rdfLiteral, void 0) },
12593
- { ALT: () => SUBRULE(numericLiteral, void 0) },
12594
- { ALT: () => SUBRULE(booleanLiteral, void 0) },
12398
+ var pathOneInPropertySet = {
12399
+ name: "pathOneInPropertySet",
12400
+ impl: ({ ACTION, CONSUME, SUBRULE1, SUBRULE2, OR1, OR2 }) => (C) => OR1([
12401
+ { ALT: () => SUBRULE1(iri2) },
12402
+ { ALT: () => SUBRULE1(verbA) },
12595
12403
  { ALT: () => {
12596
- CONSUME(undef);
12597
- return void 0;
12404
+ const hat2 = CONSUME(symbols_exports.hat);
12405
+ const item = OR2([
12406
+ { ALT: () => SUBRULE2(iri2) },
12407
+ { ALT: () => SUBRULE2(verbA) }
12408
+ ]);
12409
+ return ACTION(() => C.factory.path("^", [item], C.factory.sourceLocation(hat2, item)));
12598
12410
  } }
12599
12411
  ])
12600
12412
  };
12601
- var minusGraphPattern = {
12602
- name: "minusGraphPattern",
12603
- impl: ({ ACTION, SUBRULE, CONSUME }) => (C) => {
12604
- const minus2 = CONSUME(minus);
12605
- const group = SUBRULE(groupGraphPattern, void 0);
12606
- return ACTION(() => C.factory.patternMinus(group.patterns, C.factory.sourceLocation(minus2, group)));
12607
- },
12608
- gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F3 }) => {
12609
- F3.printFilter(ast, () => PRINT_WORD("MINUS"));
12610
- SUBRULE(groupGraphPattern, F3.patternGroup(ast.patterns, ast.loc), void 0);
12611
- }
12612
- };
12613
- var groupOrUnionGraphPattern = {
12614
- name: "groupOrUnionGraphPattern",
12615
- impl: ({ ACTION, MANY, SUBRULE1, SUBRULE2, CONSUME }) => (C) => {
12616
- const groups = [];
12617
- const group = SUBRULE1(groupGraphPattern, void 0);
12618
- groups.push(group);
12619
- MANY(() => {
12620
- CONSUME(union);
12621
- const group2 = SUBRULE2(groupGraphPattern, void 0);
12622
- groups.push(group2);
12623
- });
12624
- return ACTION(() => groups.length === 1 ? groups[0] : C.factory.patternUnion(
12625
- groups,
12626
- C.factory.sourceLocation(group, groups.at(-1))
12627
- ));
12628
- },
12629
- gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F3 }) => {
12630
- if (F3.isPatternUnion(ast)) {
12631
- const [head2, ...tail] = ast.patterns;
12632
- SUBRULE(groupGraphPattern, head2, void 0);
12633
- for (const pattern of tail) {
12634
- F3.printFilter(ast, () => PRINT_WORD("UNION"));
12635
- SUBRULE(groupGraphPattern, pattern, void 0);
12636
- }
12637
- } else {
12638
- SUBRULE(groupGraphPattern, ast, void 0);
12639
- }
12640
- }
12641
- };
12642
- var filter3 = {
12643
- name: "filter",
12644
- impl: ({ ACTION, SUBRULE, CONSUME }) => (C) => {
12645
- const filterToken = CONSUME(filter2);
12646
- const expression2 = SUBRULE(constraint, void 0);
12647
- return ACTION(() => C.factory.patternFilter(expression2, C.factory.sourceLocation(filterToken, expression2)));
12648
- },
12649
- gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F3 }) => {
12650
- F3.printFilter(ast, () => PRINT_WORD("FILTER ("));
12651
- SUBRULE(expression, ast.expression, void 0);
12652
- F3.printFilter(ast, () => PRINT_WORD(")"));
12653
- }
12654
- };
12655
- var constraint = {
12656
- name: "constraint",
12657
- impl: ({ SUBRULE, OR }) => () => OR([
12658
- { ALT: () => SUBRULE(brackettedExpression, void 0) },
12659
- { ALT: () => SUBRULE(builtInCall, void 0) },
12660
- { ALT: () => SUBRULE(functionCall, void 0) }
12661
- ])
12662
- };
12663
- var functionCall = {
12664
- name: "functionCall",
12665
- impl: ({ ACTION, SUBRULE }) => (C) => {
12666
- const func = SUBRULE(iri2, void 0);
12667
- const args = SUBRULE(argList, void 0);
12668
- return ACTION(() => C.factory.expressionFunctionCall(
12669
- func,
12670
- args.val.args,
12671
- args.val.distinct,
12672
- C.factory.sourceLocation(func, args)
12673
- ));
12674
- }
12675
- };
12676
12413
 
12677
- // ../rules-sparql-1-1/lib/expressionHelpers.ts
12678
- function funcExpr1(func) {
12679
- return {
12680
- name: unCapitalize(func.name),
12681
- impl: ({ ACTION, SUBRULE, CONSUME }) => (C) => {
12682
- const operator = CONSUME(func);
12683
- CONSUME(symbols_exports.LParen);
12684
- const arg = SUBRULE(expression, void 0);
12685
- const close = CONSUME(symbols_exports.RParen);
12686
- return ACTION(() => C.factory.expressionOperation(operator.image, [arg], C.factory.sourceLocation(operator, close)));
12687
- }
12414
+ // ../rules-sparql-1-1/lib/grammar/tripleBlock.ts
12415
+ function triplesDotSeperated(triplesSameSubjectSubrule) {
12416
+ return ({ ACTION, AT_LEAST_ONE, SUBRULE, CONSUME, OPTION }) => (C) => {
12417
+ const triples = [];
12418
+ let parsedDot = true;
12419
+ let dotToken;
12420
+ AT_LEAST_ONE({
12421
+ GATE: () => parsedDot,
12422
+ DEF: () => {
12423
+ parsedDot = false;
12424
+ const template = SUBRULE(triplesSameSubjectSubrule);
12425
+ ACTION(() => {
12426
+ triples.push(...template);
12427
+ });
12428
+ OPTION(() => {
12429
+ dotToken = CONSUME(symbols_exports.dot);
12430
+ parsedDot = true;
12431
+ });
12432
+ }
12433
+ });
12434
+ return ACTION(() => C.factory.patternBgp(triples, C.factory.sourceLocation(...triples, dotToken)));
12688
12435
  };
12689
12436
  }
12690
- function funcExpr2(func) {
12691
- return {
12692
- name: unCapitalize(func.name),
12693
- impl: ({ ACTION, CONSUME, SUBRULE1, SUBRULE2 }) => (C) => {
12694
- const operator = CONSUME(func);
12695
- CONSUME(symbols_exports.LParen);
12696
- const arg1 = SUBRULE1(expression, void 0);
12697
- CONSUME(symbols_exports.comma);
12698
- const arg2 = SUBRULE2(expression, void 0);
12699
- const close = CONSUME(symbols_exports.RParen);
12700
- return ACTION(() => C.factory.expressionOperation(operator.image, [arg1, arg2], C.factory.sourceLocation(operator, close)));
12437
+ var triplesBlock = {
12438
+ name: "triplesBlock",
12439
+ impl: (implArgs) => (C) => triplesDotSeperated(triplesSameSubjectPath)(implArgs)(C),
12440
+ gImpl: ({ SUBRULE, PRINT_WORD, HANDLE_LOC }) => (ast, { factory: F3 }) => {
12441
+ for (const [index, triple] of ast.triples.entries()) {
12442
+ HANDLE_LOC(triple, () => {
12443
+ const nextTriple = ast.triples.at(index);
12444
+ if (F3.isTripleCollection(triple)) {
12445
+ SUBRULE(graphNodePath, triple);
12446
+ F3.printFilter(triple, () => PRINT_WORD("."));
12447
+ } else {
12448
+ SUBRULE(graphNodePath, triple.subject);
12449
+ if (F3.isTerm(triple.predicate) && F3.isTermVariable(triple.predicate)) {
12450
+ SUBRULE(varOrTerm, triple.predicate);
12451
+ } else {
12452
+ SUBRULE(pathGenerator, triple.predicate, void 0);
12453
+ }
12454
+ SUBRULE(graphNodePath, triple.object);
12455
+ if (nextTriple === void 0 || F3.isTripleCollection(nextTriple) || !F3.isSourceLocationNoMaterialize(nextTriple.subject.loc)) {
12456
+ F3.printFilter(ast, () => PRINT_WORD("."));
12457
+ } else if (F3.isSourceLocationNoMaterialize(nextTriple.predicate.loc)) {
12458
+ F3.printFilter(ast, () => PRINT_WORD(","));
12459
+ } else {
12460
+ F3.printFilter(ast, () => PRINT_WORD(";"));
12461
+ }
12462
+ }
12463
+ });
12701
12464
  }
12702
- };
12703
- }
12704
- function funcExpr3(func) {
12465
+ }
12466
+ };
12467
+ function triplesSameSubjectImpl(name, allowPaths) {
12705
12468
  return {
12706
- name: unCapitalize(func.name),
12707
- impl: ({ ACTION, CONSUME, CONSUME1, CONSUME2, SUBRULE1, SUBRULE2, SUBRULE3 }) => (C) => {
12708
- const operator = CONSUME(func);
12709
- CONSUME(symbols_exports.LParen);
12710
- const arg1 = SUBRULE1(expression, void 0);
12711
- CONSUME1(symbols_exports.comma);
12712
- const arg2 = SUBRULE2(expression, void 0);
12713
- CONSUME2(symbols_exports.comma);
12714
- const arg3 = SUBRULE3(expression, void 0);
12715
- const close = CONSUME(symbols_exports.RParen);
12716
- return ACTION(() => C.factory.expressionOperation(operator.image, [arg1, arg2, arg3], C.factory.sourceLocation(operator, close)));
12717
- }
12469
+ name,
12470
+ impl: ({ ACTION, SUBRULE, OR }) => (C) => OR([
12471
+ { ALT: () => {
12472
+ const subject = SUBRULE(varOrTerm);
12473
+ const res = SUBRULE(
12474
+ allowPaths ? propertyListPathNotEmpty : propertyListNotEmpty,
12475
+ ACTION(() => C.factory.dematerialized(subject))
12476
+ );
12477
+ return ACTION(() => {
12478
+ if (res.length > 0) {
12479
+ res[0].subject = subject;
12480
+ res[0].loc = C.factory.sourceLocation(subject, res[0]);
12481
+ }
12482
+ return res;
12483
+ });
12484
+ } },
12485
+ { ALT: () => {
12486
+ const subjectNode = SUBRULE(allowPaths ? triplesNodePath : triplesNode);
12487
+ const restNode = SUBRULE(
12488
+ allowPaths ? propertyListPath : propertyList,
12489
+ ACTION(() => C.factory.graphNodeIdentifier(subjectNode))
12490
+ );
12491
+ return ACTION(() => {
12492
+ if (restNode.length === 0) {
12493
+ return [subjectNode];
12494
+ }
12495
+ restNode[0].subject = subjectNode;
12496
+ restNode[0].loc = C.factory.sourceLocation(subjectNode, restNode[0]);
12497
+ return restNode;
12498
+ });
12499
+ } }
12500
+ ])
12718
12501
  };
12719
12502
  }
12720
- function funcVar1(func) {
12503
+ var triplesSameSubject = triplesSameSubjectImpl("triplesSameSubject", false);
12504
+ var triplesSameSubjectPath = triplesSameSubjectImpl("triplesSameSubjectPath", true);
12505
+ var triplesTemplate = {
12506
+ name: "triplesTemplate",
12507
+ impl: triplesDotSeperated(triplesSameSubject)
12508
+ };
12509
+ function propertyListImpl(name, allowPaths) {
12721
12510
  return {
12722
- name: unCapitalize(func.name),
12723
- impl: ({ ACTION, SUBRULE, CONSUME }) => (C) => {
12724
- const operator = CONSUME(func);
12725
- CONSUME(symbols_exports.LParen);
12726
- const arg = SUBRULE(var_, void 0);
12727
- const close = CONSUME(symbols_exports.RParen);
12728
- return ACTION(() => C.factory.expressionOperation(operator.image, [arg], C.factory.sourceLocation(operator, close)));
12729
- }
12511
+ name,
12512
+ impl: ({ SUBRULE, OPTION }) => (_, subject) => OPTION(() => SUBRULE(allowPaths ? propertyListPathNotEmpty : propertyListNotEmpty, subject)) ?? []
12730
12513
  };
12731
12514
  }
12732
- function funcExprOrNil1(func) {
12515
+ var propertyList = propertyListImpl("propertyList", false);
12516
+ var propertyListPath = propertyListImpl("propertyListPath", true);
12517
+ function propertyListNotEmptyImplementation(name, allowPaths) {
12733
12518
  return {
12734
- name: unCapitalize(func.name),
12735
- impl: ({ ACTION, CONSUME, OR, SUBRULE }) => (C) => {
12736
- const operator = CONSUME(func);
12737
- return OR([
12738
- { ALT: () => {
12739
- CONSUME(symbols_exports.LParen);
12740
- const arg = SUBRULE(expression, void 0);
12741
- const close = CONSUME(symbols_exports.RParen);
12742
- return ACTION(() => C.factory.expressionOperation(operator.image, [arg], C.factory.sourceLocation(operator, close)));
12743
- } },
12744
- { ALT: () => {
12745
- const nil2 = CONSUME(terminals_exports.nil);
12746
- return ACTION(() => C.factory.expressionOperation(operator.image, [], C.factory.sourceLocation(operator, nil2)));
12747
- } }
12748
- ]);
12519
+ name,
12520
+ impl: ({ ACTION, CONSUME, AT_LEAST_ONE, SUBRULE1, MANY2, OR1 }) => (_, subject) => {
12521
+ const result = [];
12522
+ let parsedSemi = true;
12523
+ AT_LEAST_ONE({
12524
+ GATE: () => parsedSemi,
12525
+ DEF: () => {
12526
+ parsedSemi = false;
12527
+ const predicate = allowPaths ? OR1([
12528
+ { ALT: () => SUBRULE1(verbPath) },
12529
+ { ALT: () => SUBRULE1(verbSimple) }
12530
+ ]) : SUBRULE1(verb);
12531
+ const triples = SUBRULE1(
12532
+ allowPaths ? objectListPath : objectList,
12533
+ subject,
12534
+ predicate
12535
+ );
12536
+ MANY2(() => {
12537
+ CONSUME(symbols_exports.semi);
12538
+ parsedSemi = true;
12539
+ });
12540
+ ACTION(() => {
12541
+ result.push(...triples);
12542
+ });
12543
+ }
12544
+ });
12545
+ return result;
12749
12546
  }
12750
12547
  };
12751
12548
  }
12752
- function funcNil1(func) {
12549
+ var propertyListNotEmpty = propertyListNotEmptyImplementation("propertyListNotEmpty", false);
12550
+ var propertyListPathNotEmpty = propertyListNotEmptyImplementation("propertyListPathNotEmpty", true);
12551
+ var verbPath = {
12552
+ name: "verbPath",
12553
+ impl: ({ SUBRULE }) => () => SUBRULE(path)
12554
+ };
12555
+ var verbSimple = {
12556
+ name: "verbSimple",
12557
+ impl: ({ SUBRULE }) => () => SUBRULE(var_)
12558
+ };
12559
+ function objectListImpl(name, allowPaths) {
12753
12560
  return {
12754
- name: unCapitalize(func.name),
12755
- impl: ({ ACTION, CONSUME }) => (C) => {
12756
- const operator = CONSUME(func);
12757
- const nil2 = CONSUME(terminals_exports.nil);
12758
- return ACTION(() => C.factory.expressionOperation(operator.image, [], C.factory.sourceLocation(operator, nil2)));
12561
+ name,
12562
+ impl: ({ ACTION, SUBRULE, AT_LEAST_ONE_SEP }) => (_, subj, pred) => {
12563
+ const objects = [];
12564
+ AT_LEAST_ONE_SEP({
12565
+ SEP: symbols_exports.comma,
12566
+ DEF: () => {
12567
+ const objectTriple = SUBRULE(allowPaths ? objectPath : object, subj, pred);
12568
+ ACTION(() => {
12569
+ objects.push(objectTriple);
12570
+ });
12571
+ }
12572
+ });
12573
+ return objects;
12759
12574
  }
12760
12575
  };
12761
12576
  }
12762
- function funcExprList1(func) {
12577
+ var objectList = objectListImpl("objectList", false);
12578
+ var objectListPath = objectListImpl("objectListPath", true);
12579
+ function objectImpl(name, allowPaths) {
12763
12580
  return {
12764
- name: unCapitalize(func.name),
12765
- impl: ({ ACTION, CONSUME, SUBRULE }) => (C) => {
12766
- const operator = CONSUME(func);
12767
- const args = SUBRULE(expressionList, void 0);
12768
- return ACTION(() => C.factory.expressionOperation(operator.image, args.val, C.factory.sourceLocation(operator, args)));
12581
+ name,
12582
+ impl: ({ ACTION, SUBRULE }) => (C, subject, predicate) => {
12583
+ const node = SUBRULE(allowPaths ? graphNodePath : graphNode);
12584
+ return ACTION(() => C.factory.triple(subject, predicate, node));
12769
12585
  }
12770
12586
  };
12771
12587
  }
12772
- function funcExpr2or3(func) {
12588
+ var object = objectImpl("object", false);
12589
+ var objectPath = objectImpl("objectPath", true);
12590
+ function collectionImpl(name, allowPaths) {
12773
12591
  return {
12774
- name: unCapitalize(func.name),
12775
- impl: ({ ACTION, CONSUME, SUBRULE1, SUBRULE2, SUBRULE3, CONSUME1, OPTION, CONSUME2 }) => (C) => {
12776
- const operator = CONSUME(func);
12777
- CONSUME(symbols_exports.LParen);
12778
- const arg1 = SUBRULE1(expression, void 0);
12779
- CONSUME1(symbols_exports.comma);
12780
- const arg2 = SUBRULE2(expression, void 0);
12781
- const arg3 = OPTION(() => {
12782
- CONSUME2(symbols_exports.comma);
12783
- return SUBRULE3(expression, void 0);
12592
+ name,
12593
+ impl: ({ ACTION, AT_LEAST_ONE, SUBRULE, CONSUME }) => (C) => {
12594
+ const terms = [];
12595
+ const startToken = CONSUME(symbols_exports.LParen);
12596
+ AT_LEAST_ONE(() => {
12597
+ terms.push(SUBRULE(allowPaths ? graphNodePath : graphNode));
12784
12598
  });
12785
- const close = CONSUME(symbols_exports.RParen);
12786
- return ACTION(() => C.factory.expressionOperation(
12787
- operator.image,
12788
- arg3 ? [arg1, arg2, arg3] : [arg1, arg2],
12789
- C.factory.sourceLocation(operator, close)
12790
- ));
12599
+ const endToken = CONSUME(symbols_exports.RParen);
12600
+ return ACTION(() => {
12601
+ const F3 = C.factory;
12602
+ const triples = [];
12603
+ const predFirst = F3.namedNode(F3.sourceLocationNoMaterialize(), "http://www.w3.org/1999/02/22-rdf-syntax-ns#first" /* FIRST */, void 0);
12604
+ const predRest = F3.namedNode(F3.sourceLocationNoMaterialize(), "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest" /* REST */, void 0);
12605
+ const predNil = F3.namedNode(F3.sourceLocationNoMaterialize(), "http://www.w3.org/1999/02/22-rdf-syntax-ns#nil" /* NIL */, void 0);
12606
+ const listHead = F3.blankNode(void 0, F3.sourceLocationNoMaterialize());
12607
+ let iterHead = listHead;
12608
+ for (const [index, term] of terms.entries()) {
12609
+ const lastInList = index === terms.length - 1;
12610
+ const headTriple = F3.triple(
12611
+ iterHead,
12612
+ predFirst,
12613
+ term
12614
+ );
12615
+ triples.push(headTriple);
12616
+ if (lastInList) {
12617
+ const nilTriple = F3.triple(iterHead, predRest, predNil);
12618
+ triples.push(nilTriple);
12619
+ } else {
12620
+ const tail = F3.blankNode(void 0, F3.sourceLocationNoMaterialize());
12621
+ const linkTriple = F3.triple(iterHead, predRest, tail);
12622
+ triples.push(linkTriple);
12623
+ iterHead = tail;
12624
+ }
12625
+ }
12626
+ return F3.tripleCollectionList(listHead, triples, F3.sourceLocation(startToken, endToken));
12627
+ });
12628
+ },
12629
+ gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F3 }) => {
12630
+ F3.printFilter(ast, () => PRINT_WORD("("));
12631
+ for (const [idx, triple] of ast.triples.entries()) {
12632
+ if (idx % 2 === 0) {
12633
+ SUBRULE(allowPaths ? graphNodePath : graphNode, triple.object);
12634
+ }
12635
+ }
12636
+ F3.printFilter(ast, () => PRINT_WORD(")"));
12791
12637
  }
12792
12638
  };
12793
12639
  }
12794
- function funcExpr3or4(func) {
12640
+ var collection = collectionImpl("collection", false);
12641
+ var collectionPath = collectionImpl("collectionPath", true);
12642
+ function triplesNodeImpl(name, allowPaths) {
12795
12643
  return {
12796
- name: unCapitalize(func.name),
12797
- impl: ({
12798
- ACTION,
12799
- CONSUME,
12800
- SUBRULE1,
12801
- SUBRULE2,
12802
- SUBRULE3,
12803
- SUBRULE4,
12804
- CONSUME1,
12805
- OPTION,
12806
- CONSUME2,
12807
- CONSUME3
12808
- }) => (C) => {
12809
- const operator = CONSUME(func);
12810
- CONSUME(symbols_exports.LParen);
12811
- const arg1 = SUBRULE1(expression, void 0);
12812
- CONSUME1(symbols_exports.comma);
12813
- const arg2 = SUBRULE2(expression, void 0);
12814
- CONSUME2(symbols_exports.comma);
12815
- const arg3 = SUBRULE3(expression, void 0);
12816
- const arg4 = OPTION(() => {
12817
- CONSUME3(symbols_exports.comma);
12818
- return SUBRULE4(expression, void 0);
12819
- });
12820
- const close = CONSUME(symbols_exports.RParen);
12821
- return ACTION(() => C.factory.expressionOperation(
12822
- operator.image,
12823
- arg4 ? [arg1, arg2, arg3, arg4] : [arg1, arg2, arg3],
12824
- C.factory.sourceLocation(operator, close)
12825
- ));
12826
- }
12644
+ name,
12645
+ impl: ({ SUBRULE, OR }) => () => OR([
12646
+ { ALT: () => SUBRULE(allowPaths ? collectionPath : collection) },
12647
+ { ALT: () => SUBRULE(allowPaths ? blankNodePropertyListPath : blankNodePropertyList) }
12648
+ ]),
12649
+ gImpl: ({ SUBRULE }) => (ast) => ast.subType === "list" ? SUBRULE(allowPaths ? collectionPath : collection, ast) : SUBRULE(allowPaths ? blankNodePropertyListPath : blankNodePropertyList, ast)
12827
12650
  };
12828
12651
  }
12829
- function funcGroupGraphPattern(func) {
12652
+ var triplesNode = triplesNodeImpl("triplesNode", false);
12653
+ var triplesNodePath = triplesNodeImpl("triplesNodePath", true);
12654
+ function blankNodePropertyListImpl(name, allowPaths) {
12655
+ const propertyPathNotEmptyImpl = allowPaths ? propertyListPathNotEmpty : propertyListNotEmpty;
12830
12656
  return {
12831
- name: unCapitalize(func.name),
12657
+ name,
12832
12658
  impl: ({ ACTION, SUBRULE, CONSUME }) => (C) => {
12833
- const operator = CONSUME(func);
12834
- const group = SUBRULE(groupGraphPattern, void 0);
12835
- return ACTION(() => C.factory.expressionPatternOperation(
12836
- operator.image,
12837
- group,
12838
- C.factory.sourceLocation(operator, group)
12659
+ const startToken = CONSUME(symbols_exports.LSquare);
12660
+ const blankNode2 = ACTION(() => C.factory.blankNode(void 0, C.factory.sourceLocationNoMaterialize()));
12661
+ const propList = SUBRULE(propertyPathNotEmptyImpl, blankNode2);
12662
+ const endToken = CONSUME(symbols_exports.RSquare);
12663
+ return ACTION(() => C.factory.tripleCollectionBlankNodeProperties(
12664
+ blankNode2,
12665
+ propList,
12666
+ C.factory.sourceLocation(startToken, endToken)
12839
12667
  ));
12668
+ },
12669
+ gImpl: ({ SUBRULE, PRINT, PRINT_WORD, HANDLE_LOC }) => (ast, { factory: F3 }) => {
12670
+ F3.printFilter(ast, () => PRINT("["));
12671
+ for (const triple of ast.triples) {
12672
+ HANDLE_LOC(triple, () => {
12673
+ if (F3.isTerm(triple.predicate) && F3.isTermVariable(triple.predicate)) {
12674
+ SUBRULE(varOrTerm, triple.predicate);
12675
+ } else {
12676
+ SUBRULE(pathGenerator, triple.predicate, void 0);
12677
+ }
12678
+ SUBRULE(graphNodePath, triple.object);
12679
+ F3.printFilter(ast, () => PRINT_WORD(";"));
12680
+ });
12681
+ }
12682
+ F3.printFilter(ast, () => PRINT("]"));
12840
12683
  }
12841
12684
  };
12842
12685
  }
12843
- function baseAggregateFunc(func) {
12686
+ var blankNodePropertyList = blankNodePropertyListImpl("blankNodePropertyList", false);
12687
+ var blankNodePropertyListPath = blankNodePropertyListImpl("blankNodePropertyListPath", true);
12688
+ function graphNodeImpl(name, allowPaths) {
12689
+ const triplesNodeRule = allowPaths ? triplesNodePath : triplesNode;
12844
12690
  return {
12845
- name: unCapitalize(func.name),
12846
- impl: ({ ACTION, CONSUME, SUBRULE, OPTION }) => (C) => {
12847
- const operator = CONSUME(func);
12848
- CONSUME(symbols_exports.LParen);
12849
- const distinct2 = OPTION(() => CONSUME(distinct));
12850
- const expr1 = SUBRULE(expression, void 0);
12851
- const close = CONSUME(symbols_exports.RParen);
12852
- return ACTION(() => C.factory.aggregate(
12853
- operator.image,
12854
- distinct2 !== void 0,
12855
- expr1,
12856
- void 0,
12857
- C.factory.sourceLocation(operator, close)
12858
- ));
12691
+ name,
12692
+ impl: ({ SUBRULE, OR }) => (C) => OR([
12693
+ { ALT: () => SUBRULE(varOrTerm) },
12694
+ {
12695
+ GATE: () => C.parseMode.has("canCreateBlankNodes"),
12696
+ ALT: () => SUBRULE(triplesNodeRule)
12697
+ }
12698
+ ]),
12699
+ gImpl: ({ SUBRULE }) => (ast, { factory: F3 }) => {
12700
+ if (F3.isTerm(ast)) {
12701
+ SUBRULE(varOrTerm, ast);
12702
+ } else {
12703
+ SUBRULE(triplesNodeRule, ast);
12704
+ }
12859
12705
  }
12860
12706
  };
12861
12707
  }
12708
+ var graphNode = graphNodeImpl("graphNode", false);
12709
+ var graphNodePath = graphNodeImpl("graphNodePath", true);
12862
12710
 
12863
- // ../rules-sparql-1-1/lib/grammar/builtIn.ts
12864
- var builtInStr = funcExpr1(BuildinCalls_exports.str);
12865
- var builtInLang = funcExpr1(BuildinCalls_exports.lang);
12866
- var builtInLangmatches = funcExpr2(BuildinCalls_exports.langmatches);
12867
- var builtInDatatype = funcExpr1(BuildinCalls_exports.datatype);
12868
- var builtInBound = funcVar1(BuildinCalls_exports.bound);
12869
- var builtInIri = funcExpr1(BuildinCalls_exports.iri);
12870
- var builtInUri = funcExpr1(BuildinCalls_exports.uri);
12871
- var builtInBnodeSparqlJs = funcExprOrNil1(BuildinCalls_exports.bnode);
12872
- var builtInRand = funcNil1(BuildinCalls_exports.rand);
12873
- var builtInAbs = funcExpr1(BuildinCalls_exports.abs);
12874
- var builtInCeil = funcExpr1(BuildinCalls_exports.ceil);
12875
- var builtInFloor = funcExpr1(BuildinCalls_exports.floor);
12876
- var builtInRound = funcExpr1(BuildinCalls_exports.round);
12877
- var builtInConcat = funcExprList1(BuildinCalls_exports.concat);
12878
- var builtInStrlen = funcExpr1(BuildinCalls_exports.strlen);
12879
- var builtInUcase = funcExpr1(BuildinCalls_exports.ucase);
12880
- var builtInLcase = funcExpr1(BuildinCalls_exports.lcase);
12881
- var builtInEncode_for_uri = funcExpr1(BuildinCalls_exports.encode_for_uri);
12882
- var builtInContains = funcExpr2(BuildinCalls_exports.contains);
12883
- var builtInStrstarts = funcExpr2(BuildinCalls_exports.strstarts);
12884
- var builtInStrends = funcExpr2(BuildinCalls_exports.strends);
12885
- var builtInStrbefore = funcExpr2(BuildinCalls_exports.strbefore);
12886
- var builtInStrafter = funcExpr2(BuildinCalls_exports.strafter);
12887
- var builtInYear = funcExpr1(BuildinCalls_exports.year);
12888
- var builtInMonth = funcExpr1(BuildinCalls_exports.month);
12889
- var builtInDay = funcExpr1(BuildinCalls_exports.day);
12890
- var builtInHours = funcExpr1(BuildinCalls_exports.hours);
12891
- var builtInMinutes = funcExpr1(BuildinCalls_exports.minutes);
12892
- var builtInSeconds = funcExpr1(BuildinCalls_exports.seconds);
12893
- var builtInTimezone = funcExpr1(BuildinCalls_exports.timezone);
12894
- var builtInTz = funcExpr1(BuildinCalls_exports.tz);
12895
- var builtInNow = funcNil1(BuildinCalls_exports.now);
12896
- var builtInUuid = funcNil1(BuildinCalls_exports.uuid);
12897
- var builtInStruuid = funcNil1(BuildinCalls_exports.struuid);
12898
- var builtInMd5 = funcExpr1(BuildinCalls_exports.md5);
12899
- var builtInSha1 = funcExpr1(BuildinCalls_exports.sha1);
12900
- var builtInSha256 = funcExpr1(BuildinCalls_exports.sha256);
12901
- var builtInSha384 = funcExpr1(BuildinCalls_exports.sha384);
12902
- var builtInSha512 = funcExpr1(BuildinCalls_exports.sha512);
12903
- var builtInCoalesce = funcExprList1(BuildinCalls_exports.coalesce);
12904
- var builtInIf = funcExpr3(BuildinCalls_exports.if_);
12905
- var builtInStrlang = funcExpr2(BuildinCalls_exports.strlang);
12906
- var builtInStrdt = funcExpr2(BuildinCalls_exports.strdt);
12907
- var builtInSameterm = funcExpr2(BuildinCalls_exports.sameterm);
12908
- var builtInIsiri = funcExpr1(BuildinCalls_exports.isiri);
12909
- var builtInIsuri = funcExpr1(BuildinCalls_exports.isuri);
12910
- var builtInIsblank = funcExpr1(BuildinCalls_exports.isblank);
12911
- var builtInIsliteral = funcExpr1(BuildinCalls_exports.isliteral);
12912
- var builtInIsnumeric = funcExpr1(BuildinCalls_exports.isnumeric);
12913
- function builtInCallList(SUBRULE) {
12914
- return [
12915
- { ALT: () => SUBRULE(aggregate, void 0) },
12916
- { ALT: () => SUBRULE(builtInStr, void 0) },
12917
- { ALT: () => SUBRULE(builtInLang, void 0) },
12918
- { ALT: () => SUBRULE(builtInLangmatches, void 0) },
12919
- { ALT: () => SUBRULE(builtInDatatype, void 0) },
12920
- { ALT: () => SUBRULE(builtInBound, void 0) },
12921
- { ALT: () => SUBRULE(builtInIri, void 0) },
12922
- { ALT: () => SUBRULE(builtInUri, void 0) },
12923
- { ALT: () => SUBRULE(builtInBnodeSparqlJs, void 0) },
12924
- { ALT: () => SUBRULE(builtInRand, void 0) },
12925
- { ALT: () => SUBRULE(builtInAbs, void 0) },
12926
- { ALT: () => SUBRULE(builtInCeil, void 0) },
12927
- { ALT: () => SUBRULE(builtInFloor, void 0) },
12928
- { ALT: () => SUBRULE(builtInRound, void 0) },
12929
- { ALT: () => SUBRULE(builtInConcat, void 0) },
12930
- { ALT: () => SUBRULE(substringExpression, void 0) },
12931
- { ALT: () => SUBRULE(builtInStrlen, void 0) },
12932
- { ALT: () => SUBRULE(strReplaceExpression, void 0) },
12933
- { ALT: () => SUBRULE(builtInUcase, void 0) },
12934
- { ALT: () => SUBRULE(builtInLcase, void 0) },
12935
- { ALT: () => SUBRULE(builtInEncode_for_uri, void 0) },
12936
- { ALT: () => SUBRULE(builtInContains, void 0) },
12937
- { ALT: () => SUBRULE(builtInStrstarts, void 0) },
12938
- { ALT: () => SUBRULE(builtInStrends, void 0) },
12939
- { ALT: () => SUBRULE(builtInStrbefore, void 0) },
12940
- { ALT: () => SUBRULE(builtInStrafter, void 0) },
12941
- { ALT: () => SUBRULE(builtInYear, void 0) },
12942
- { ALT: () => SUBRULE(builtInMonth, void 0) },
12943
- { ALT: () => SUBRULE(builtInDay, void 0) },
12944
- { ALT: () => SUBRULE(builtInHours, void 0) },
12945
- { ALT: () => SUBRULE(builtInMinutes, void 0) },
12946
- { ALT: () => SUBRULE(builtInSeconds, void 0) },
12947
- { ALT: () => SUBRULE(builtInTimezone, void 0) },
12948
- { ALT: () => SUBRULE(builtInTz, void 0) },
12949
- { ALT: () => SUBRULE(builtInNow, void 0) },
12950
- { ALT: () => SUBRULE(builtInUuid, void 0) },
12951
- { ALT: () => SUBRULE(builtInStruuid, void 0) },
12952
- { ALT: () => SUBRULE(builtInMd5, void 0) },
12953
- { ALT: () => SUBRULE(builtInSha1, void 0) },
12954
- { ALT: () => SUBRULE(builtInSha256, void 0) },
12955
- { ALT: () => SUBRULE(builtInSha384, void 0) },
12956
- { ALT: () => SUBRULE(builtInSha512, void 0) },
12957
- { ALT: () => SUBRULE(builtInCoalesce, void 0) },
12958
- { ALT: () => SUBRULE(builtInIf, void 0) },
12959
- { ALT: () => SUBRULE(builtInStrlang, void 0) },
12960
- { ALT: () => SUBRULE(builtInStrdt, void 0) },
12961
- { ALT: () => SUBRULE(builtInSameterm, void 0) },
12962
- { ALT: () => SUBRULE(builtInIsiri, void 0) },
12963
- { ALT: () => SUBRULE(builtInIsuri, void 0) },
12964
- { ALT: () => SUBRULE(builtInIsblank, void 0) },
12965
- { ALT: () => SUBRULE(builtInIsliteral, void 0) },
12966
- { ALT: () => SUBRULE(builtInIsnumeric, void 0) },
12967
- { ALT: () => SUBRULE(regexExpression, void 0) },
12968
- { ALT: () => SUBRULE(existsFunc, void 0) },
12969
- { ALT: () => SUBRULE(notExistsFunc, void 0) }
12970
- ];
12971
- }
12972
- var builtInCall = {
12973
- name: "builtInCall",
12974
- impl: ({ OR, SUBRULE, cache }) => () => {
12975
- const cached = cache.get(builtInCall);
12976
- if (cached) {
12977
- return OR(cached);
12711
+ // ../rules-sparql-1-1/lib/grammar/whereClause.ts
12712
+ var whereClause = {
12713
+ name: "whereClause",
12714
+ impl: ({ ACTION, SUBRULE, CONSUME, OPTION }) => (C) => {
12715
+ const where2 = OPTION(() => CONSUME(where));
12716
+ const group = SUBRULE(groupGraphPattern);
12717
+ return ACTION(() => C.factory.wrap(group, C.factory.sourceLocation(where2, group)));
12718
+ },
12719
+ gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F3 }) => {
12720
+ F3.printFilter(ast, () => PRINT_WORD("WHERE"));
12721
+ SUBRULE(groupGraphPattern, ast.val);
12722
+ }
12723
+ };
12724
+ var groupGraphPattern = {
12725
+ name: "groupGraphPattern",
12726
+ impl: ({ ACTION, SUBRULE, CONSUME, OR }) => (C) => {
12727
+ const open = CONSUME(symbols_exports.LCurly);
12728
+ const patterns = OR([
12729
+ { ALT: () => [SUBRULE(subSelect)] },
12730
+ { ALT: () => SUBRULE(groupGraphPatternSub) }
12731
+ ]);
12732
+ const close = CONSUME(symbols_exports.RCurly);
12733
+ return ACTION(() => C.factory.patternGroup(patterns, C.factory.sourceLocation(open, close)));
12734
+ },
12735
+ gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F3 }) => {
12736
+ F3.printFilter(ast, () => PRINT_WORD("{"));
12737
+ for (const pattern of ast.patterns) {
12738
+ SUBRULE(generatePattern, pattern);
12739
+ }
12740
+ F3.printFilter(ast, () => PRINT_WORD("}"));
12741
+ }
12742
+ };
12743
+ var generatePattern = {
12744
+ name: "generatePattern",
12745
+ gImpl: ({ SUBRULE }) => (ast, { factory: F3 }) => {
12746
+ if (ast.type === "query") {
12747
+ SUBRULE(query, F3.querySelect({
12748
+ context: [],
12749
+ datasets: F3.datasetClauses([], F3.sourceLocation()),
12750
+ where: ast.where,
12751
+ variables: ast.variables,
12752
+ solutionModifiers: ast.solutionModifiers,
12753
+ values: ast.values,
12754
+ distinct: ast.distinct,
12755
+ reduced: ast.reduced
12756
+ }, ast.loc));
12757
+ } else if (ast.subType === "group") {
12758
+ SUBRULE(groupGraphPattern, ast);
12759
+ } else if (ast.subType === "bgp") {
12760
+ SUBRULE(triplesBlock, ast);
12761
+ } else {
12762
+ SUBRULE(graphPatternNotTriples, ast);
12763
+ }
12764
+ }
12765
+ };
12766
+ var groupGraphPatternSub = {
12767
+ name: "groupGraphPatternSub",
12768
+ impl: ({ ACTION, SUBRULE, CONSUME, MANY, SUBRULE1, SUBRULE2, OPTION1, OPTION2, OPTION3 }) => () => {
12769
+ const patterns = [];
12770
+ const bgpPattern = OPTION1(() => SUBRULE1(triplesBlock));
12771
+ if (bgpPattern) {
12772
+ patterns.push(bgpPattern);
12773
+ }
12774
+ MANY(() => {
12775
+ const notTriples = SUBRULE(graphPatternNotTriples);
12776
+ patterns.push(notTriples);
12777
+ OPTION2(() => CONSUME(symbols_exports.dot));
12778
+ const moreTriples = OPTION3(() => SUBRULE2(triplesBlock));
12779
+ if (moreTriples) {
12780
+ patterns.push(moreTriples);
12781
+ }
12782
+ });
12783
+ ACTION(() => checkNote13(patterns));
12784
+ return patterns;
12785
+ }
12786
+ };
12787
+ var graphPatternNotTriples = {
12788
+ name: "graphPatternNotTriples",
12789
+ impl: ({ SUBRULE, OR }) => () => OR([
12790
+ { ALT: () => SUBRULE(groupOrUnionGraphPattern) },
12791
+ { ALT: () => SUBRULE(optionalGraphPattern) },
12792
+ { ALT: () => SUBRULE(minusGraphPattern) },
12793
+ { ALT: () => SUBRULE(graphGraphPattern) },
12794
+ { ALT: () => SUBRULE(serviceGraphPattern) },
12795
+ { ALT: () => SUBRULE(filter3) },
12796
+ { ALT: () => SUBRULE(bind2) },
12797
+ { ALT: () => SUBRULE(inlineData) }
12798
+ ]),
12799
+ gImpl: ({ SUBRULE }) => (ast) => {
12800
+ switch (ast.subType) {
12801
+ case "group":
12802
+ case "union":
12803
+ SUBRULE(groupOrUnionGraphPattern, ast);
12804
+ break;
12805
+ case "optional":
12806
+ SUBRULE(optionalGraphPattern, ast);
12807
+ break;
12808
+ case "minus":
12809
+ SUBRULE(minusGraphPattern, ast);
12810
+ break;
12811
+ case "graph":
12812
+ SUBRULE(graphGraphPattern, ast);
12813
+ break;
12814
+ case "service":
12815
+ SUBRULE(serviceGraphPattern, ast);
12816
+ break;
12817
+ case "filter":
12818
+ SUBRULE(filter3, ast);
12819
+ break;
12820
+ case "bind":
12821
+ SUBRULE(bind2, ast);
12822
+ break;
12823
+ case "values":
12824
+ SUBRULE(inlineData, ast);
12825
+ break;
12826
+ }
12827
+ }
12828
+ };
12829
+ var optionalGraphPattern = {
12830
+ name: "optionalGraphPattern",
12831
+ impl: ({ ACTION, SUBRULE, CONSUME }) => (C) => {
12832
+ const optional2 = CONSUME(optional);
12833
+ const group = SUBRULE(groupGraphPattern);
12834
+ return ACTION(() => C.factory.patternOptional(group.patterns, C.factory.sourceLocation(optional2, group)));
12835
+ },
12836
+ gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F3 }) => {
12837
+ F3.printFilter(ast, () => PRINT_WORD("OPTIONAL"));
12838
+ SUBRULE(groupGraphPattern, F3.patternGroup(ast.patterns, ast.loc));
12839
+ }
12840
+ };
12841
+ var graphGraphPattern = {
12842
+ name: "graphGraphPattern",
12843
+ impl: ({ ACTION, SUBRULE, CONSUME }) => (C) => {
12844
+ const graph2 = CONSUME(graph_exports.graph);
12845
+ const name = SUBRULE(varOrIri);
12846
+ const group = SUBRULE(groupGraphPattern);
12847
+ return ACTION(() => C.factory.patternGraph(name, group.patterns, C.factory.sourceLocation(graph2, group)));
12848
+ },
12849
+ gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F3 }) => {
12850
+ F3.printFilter(ast, () => PRINT_WORD("GRAPH"));
12851
+ SUBRULE(varOrTerm, ast.name);
12852
+ SUBRULE(groupGraphPattern, F3.patternGroup(ast.patterns, ast.loc));
12853
+ }
12854
+ };
12855
+ var serviceGraphPattern = {
12856
+ name: "serviceGraphPattern",
12857
+ impl: ({ ACTION, SUBRULE1, CONSUME, OPTION }) => (C) => {
12858
+ const service2 = CONSUME(service);
12859
+ const silent2 = OPTION(() => {
12860
+ CONSUME(silent);
12861
+ return true;
12862
+ }) ?? false;
12863
+ const name = SUBRULE1(varOrIri);
12864
+ const group = SUBRULE1(groupGraphPattern);
12865
+ return ACTION(() => C.factory.patternService(name, group.patterns, silent2, C.factory.sourceLocation(service2, group)));
12866
+ },
12867
+ gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F3 }) => {
12868
+ F3.printFilter(ast, () => {
12869
+ PRINT_WORD("SERVICE");
12870
+ if (ast.silent) {
12871
+ PRINT_WORD("SILENT");
12872
+ }
12873
+ });
12874
+ SUBRULE(varOrTerm, ast.name);
12875
+ SUBRULE(groupGraphPattern, F3.patternGroup(ast.patterns, ast.loc));
12876
+ }
12877
+ };
12878
+ var bind2 = {
12879
+ name: "bind",
12880
+ impl: ({ ACTION, SUBRULE, CONSUME }) => (C) => {
12881
+ const bind3 = CONSUME(bind);
12882
+ CONSUME(symbols_exports.LParen);
12883
+ const expressionVal = SUBRULE(expression);
12884
+ CONSUME(as);
12885
+ const variable = SUBRULE(var_);
12886
+ const close = CONSUME(symbols_exports.RParen);
12887
+ return ACTION(() => C.factory.patternBind(expressionVal, variable, C.factory.sourceLocation(bind3, close)));
12888
+ },
12889
+ gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F3 }) => {
12890
+ F3.printFilter(ast, () => PRINT_WORD("BIND", "("));
12891
+ SUBRULE(expression, ast.expression);
12892
+ F3.printFilter(ast, () => PRINT_WORD("AS"));
12893
+ SUBRULE(var_, ast.variable);
12894
+ F3.printFilter(ast, () => PRINT_WORD(")"));
12895
+ }
12896
+ };
12897
+ var inlineData = {
12898
+ name: "inlineData",
12899
+ impl: ({ ACTION, SUBRULE, CONSUME }) => (C) => {
12900
+ const values3 = CONSUME(values2);
12901
+ const datablock = SUBRULE(dataBlock);
12902
+ return ACTION(() => C.factory.patternValues(datablock.val, C.factory.sourceLocation(values3, datablock)));
12903
+ },
12904
+ gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F3 }) => {
12905
+ const variables = Object.keys(ast.values[0]);
12906
+ F3.printFilter(ast, () => {
12907
+ PRINT_WORD("VALUES", "(");
12908
+ for (const variable of variables) {
12909
+ PRINT_WORD(`?${variable}`);
12910
+ }
12911
+ PRINT_WORD(")", "{");
12912
+ });
12913
+ for (const mapping of ast.values) {
12914
+ F3.printFilter(ast, () => PRINT_WORD("("));
12915
+ for (const variable of variables) {
12916
+ if (mapping[variable] === void 0) {
12917
+ F3.printFilter(ast, () => PRINT_WORD("UNDEF"));
12918
+ } else {
12919
+ SUBRULE(graphNodePath, mapping[variable]);
12920
+ }
12921
+ }
12922
+ F3.printFilter(ast, () => PRINT_WORD(")"));
12978
12923
  }
12979
- const builtIns = builtInCallList(SUBRULE);
12980
- cache.set(builtInCall, builtIns);
12981
- return OR(builtIns);
12924
+ F3.printFilter(ast, () => PRINT_WORD("}"));
12982
12925
  }
12983
12926
  };
12984
- var regexExpression = funcExpr2or3(BuildinCalls_exports.regex);
12985
- var substringExpression = funcExpr2or3(BuildinCalls_exports.substr);
12986
- var strReplaceExpression = funcExpr3or4(BuildinCalls_exports.replace);
12987
- var existsFunc = funcGroupGraphPattern(BuildinCalls_exports.exists);
12988
- var notExistsFunc = funcGroupGraphPattern(BuildinCalls_exports.notexists);
12989
- var aggregateCount = {
12990
- name: unCapitalize(BuildinCalls_exports.count.name),
12991
- impl: ({ ACTION, CONSUME, SUBRULE, OR, OPTION }) => (C) => {
12992
- const operatorToken = CONSUME(BuildinCalls_exports.count);
12993
- CONSUME(symbols_exports.LParen);
12994
- const distinctToken = OPTION(() => CONSUME(distinct));
12995
- const expressionVal = OR([
12927
+ var dataBlock = {
12928
+ name: "dataBlock",
12929
+ impl: ({ SUBRULE, OR }) => () => OR([
12930
+ { ALT: () => SUBRULE(inlineDataOneVar) },
12931
+ { ALT: () => SUBRULE(inlineDataFull) }
12932
+ ])
12933
+ };
12934
+ var inlineDataOneVar = {
12935
+ name: "inlineDataOneVar",
12936
+ impl: ({ ACTION, SUBRULE, CONSUME, MANY }) => (C) => {
12937
+ const res = [];
12938
+ const varVal = SUBRULE(var_);
12939
+ CONSUME(symbols_exports.LCurly);
12940
+ MANY(() => {
12941
+ const value = SUBRULE(dataBlockValue);
12942
+ ACTION(() => {
12943
+ res.push({ [varVal.value]: value });
12944
+ });
12945
+ });
12946
+ const close = CONSUME(symbols_exports.RCurly);
12947
+ return ACTION(() => C.factory.wrap(res, C.factory.sourceLocation(varVal, close)));
12948
+ }
12949
+ };
12950
+ var inlineDataFull = {
12951
+ name: "inlineDataFull",
12952
+ impl: ({
12953
+ ACTION,
12954
+ OR,
12955
+ MANY1,
12956
+ MANY2,
12957
+ MANY3,
12958
+ MANY4,
12959
+ SUBRULE,
12960
+ CONSUME1,
12961
+ CONSUME2
12962
+ }) => (C) => {
12963
+ const res = [];
12964
+ const vars = [];
12965
+ return OR([
12996
12966
  { ALT: () => {
12997
- const starToken = CONSUME(symbols_exports.star);
12998
- return ACTION(() => C.factory.wildcard(C.factory.sourceLocation(starToken)));
12967
+ const nil2 = CONSUME1(terminals_exports.nil);
12968
+ CONSUME1(symbols_exports.LCurly);
12969
+ MANY1(() => {
12970
+ CONSUME2(terminals_exports.nil);
12971
+ res.push({});
12972
+ });
12973
+ const close = CONSUME1(symbols_exports.RCurly);
12974
+ return ACTION(() => C.factory.wrap(res, C.factory.sourceLocation(nil2, close)));
12999
12975
  } },
13000
- { ALT: () => SUBRULE(expression, void 0) }
12976
+ { ALT: () => {
12977
+ const open = CONSUME1(symbols_exports.LParen);
12978
+ MANY2(() => {
12979
+ vars.push(SUBRULE(var_));
12980
+ });
12981
+ CONSUME1(symbols_exports.RParen);
12982
+ CONSUME2(symbols_exports.LCurly);
12983
+ MANY3(() => {
12984
+ let parsedValues = 0;
12985
+ const currentRow = {};
12986
+ CONSUME2(symbols_exports.LParen);
12987
+ MANY4(() => {
12988
+ if (parsedValues >= vars.length) {
12989
+ throw new Error("Number of dataBlockValues does not match number of variables. Too much values.");
12990
+ }
12991
+ const value = SUBRULE(dataBlockValue);
12992
+ ACTION(() => {
12993
+ currentRow[vars[parsedValues].value] = value;
12994
+ parsedValues++;
12995
+ });
12996
+ });
12997
+ CONSUME2(symbols_exports.RParen);
12998
+ ACTION(() => {
12999
+ res.push(currentRow);
13000
+ if (vars.length !== parsedValues) {
13001
+ throw new Error("Number of dataBlockValues does not match number of variables. Too few values.");
13002
+ }
13003
+ });
13004
+ });
13005
+ const close = CONSUME2(symbols_exports.RCurly);
13006
+ return ACTION(() => C.factory.wrap(res, C.factory.sourceLocation(open, close)));
13007
+ } }
13001
13008
  ]);
13002
- const closeToken = CONSUME(symbols_exports.RParen);
13003
- return ACTION(() => {
13004
- const F3 = C.factory;
13005
- if (C.factory.isWildcard(expressionVal)) {
13006
- return F3.aggregate(
13007
- operatorToken.image,
13008
- Boolean(distinctToken),
13009
- expressionVal,
13010
- void 0,
13011
- C.factory.sourceLocation(operatorToken, closeToken)
13012
- );
13013
- }
13014
- return F3.aggregate(
13015
- operatorToken.image,
13016
- Boolean(distinctToken),
13017
- expressionVal,
13018
- void 0,
13019
- C.factory.sourceLocation(operatorToken, closeToken)
13020
- );
13021
- });
13022
13009
  }
13023
13010
  };
13024
- var aggregateSum = baseAggregateFunc(BuildinCalls_exports.sum);
13025
- var aggregateMin = baseAggregateFunc(BuildinCalls_exports.min);
13026
- var aggregateMax = baseAggregateFunc(BuildinCalls_exports.max);
13027
- var aggregateAvg = baseAggregateFunc(BuildinCalls_exports.avg);
13028
- var aggregateSample = baseAggregateFunc(BuildinCalls_exports.sample);
13029
- var aggregateGroup_concat = {
13030
- name: unCapitalize(BuildinCalls_exports.groupConcat.name),
13031
- impl: ({ ACTION, CONSUME, OPTION1, SUBRULE, OPTION2 }) => (C) => {
13032
- const operatorToken = CONSUME(BuildinCalls_exports.groupConcat);
13033
- CONSUME(symbols_exports.LParen);
13034
- const distinctToken = OPTION1(() => CONSUME(distinct));
13035
- const expr = SUBRULE(expression, void 0);
13036
- const sep = OPTION2(() => {
13037
- CONSUME(symbols_exports.semi);
13038
- CONSUME(separator);
13039
- CONSUME(symbols_exports.equal);
13040
- return SUBRULE(string, void 0);
13041
- });
13042
- const closeToken = CONSUME(symbols_exports.RParen);
13043
- return ACTION(() => {
13044
- const F3 = C.factory;
13045
- return F3.aggregate(
13046
- operatorToken.image,
13047
- Boolean(distinctToken),
13048
- expr,
13049
- sep?.value ?? " ",
13050
- F3.sourceLocation(operatorToken, closeToken)
13051
- );
13052
- });
13011
+ var dataBlockValue = {
13012
+ name: "dataBlockValue",
13013
+ impl: ({ SUBRULE, CONSUME, OR }) => () => OR([
13014
+ { ALT: () => SUBRULE(iri2) },
13015
+ { ALT: () => SUBRULE(rdfLiteral) },
13016
+ { ALT: () => SUBRULE(numericLiteral) },
13017
+ { ALT: () => SUBRULE(booleanLiteral) },
13018
+ { ALT: () => {
13019
+ CONSUME(undef);
13020
+ return void 0;
13021
+ } }
13022
+ ])
13023
+ };
13024
+ var minusGraphPattern = {
13025
+ name: "minusGraphPattern",
13026
+ impl: ({ ACTION, SUBRULE, CONSUME }) => (C) => {
13027
+ const minus2 = CONSUME(minus);
13028
+ const group = SUBRULE(groupGraphPattern);
13029
+ return ACTION(() => C.factory.patternMinus(group.patterns, C.factory.sourceLocation(minus2, group)));
13030
+ },
13031
+ gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F3 }) => {
13032
+ F3.printFilter(ast, () => PRINT_WORD("MINUS"));
13033
+ SUBRULE(groupGraphPattern, F3.patternGroup(ast.patterns, ast.loc));
13053
13034
  }
13054
13035
  };
13055
- var aggregate = {
13056
- name: "aggregate",
13057
- impl: ({ ACTION, SUBRULE, OR }) => (C) => {
13058
- const wasInAggregate = ACTION(() => C.parseMode.has("inAggregate"));
13059
- ACTION(() => C.parseMode.add("inAggregate"));
13060
- const result = OR([
13061
- { ALT: () => SUBRULE(aggregateCount, void 0) },
13062
- { ALT: () => SUBRULE(aggregateSum, void 0) },
13063
- { ALT: () => SUBRULE(aggregateMin, void 0) },
13064
- { ALT: () => SUBRULE(aggregateMax, void 0) },
13065
- { ALT: () => SUBRULE(aggregateAvg, void 0) },
13066
- { ALT: () => SUBRULE(aggregateSample, void 0) },
13067
- { ALT: () => SUBRULE(aggregateGroup_concat, void 0) }
13068
- ]);
13069
- ACTION(() => !wasInAggregate && C.parseMode.delete("inAggregate"));
13070
- ACTION(() => {
13071
- if (!C.parseMode.has("canParseAggregate")) {
13072
- throw new Error("Aggregates are only allowed in SELECT, HAVING, and ORDER BY clauses.");
13073
- }
13074
- if (C.parseMode.has("inAggregate")) {
13075
- throw new Error("An aggregate function is not allowed within an aggregate function.");
13076
- }
13036
+ var groupOrUnionGraphPattern = {
13037
+ name: "groupOrUnionGraphPattern",
13038
+ impl: ({ ACTION, MANY, SUBRULE1, SUBRULE2, CONSUME }) => (C) => {
13039
+ const groups = [];
13040
+ const group = SUBRULE1(groupGraphPattern);
13041
+ groups.push(group);
13042
+ MANY(() => {
13043
+ CONSUME(union);
13044
+ const group2 = SUBRULE2(groupGraphPattern);
13045
+ groups.push(group2);
13077
13046
  });
13078
- return result;
13047
+ return ACTION(() => groups.length === 1 ? groups[0] : C.factory.patternUnion(
13048
+ groups,
13049
+ C.factory.sourceLocation(group, groups.at(-1))
13050
+ ));
13079
13051
  },
13080
13052
  gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F3 }) => {
13081
- F3.printFilter(ast, () => {
13082
- PRINT_WORD(ast.aggregation, "(");
13083
- if (ast.distinct) {
13084
- PRINT_WORD("DISTINCT");
13053
+ if (F3.isPatternUnion(ast)) {
13054
+ const [head2, ...tail] = ast.patterns;
13055
+ SUBRULE(groupGraphPattern, head2);
13056
+ for (const pattern of tail) {
13057
+ F3.printFilter(ast, () => PRINT_WORD("UNION"));
13058
+ SUBRULE(groupGraphPattern, pattern);
13085
13059
  }
13086
- });
13087
- const arg = ast.expression[0];
13088
- if (F3.isWildcard(arg)) {
13089
- F3.printFilter(ast, () => PRINT_WORD("*"));
13090
13060
  } else {
13091
- SUBRULE(expression, arg, void 0);
13092
- }
13093
- if (F3.isExpressionAggregateSeparator(ast)) {
13094
- F3.printFilter(ast, () => PRINT_WORD(";", "SEPARATOR", "=", stringEscapedLexical(ast.separator)));
13061
+ SUBRULE(groupGraphPattern, ast);
13095
13062
  }
13063
+ }
13064
+ };
13065
+ var filter3 = {
13066
+ name: "filter",
13067
+ impl: ({ ACTION, SUBRULE, CONSUME }) => (C) => {
13068
+ const filterToken = CONSUME(filter2);
13069
+ const expression2 = SUBRULE(constraint);
13070
+ return ACTION(() => C.factory.patternFilter(expression2, C.factory.sourceLocation(filterToken, expression2)));
13071
+ },
13072
+ gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F3 }) => {
13073
+ F3.printFilter(ast, () => PRINT_WORD("FILTER ("));
13074
+ SUBRULE(expression, ast.expression);
13096
13075
  F3.printFilter(ast, () => PRINT_WORD(")"));
13097
13076
  }
13098
13077
  };
13078
+ var constraint = {
13079
+ name: "constraint",
13080
+ impl: ({ SUBRULE, OR }) => () => OR([
13081
+ { ALT: () => SUBRULE(brackettedExpression) },
13082
+ { ALT: () => SUBRULE(builtInCall) },
13083
+ { ALT: () => SUBRULE(functionCall) }
13084
+ ])
13085
+ };
13086
+ var functionCall = {
13087
+ name: "functionCall",
13088
+ impl: ({ ACTION, SUBRULE }) => (C) => {
13089
+ const func = SUBRULE(iri2);
13090
+ const args = SUBRULE(argList);
13091
+ return ACTION(() => C.factory.expressionFunctionCall(
13092
+ func,
13093
+ args.val.args,
13094
+ args.val.distinct,
13095
+ C.factory.sourceLocation(func, args)
13096
+ ));
13097
+ }
13098
+ };
13099
13099
 
13100
13100
  // ../rules-sparql-1-1/lib/grammar/expression.ts
13101
13101
  var argList = {
@@ -13115,7 +13115,7 @@ var argList = {
13115
13115
  AT_LEAST_ONE_SEP({
13116
13116
  SEP: symbols_exports.comma,
13117
13117
  DEF: () => {
13118
- const arg = SUBRULE1(expression, void 0);
13118
+ const arg = SUBRULE1(expression);
13119
13119
  args.push(arg);
13120
13120
  }
13121
13121
  });
@@ -13132,11 +13132,11 @@ var argList = {
13132
13132
  });
13133
13133
  const [head2, ...tail] = ast.val.args;
13134
13134
  if (head2) {
13135
- SUBRULE(expression, head2, void 0);
13135
+ SUBRULE(expression, head2);
13136
13136
  }
13137
13137
  for (const expr of tail) {
13138
13138
  F3.printFilter(ast, () => PRINT_WORD(","));
13139
- SUBRULE(expression, expr, void 0);
13139
+ SUBRULE(expression, expr);
13140
13140
  }
13141
13141
  F3.printFilter(ast, () => PRINT_WORD(")"));
13142
13142
  }
@@ -13150,11 +13150,11 @@ var expressionList = {
13150
13150
  } },
13151
13151
  { ALT: () => {
13152
13152
  const open = CONSUME(symbols_exports.LParen);
13153
- const expr1 = SUBRULE1(expression, void 0);
13153
+ const expr1 = SUBRULE1(expression);
13154
13154
  const args = [expr1];
13155
13155
  MANY(() => {
13156
13156
  CONSUME(symbols_exports.comma);
13157
- const expr = SUBRULE2(expression, void 0);
13157
+ const expr = SUBRULE2(expression);
13158
13158
  args.push(expr);
13159
13159
  });
13160
13160
  const close = CONSUME(symbols_exports.RParen);
@@ -13166,15 +13166,15 @@ var infixOperators = /* @__PURE__ */ new Set(["in", "notin", "||", "&&", "=", "!
13166
13166
  var prefixOperator = /* @__PURE__ */ new Set(["!", "UPLUS", "UMINUS"]);
13167
13167
  var expression = {
13168
13168
  name: "expression",
13169
- impl: ({ SUBRULE }) => () => SUBRULE(conditionalOrExpression, void 0),
13169
+ impl: ({ SUBRULE }) => () => SUBRULE(conditionalOrExpression),
13170
13170
  gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F3 }) => {
13171
13171
  if (F3.isTerm(ast)) {
13172
- SUBRULE(varOrTerm, ast, void 0);
13172
+ SUBRULE(varOrTerm, ast);
13173
13173
  } else if (F3.isExpressionOperator(ast)) {
13174
13174
  if (infixOperators.has(ast.operator)) {
13175
13175
  const [left, ...right] = ast.args;
13176
13176
  F3.printFilter(ast, () => PRINT_WORD("("));
13177
- SUBRULE(expression, left, void 0);
13177
+ SUBRULE(expression, left);
13178
13178
  F3.printFilter(ast, () => {
13179
13179
  if (ast.operator === "notin") {
13180
13180
  PRINT_WORD("NOT IN");
@@ -13185,35 +13185,35 @@ var expression = {
13185
13185
  }
13186
13186
  });
13187
13187
  if (right.length === 1) {
13188
- SUBRULE(expression, right[0], void 0);
13188
+ SUBRULE(expression, right[0]);
13189
13189
  } else {
13190
- SUBRULE(argList, F3.wrap({ args: right, distinct: false }, ast.loc), void 0);
13190
+ SUBRULE(argList, F3.wrap({ args: right, distinct: false }, ast.loc));
13191
13191
  }
13192
13192
  F3.printFilter(ast, () => PRINT_WORD(")"));
13193
13193
  } else if (prefixOperator.has(ast.operator)) {
13194
13194
  const [expr] = ast.args;
13195
13195
  F3.printFilter(ast, () => PRINT_WORD(ast.operator));
13196
- SUBRULE(expression, expr, void 0);
13196
+ SUBRULE(expression, expr);
13197
13197
  } else {
13198
13198
  F3.printFilter(ast, () => PRINT_WORD(ast.operator, "("));
13199
13199
  const [head2, ...tail] = ast.args;
13200
13200
  if (head2) {
13201
- SUBRULE(expression, head2, void 0);
13201
+ SUBRULE(expression, head2);
13202
13202
  }
13203
13203
  for (const arg of tail) {
13204
13204
  F3.printFilter(ast, () => PRINT_WORD(","));
13205
- SUBRULE(expression, arg, void 0);
13205
+ SUBRULE(expression, arg);
13206
13206
  }
13207
13207
  F3.printFilter(ast, () => PRINT_WORD(")"));
13208
13208
  }
13209
13209
  } else if (F3.isExpressionPatternOperation(ast)) {
13210
13210
  const patterns = ast.args;
13211
13211
  F3.printFilter(ast, () => PRINT_WORD(ast.operator === "exists" ? "EXISTS" : "NOT EXISTS"));
13212
- SUBRULE(groupGraphPattern, patterns, void 0);
13212
+ SUBRULE(groupGraphPattern, patterns);
13213
13213
  } else if (F3.isExpressionFunctionCall(ast)) {
13214
- SUBRULE(iriOrFunction, ast, void 0);
13214
+ SUBRULE(iriOrFunction, ast);
13215
13215
  } else if (F3.isExpressionAggregate(ast)) {
13216
- SUBRULE(aggregate, ast, void 0);
13216
+ SUBRULE(aggregate, ast);
13217
13217
  }
13218
13218
  }
13219
13219
  };
@@ -13230,10 +13230,10 @@ function constructLeftDeep(startGenerator, restGenerator, ACTION, MANY) {
13230
13230
  var conditionalOrExpression = {
13231
13231
  name: "conditionalOrExpression",
13232
13232
  impl: ({ ACTION, MANY, CONSUME, SUBRULE1, SUBRULE2 }) => (C) => constructLeftDeep(
13233
- () => SUBRULE1(conditionalAndExpression, void 0),
13233
+ () => SUBRULE1(conditionalAndExpression),
13234
13234
  () => {
13235
13235
  CONSUME(symbols_exports.logicOr);
13236
- const args = SUBRULE2(conditionalAndExpression, void 0);
13236
+ const args = SUBRULE2(conditionalAndExpression);
13237
13237
  return (left) => ACTION(() => C.factory.expressionOperation("||", [left, args], C.factory.sourceLocation(left, args)));
13238
13238
  },
13239
13239
  ACTION,
@@ -13243,10 +13243,10 @@ var conditionalOrExpression = {
13243
13243
  var conditionalAndExpression = {
13244
13244
  name: "conditionalAndExpression",
13245
13245
  impl: ({ ACTION, MANY, SUBRULE1, SUBRULE2, CONSUME }) => (C) => constructLeftDeep(
13246
- () => SUBRULE1(valueLogical, void 0),
13246
+ () => SUBRULE1(valueLogical),
13247
13247
  () => {
13248
13248
  CONSUME(symbols_exports.logicAnd);
13249
- const arg = SUBRULE2(valueLogical, void 0);
13249
+ const arg = SUBRULE2(valueLogical);
13250
13250
  return (left) => ACTION(() => C.factory.expressionOperation("&&", [left, arg], C.factory.sourceLocation(left, arg)));
13251
13251
  },
13252
13252
  ACTION,
@@ -13255,12 +13255,12 @@ var conditionalAndExpression = {
13255
13255
  };
13256
13256
  var valueLogical = {
13257
13257
  name: "valueLogical",
13258
- impl: ({ SUBRULE }) => () => SUBRULE(relationalExpression, void 0)
13258
+ impl: ({ SUBRULE }) => () => SUBRULE(relationalExpression)
13259
13259
  };
13260
13260
  var relationalExpression = {
13261
13261
  name: "relationalExpression",
13262
13262
  impl: ({ ACTION, CONSUME, SUBRULE1, SUBRULE2, OPTION, OR1, OR2, OR3 }) => (C) => {
13263
- const args1 = SUBRULE1(numericExpression, void 0);
13263
+ const args1 = SUBRULE1(numericExpression);
13264
13264
  const expression2 = OPTION(() => OR1([
13265
13265
  { ALT: () => {
13266
13266
  const operator = OR2([
@@ -13271,7 +13271,7 @@ var relationalExpression = {
13271
13271
  { ALT: () => CONSUME(symbols_exports.lessThanEqual) },
13272
13272
  { ALT: () => CONSUME(symbols_exports.greaterThanEqual) }
13273
13273
  ]);
13274
- const expr = SUBRULE2(numericExpression, void 0);
13274
+ const expr = SUBRULE2(numericExpression);
13275
13275
  return ACTION(() => C.factory.expressionOperation(
13276
13276
  operator.image,
13277
13277
  [args1, expr],
@@ -13283,7 +13283,7 @@ var relationalExpression = {
13283
13283
  { ALT: () => CONSUME(in_) },
13284
13284
  { ALT: () => CONSUME(notIn) }
13285
13285
  ]);
13286
- const args = SUBRULE1(expressionList, void 0);
13286
+ const args = SUBRULE1(expressionList);
13287
13287
  return ACTION(() => C.factory.expressionOperation(
13288
13288
  operator.image,
13289
13289
  [args1, ...args.val],
@@ -13296,25 +13296,25 @@ var relationalExpression = {
13296
13296
  };
13297
13297
  var numericExpression = {
13298
13298
  name: "numericExpression",
13299
- impl: ({ SUBRULE }) => () => SUBRULE(additiveExpression, void 0)
13299
+ impl: ({ SUBRULE }) => () => SUBRULE(additiveExpression)
13300
13300
  };
13301
13301
  var additiveExpression = {
13302
13302
  name: "additiveExpression",
13303
13303
  impl: ({ ACTION, SUBRULE, CONSUME, SUBRULE1, SUBRULE2, MANY1, MANY2, OR1, OR2, OR3, OR4 }) => (C) => constructLeftDeep(
13304
- () => SUBRULE1(multiplicativeExpression, void 0),
13304
+ () => SUBRULE1(multiplicativeExpression),
13305
13305
  () => OR1([
13306
13306
  { ALT: () => {
13307
13307
  const operator = OR2([
13308
13308
  { ALT: () => CONSUME(symbols_exports.opPlus) },
13309
13309
  { ALT: () => CONSUME(symbols_exports.opMinus) }
13310
13310
  ]);
13311
- const arg = SUBRULE2(multiplicativeExpression, void 0);
13311
+ const arg = SUBRULE2(multiplicativeExpression);
13312
13312
  return ACTION(() => (left) => C.factory.expressionOperation(operator.image, [left, arg], C.factory.sourceLocation(left, arg)));
13313
13313
  } },
13314
13314
  { ALT: () => {
13315
13315
  const { operator, startInt } = OR3([
13316
13316
  { ALT: () => {
13317
- const integer2 = SUBRULE(numericLiteralPositive, void 0);
13317
+ const integer2 = SUBRULE(numericLiteralPositive);
13318
13318
  return ACTION(() => {
13319
13319
  integer2.value = integer2.value.replace(/^\+/u, "");
13320
13320
  return {
@@ -13324,7 +13324,7 @@ var additiveExpression = {
13324
13324
  });
13325
13325
  } },
13326
13326
  { ALT: () => {
13327
- const integer2 = SUBRULE(numericLiteralNegative, void 0);
13327
+ const integer2 = SUBRULE(numericLiteralNegative);
13328
13328
  return ACTION(() => {
13329
13329
  integer2.value = integer2.value.replace(/^-/u, "");
13330
13330
  return {
@@ -13341,7 +13341,7 @@ var additiveExpression = {
13341
13341
  { ALT: () => CONSUME(symbols_exports.star) },
13342
13342
  { ALT: () => CONSUME(symbols_exports.slash) }
13343
13343
  ]);
13344
- const innerExpr = SUBRULE1(unaryExpression, void 0);
13344
+ const innerExpr = SUBRULE1(unaryExpression);
13345
13345
  return ACTION(() => (leftInner) => C.factory.expressionOperation(
13346
13346
  innerOperator.image,
13347
13347
  [leftInner, innerExpr],
@@ -13365,13 +13365,13 @@ var additiveExpression = {
13365
13365
  var multiplicativeExpression = {
13366
13366
  name: "multiplicativeExpression",
13367
13367
  impl: ({ ACTION, CONSUME, MANY, SUBRULE1, SUBRULE2, OR }) => (C) => constructLeftDeep(
13368
- () => SUBRULE1(unaryExpression, void 0),
13368
+ () => SUBRULE1(unaryExpression),
13369
13369
  () => {
13370
13370
  const operator = OR([
13371
13371
  { ALT: () => CONSUME(symbols_exports.star) },
13372
13372
  { ALT: () => CONSUME(symbols_exports.slash) }
13373
13373
  ]);
13374
- const expr = SUBRULE2(unaryExpression, void 0);
13374
+ const expr = SUBRULE2(unaryExpression);
13375
13375
  return (left) => ({
13376
13376
  type: "expression",
13377
13377
  subType: "operation",
@@ -13387,14 +13387,14 @@ var multiplicativeExpression = {
13387
13387
  var unaryExpression = {
13388
13388
  name: "unaryExpression",
13389
13389
  impl: ({ ACTION, CONSUME, SUBRULE1, SUBRULE2, OR1, OR2 }) => (C) => OR1([
13390
- { ALT: () => SUBRULE1(primaryExpression, void 0) },
13390
+ { ALT: () => SUBRULE1(primaryExpression) },
13391
13391
  { ALT: () => {
13392
13392
  const operator = OR2([
13393
13393
  { ALT: () => CONSUME(symbols_exports.exclamation) },
13394
13394
  { ALT: () => CONSUME(symbols_exports.opPlus) },
13395
13395
  { ALT: () => CONSUME(symbols_exports.opMinus) }
13396
13396
  ]);
13397
- const expr = SUBRULE2(primaryExpression, void 0);
13397
+ const expr = SUBRULE2(primaryExpression);
13398
13398
  return ACTION(() => ({
13399
13399
  type: "expression",
13400
13400
  subType: "operation",
@@ -13408,20 +13408,20 @@ var unaryExpression = {
13408
13408
  var primaryExpression = {
13409
13409
  name: "primaryExpression",
13410
13410
  impl: ({ SUBRULE, OR }) => () => OR([
13411
- { ALT: () => SUBRULE(brackettedExpression, void 0) },
13412
- { ALT: () => SUBRULE(builtInCall, void 0) },
13413
- { ALT: () => SUBRULE(iriOrFunction, void 0) },
13414
- { ALT: () => SUBRULE(rdfLiteral, void 0) },
13415
- { ALT: () => SUBRULE(numericLiteral, void 0) },
13416
- { ALT: () => SUBRULE(booleanLiteral, void 0) },
13417
- { ALT: () => SUBRULE(var_, void 0) }
13411
+ { ALT: () => SUBRULE(brackettedExpression) },
13412
+ { ALT: () => SUBRULE(builtInCall) },
13413
+ { ALT: () => SUBRULE(iriOrFunction) },
13414
+ { ALT: () => SUBRULE(rdfLiteral) },
13415
+ { ALT: () => SUBRULE(numericLiteral) },
13416
+ { ALT: () => SUBRULE(booleanLiteral) },
13417
+ { ALT: () => SUBRULE(var_) }
13418
13418
  ])
13419
13419
  };
13420
13420
  var brackettedExpression = {
13421
13421
  name: "brackettedExpression",
13422
13422
  impl: ({ ACTION, SUBRULE, CONSUME }) => (C) => {
13423
13423
  const open = CONSUME(symbols_exports.LParen);
13424
- const expr = SUBRULE(expression, void 0);
13424
+ const expr = SUBRULE(expression);
13425
13425
  const close = CONSUME(symbols_exports.RParen);
13426
13426
  return ACTION(() => {
13427
13427
  expr.loc = C.factory.sourceLocation(open, close);
@@ -13432,9 +13432,9 @@ var brackettedExpression = {
13432
13432
  var iriOrFunction = {
13433
13433
  name: "iriOrFunction",
13434
13434
  impl: ({ ACTION, SUBRULE, OPTION }) => (C) => {
13435
- const iriVal = SUBRULE(iri2, void 0);
13435
+ const iriVal = SUBRULE(iri2);
13436
13436
  const functionCall2 = OPTION(() => {
13437
- const args = SUBRULE(argList, void 0);
13437
+ const args = SUBRULE(argList);
13438
13438
  return ACTION(() => {
13439
13439
  const distinct2 = args.val.distinct;
13440
13440
  if (!C.parseMode.has("canParseAggregate") && distinct2) {
@@ -13454,10 +13454,10 @@ var iriOrFunction = {
13454
13454
  },
13455
13455
  gImpl: ({ SUBRULE }) => (ast, { factory: F3 }) => {
13456
13456
  if (F3.isTermNamed(ast)) {
13457
- SUBRULE(iri2, ast, void 0);
13457
+ SUBRULE(iri2, ast);
13458
13458
  } else {
13459
- SUBRULE(iri2, ast.function, void 0);
13460
- SUBRULE(argList, F3.wrap({ args: ast.args, distinct: ast.distinct }, ast.loc), void 0);
13459
+ SUBRULE(iri2, ast.function);
13460
+ SUBRULE(argList, F3.wrap({ args: ast.args, distinct: ast.distinct }, ast.loc));
13461
13461
  }
13462
13462
  }
13463
13463
  };
@@ -13466,10 +13466,10 @@ var iriOrFunction = {
13466
13466
  var solutionModifier = {
13467
13467
  name: "solutionModifier",
13468
13468
  impl: ({ ACTION, SUBRULE, OPTION1, OPTION2, OPTION3, OPTION4 }) => () => {
13469
- const group = OPTION1(() => SUBRULE(groupClause, void 0));
13470
- const having2 = OPTION2(() => SUBRULE(havingClause, void 0));
13471
- const order2 = OPTION3(() => SUBRULE(orderClause, void 0));
13472
- const limitOffset = OPTION4(() => SUBRULE(limitOffsetClauses, void 0));
13469
+ const group = OPTION1(() => SUBRULE(groupClause));
13470
+ const having2 = OPTION2(() => SUBRULE(havingClause));
13471
+ const order2 = OPTION3(() => SUBRULE(orderClause));
13472
+ const limitOffset = OPTION4(() => SUBRULE(limitOffsetClauses));
13473
13473
  return ACTION(() => ({
13474
13474
  ...limitOffset && { limitOffset },
13475
13475
  ...group && { group },
@@ -13479,16 +13479,16 @@ var solutionModifier = {
13479
13479
  },
13480
13480
  gImpl: ({ SUBRULE }) => (ast) => {
13481
13481
  if (ast.group) {
13482
- SUBRULE(groupClause, ast.group, void 0);
13482
+ SUBRULE(groupClause, ast.group);
13483
13483
  }
13484
13484
  if (ast.having) {
13485
- SUBRULE(havingClause, ast.having, void 0);
13485
+ SUBRULE(havingClause, ast.having);
13486
13486
  }
13487
13487
  if (ast.order) {
13488
- SUBRULE(orderClause, ast.order, void 0);
13488
+ SUBRULE(orderClause, ast.order);
13489
13489
  }
13490
13490
  if (ast.limitOffset) {
13491
- SUBRULE(limitOffsetClauses, ast.limitOffset, void 0);
13491
+ SUBRULE(limitOffsetClauses, ast.limitOffset);
13492
13492
  }
13493
13493
  }
13494
13494
  };
@@ -13499,7 +13499,7 @@ var groupClause = {
13499
13499
  const start = CONSUME(groupByGroup);
13500
13500
  CONSUME(by);
13501
13501
  AT_LEAST_ONE(() => {
13502
- groupings.push(SUBRULE1(groupCondition, void 0));
13502
+ groupings.push(SUBRULE1(groupCondition));
13503
13503
  });
13504
13504
  return ACTION(() => ({
13505
13505
  type: "solutionModifier",
@@ -13512,12 +13512,12 @@ var groupClause = {
13512
13512
  F3.printFilter(ast, () => PRINT_WORDS("GROUP", "BY"));
13513
13513
  for (const grouping of ast.groupings) {
13514
13514
  if (F3.isExpression(grouping)) {
13515
- SUBRULE(expression, grouping, void 0);
13515
+ SUBRULE(expression, grouping);
13516
13516
  } else {
13517
13517
  F3.printFilter(ast, () => PRINT_WORDS("("));
13518
- SUBRULE(expression, grouping.value, void 0);
13518
+ SUBRULE(expression, grouping.value);
13519
13519
  F3.printFilter(ast, () => PRINT_WORDS("AS"));
13520
- SUBRULE(var_, grouping.variable, void 0);
13520
+ SUBRULE(var_, grouping.variable);
13521
13521
  F3.printFilter(ast, () => PRINT_WORDS(")"));
13522
13522
  }
13523
13523
  }
@@ -13526,16 +13526,16 @@ var groupClause = {
13526
13526
  var groupCondition = {
13527
13527
  name: "groupCondition",
13528
13528
  impl: ({ ACTION, SUBRULE, CONSUME, SUBRULE1, SUBRULE2, OPTION, OR }) => (C) => OR([
13529
- { ALT: () => SUBRULE(builtInCall, void 0) },
13530
- { ALT: () => SUBRULE(functionCall, void 0) },
13531
- { ALT: () => SUBRULE2(var_, void 0) },
13529
+ { ALT: () => SUBRULE(builtInCall) },
13530
+ { ALT: () => SUBRULE(functionCall) },
13531
+ { ALT: () => SUBRULE2(var_) },
13532
13532
  {
13533
13533
  ALT: () => {
13534
13534
  const open = CONSUME(symbols_exports.LParen);
13535
- const expressionValue = SUBRULE(expression, void 0);
13535
+ const expressionValue = SUBRULE(expression);
13536
13536
  const variable = OPTION(() => {
13537
13537
  CONSUME(as);
13538
- return SUBRULE1(var_, void 0);
13538
+ return SUBRULE1(var_);
13539
13539
  });
13540
13540
  const close = CONSUME(symbols_exports.RParen);
13541
13541
  return ACTION(() => {
@@ -13559,7 +13559,7 @@ var havingClause = {
13559
13559
  const expressions = [];
13560
13560
  const couldParseAgg = ACTION(() => C.parseMode.has("canParseAggregate") || !C.parseMode.add("canParseAggregate"));
13561
13561
  AT_LEAST_ONE(() => {
13562
- expressions.push(SUBRULE(havingCondition, void 0));
13562
+ expressions.push(SUBRULE(havingCondition));
13563
13563
  });
13564
13564
  ACTION(() => !couldParseAgg && C.parseMode.delete("canParseAggregate"));
13565
13565
  return ACTION(() => C.factory.solutionModifierHaving(expressions, C.factory.sourceLocation(having2, expressions.at(-1))));
@@ -13567,13 +13567,13 @@ var havingClause = {
13567
13567
  gImpl: ({ PRINT_WORD, SUBRULE }) => (ast, { factory: F3 }) => {
13568
13568
  F3.printFilter(ast, () => PRINT_WORD("HAVING"));
13569
13569
  for (const having2 of ast.having) {
13570
- SUBRULE(expression, having2, void 0);
13570
+ SUBRULE(expression, having2);
13571
13571
  }
13572
13572
  }
13573
13573
  };
13574
13574
  var havingCondition = {
13575
13575
  name: "havingCondition",
13576
- impl: ({ SUBRULE }) => () => SUBRULE(constraint, void 0)
13576
+ impl: ({ SUBRULE }) => () => SUBRULE(constraint)
13577
13577
  };
13578
13578
  var orderClause = {
13579
13579
  name: "orderClause",
@@ -13583,7 +13583,7 @@ var orderClause = {
13583
13583
  const orderings = [];
13584
13584
  const couldParseAgg = ACTION(() => C.parseMode.has("canParseAggregate") || !C.parseMode.add("canParseAggregate"));
13585
13585
  AT_LEAST_ONE(() => {
13586
- orderings.push(SUBRULE1(orderCondition, void 0));
13586
+ orderings.push(SUBRULE1(orderCondition));
13587
13587
  });
13588
13588
  ACTION(() => !couldParseAgg && C.parseMode.delete("canParseAggregate"));
13589
13589
  return ACTION(() => C.factory.solutionModifierOrder(orderings, C.factory.sourceLocation(order2, orderings.at(-1))));
@@ -13597,7 +13597,7 @@ var orderClause = {
13597
13597
  F3.printFilter(ast, () => PRINT_WORDS("ASC"));
13598
13598
  }
13599
13599
  F3.printFilter(ast, () => PRINT_WORDS("("));
13600
- SUBRULE(expression, ordering.expression, void 0);
13600
+ SUBRULE(expression, ordering.expression);
13601
13601
  F3.printFilter(ast, () => PRINT_WORDS(")"));
13602
13602
  }
13603
13603
  }
@@ -13616,7 +13616,7 @@ var orderCondition = {
13616
13616
  return [true, token];
13617
13617
  } }
13618
13618
  ]);
13619
- const expr = SUBRULE(brackettedExpression, void 0);
13619
+ const expr = SUBRULE(brackettedExpression);
13620
13620
  return ACTION(() => ({
13621
13621
  expression: expr,
13622
13622
  descending: descending[0],
@@ -13624,11 +13624,11 @@ var orderCondition = {
13624
13624
  }));
13625
13625
  } },
13626
13626
  { ALT: () => {
13627
- const expr = SUBRULE(constraint, void 0);
13627
+ const expr = SUBRULE(constraint);
13628
13628
  return ACTION(() => ({ expression: expr, descending: false, loc: expr.loc }));
13629
13629
  } },
13630
13630
  { ALT: () => {
13631
- const expr = SUBRULE(var_, void 0);
13631
+ const expr = SUBRULE(var_);
13632
13632
  return ACTION(() => ({ expression: expr, descending: false, loc: expr.loc }));
13633
13633
  } }
13634
13634
  ])
@@ -13637,8 +13637,8 @@ var limitOffsetClauses = {
13637
13637
  name: "limitOffsetClauses",
13638
13638
  impl: ({ ACTION, SUBRULE1, SUBRULE2, OPTION1, OPTION2, OR }) => (C) => OR([
13639
13639
  { ALT: () => {
13640
- const limit2 = SUBRULE1(limitClause, void 0);
13641
- const offset2 = OPTION1(() => SUBRULE1(offsetClause, void 0));
13640
+ const limit2 = SUBRULE1(limitClause);
13641
+ const offset2 = OPTION1(() => SUBRULE1(offsetClause));
13642
13642
  return ACTION(() => C.factory.solutionModifierLimitOffset(
13643
13643
  limit2.val,
13644
13644
  offset2?.val,
@@ -13646,8 +13646,8 @@ var limitOffsetClauses = {
13646
13646
  ));
13647
13647
  } },
13648
13648
  { ALT: () => {
13649
- const offset2 = SUBRULE2(offsetClause, void 0);
13650
- const limit2 = OPTION2(() => SUBRULE2(limitClause, void 0));
13649
+ const offset2 = SUBRULE2(offsetClause);
13650
+ const limit2 = OPTION2(() => SUBRULE2(limitClause));
13651
13651
  return ACTION(() => C.factory.solutionModifierLimitOffset(
13652
13652
  limit2?.val,
13653
13653
  offset2.val,
@@ -13685,22 +13685,22 @@ var offsetClause = {
13685
13685
  }
13686
13686
  };
13687
13687
 
13688
- // ../rules-sparql-1-1/lib/grammar/queryUnit/queryUnit.ts
13688
+ // ../rules-sparql-1-1/lib/grammar/queryUnit.ts
13689
13689
  var queryUnit = {
13690
13690
  name: "queryUnit",
13691
- impl: ({ SUBRULE }) => () => SUBRULE(query, void 0)
13691
+ impl: ({ SUBRULE }) => () => SUBRULE(query)
13692
13692
  };
13693
13693
  var query = {
13694
13694
  name: "query",
13695
13695
  impl: ({ ACTION, SUBRULE, OR }) => (C) => {
13696
- const prologueValues = SUBRULE(prologue, void 0);
13696
+ const prologueValues = SUBRULE(prologue);
13697
13697
  const subType = OR([
13698
- { ALT: () => SUBRULE(selectQuery, void 0) },
13699
- { ALT: () => SUBRULE(constructQuery, void 0) },
13700
- { ALT: () => SUBRULE(describeQuery, void 0) },
13701
- { ALT: () => SUBRULE(askQuery, void 0) }
13698
+ { ALT: () => SUBRULE(selectQuery) },
13699
+ { ALT: () => SUBRULE(constructQuery) },
13700
+ { ALT: () => SUBRULE(describeQuery) },
13701
+ { ALT: () => SUBRULE(askQuery) }
13702
13702
  ]);
13703
- const values3 = SUBRULE(valuesClause, void 0);
13703
+ const values3 = SUBRULE(valuesClause);
13704
13704
  return ACTION(() => ({
13705
13705
  context: prologueValues,
13706
13706
  ...subType,
@@ -13714,28 +13714,28 @@ var query = {
13714
13714
  }));
13715
13715
  },
13716
13716
  gImpl: ({ SUBRULE }) => (ast, { factory: F3 }) => {
13717
- SUBRULE(prologue, ast.context, void 0);
13717
+ SUBRULE(prologue, ast.context);
13718
13718
  if (F3.isQuerySelect(ast)) {
13719
- SUBRULE(selectQuery, ast, void 0);
13719
+ SUBRULE(selectQuery, ast);
13720
13720
  } else if (F3.isQueryConstruct(ast)) {
13721
- SUBRULE(constructQuery, ast, void 0);
13721
+ SUBRULE(constructQuery, ast);
13722
13722
  } else if (F3.isQueryDescribe(ast)) {
13723
- SUBRULE(describeQuery, ast, void 0);
13723
+ SUBRULE(describeQuery, ast);
13724
13724
  } else if (F3.isQueryAsk(ast)) {
13725
- SUBRULE(askQuery, ast, void 0);
13725
+ SUBRULE(askQuery, ast);
13726
13726
  }
13727
13727
  if (ast.values) {
13728
- SUBRULE(inlineData, ast.values, void 0);
13728
+ SUBRULE(inlineData, ast.values);
13729
13729
  }
13730
13730
  }
13731
13731
  };
13732
13732
  var selectQuery = {
13733
13733
  name: "selectQuery",
13734
13734
  impl: ({ ACTION, SUBRULE }) => (C) => {
13735
- const selectVal = SUBRULE(selectClause, void 0);
13736
- const from2 = SUBRULE(datasetClauseStar, void 0);
13737
- const where2 = SUBRULE(whereClause, void 0);
13738
- const modifiers = SUBRULE(solutionModifier, void 0);
13735
+ const selectVal = SUBRULE(selectClause);
13736
+ const from2 = SUBRULE(datasetClauseStar);
13737
+ const where2 = SUBRULE(whereClause);
13738
+ const modifiers = SUBRULE(solutionModifier);
13739
13739
  return ACTION(() => {
13740
13740
  const ret = {
13741
13741
  subType: "select",
@@ -13761,19 +13761,19 @@ var selectQuery = {
13761
13761
  variables: ast.variables,
13762
13762
  distinct: ast.distinct,
13763
13763
  reduced: ast.reduced
13764
- }, F3.sourceLocation(...ast.variables)), void 0);
13765
- SUBRULE(datasetClauseStar, ast.datasets, void 0);
13766
- SUBRULE(whereClause, F3.wrap(ast.where, ast.where.loc), void 0);
13767
- SUBRULE(solutionModifier, ast.solutionModifiers, void 0);
13764
+ }, F3.sourceLocation(...ast.variables)));
13765
+ SUBRULE(datasetClauseStar, ast.datasets);
13766
+ SUBRULE(whereClause, F3.wrap(ast.where, ast.where.loc));
13767
+ SUBRULE(solutionModifier, ast.solutionModifiers);
13768
13768
  }
13769
13769
  };
13770
13770
  var subSelect = {
13771
13771
  name: "subSelect",
13772
13772
  impl: ({ ACTION, SUBRULE }) => (C) => {
13773
- const selectVal = SUBRULE(selectClause, void 0);
13774
- const where2 = SUBRULE(whereClause, void 0);
13775
- const modifiers = SUBRULE(solutionModifier, void 0);
13776
- const values3 = SUBRULE(valuesClause, void 0);
13773
+ const selectVal = SUBRULE(selectClause);
13774
+ const where2 = SUBRULE(whereClause);
13775
+ const modifiers = SUBRULE(solutionModifier);
13776
+ const values3 = SUBRULE(valuesClause);
13777
13777
  return ACTION(() => C.factory.querySelect({
13778
13778
  where: where2.val,
13779
13779
  datasets: C.factory.datasetClauses([], C.factory.sourceLocation()),
@@ -13838,7 +13838,7 @@ var selectClause = {
13838
13838
  const variables = [];
13839
13839
  AT_LEAST_ONE(() => OR3([
13840
13840
  { ALT: () => {
13841
- const raw = SUBRULE1(var_, void 0);
13841
+ const raw = SUBRULE1(var_);
13842
13842
  ACTION(() => {
13843
13843
  if (usedVars.some((v) => v.value === raw.value)) {
13844
13844
  throw new Error(`Variable ${raw.value} used more than once in SELECT clause`);
@@ -13850,9 +13850,9 @@ var selectClause = {
13850
13850
  } },
13851
13851
  { ALT: () => {
13852
13852
  const open = CONSUME(symbols_exports.LParen);
13853
- const expr = SUBRULE1(expression, void 0);
13853
+ const expr = SUBRULE1(expression);
13854
13854
  CONSUME(as);
13855
- const variable = SUBRULE2(var_, void 0);
13855
+ const variable = SUBRULE2(var_);
13856
13856
  const close = CONSUME(symbols_exports.RParen);
13857
13857
  ACTION(() => {
13858
13858
  last2 = close;
@@ -13883,12 +13883,12 @@ var selectClause = {
13883
13883
  if (F3.isWildcard(variable)) {
13884
13884
  F3.printFilter(ast, () => PRINT_WORD("*"));
13885
13885
  } else if (F3.isTerm(variable)) {
13886
- SUBRULE(var_, variable, void 0);
13886
+ SUBRULE(var_, variable);
13887
13887
  } else {
13888
13888
  F3.printFilter(ast, () => PRINT_WORD("("));
13889
- SUBRULE(expression, variable.expression, void 0);
13889
+ SUBRULE(expression, variable.expression);
13890
13890
  F3.printFilter(ast, () => PRINT_WORD("AS"));
13891
- SUBRULE(var_, variable.variable, void 0);
13891
+ SUBRULE(var_, variable.variable);
13892
13892
  F3.printFilter(ast, () => PRINT_WORD(")"));
13893
13893
  }
13894
13894
  }
@@ -13900,10 +13900,10 @@ var constructQuery = {
13900
13900
  const construct2 = CONSUME(construct);
13901
13901
  return OR([
13902
13902
  { ALT: () => {
13903
- const template = SUBRULE1(constructTemplate, void 0);
13904
- const from2 = SUBRULE1(datasetClauseStar, void 0);
13905
- const where2 = SUBRULE1(whereClause, void 0);
13906
- const modifiers = SUBRULE1(solutionModifier, void 0);
13903
+ const template = SUBRULE1(constructTemplate);
13904
+ const from2 = SUBRULE1(datasetClauseStar);
13905
+ const where2 = SUBRULE1(whereClause);
13906
+ const modifiers = SUBRULE1(solutionModifier);
13907
13907
  return ACTION(() => ({
13908
13908
  subType: "construct",
13909
13909
  template: template.val,
@@ -13921,10 +13921,10 @@ var constructQuery = {
13921
13921
  }));
13922
13922
  } },
13923
13923
  { ALT: () => {
13924
- const from2 = SUBRULE2(datasetClauseStar, void 0);
13924
+ const from2 = SUBRULE2(datasetClauseStar);
13925
13925
  CONSUME(where);
13926
- const template = SUBRULE2(constructTemplate, void 0);
13927
- const modifiers = SUBRULE2(solutionModifier, void 0);
13926
+ const template = SUBRULE2(constructTemplate);
13927
+ const modifiers = SUBRULE2(solutionModifier);
13928
13928
  return ACTION(() => ({
13929
13929
  subType: "construct",
13930
13930
  template: template.val,
@@ -13947,16 +13947,16 @@ var constructQuery = {
13947
13947
  F3.printFilter(ast, () => PRINT_WORD("CONSTRUCT"));
13948
13948
  if (!F3.isSourceLocationNoMaterialize(ast.where.loc)) {
13949
13949
  F3.printFilter(ast, () => PRINT_WORD("{"));
13950
- SUBRULE(triplesBlock, ast.template, void 0);
13950
+ SUBRULE(triplesBlock, ast.template);
13951
13951
  F3.printFilter(ast, () => PRINT_WORD("}"));
13952
13952
  }
13953
- SUBRULE(datasetClauseStar, ast.datasets, void 0);
13953
+ SUBRULE(datasetClauseStar, ast.datasets);
13954
13954
  if (F3.isSourceLocationNoMaterialize(ast.where.loc)) {
13955
- SUBRULE(whereClause, F3.wrap(F3.patternGroup([ast.template], ast.template.loc), ast.template.loc), void 0);
13955
+ SUBRULE(whereClause, F3.wrap(F3.patternGroup([ast.template], ast.template.loc), ast.template.loc));
13956
13956
  } else {
13957
- SUBRULE(whereClause, F3.wrap(ast.where, ast.where.loc), void 0);
13957
+ SUBRULE(whereClause, F3.wrap(ast.where, ast.where.loc));
13958
13958
  }
13959
- SUBRULE(solutionModifier, ast.solutionModifiers, void 0);
13959
+ SUBRULE(solutionModifier, ast.solutionModifiers);
13960
13960
  }
13961
13961
  };
13962
13962
  var describeQuery = {
@@ -13967,7 +13967,7 @@ var describeQuery = {
13967
13967
  { ALT: () => {
13968
13968
  const variables2 = [];
13969
13969
  AT_LEAST_ONE(() => {
13970
- variables2.push(SUBRULE1(varOrIri, void 0));
13970
+ variables2.push(SUBRULE1(varOrIri));
13971
13971
  });
13972
13972
  return variables2;
13973
13973
  } },
@@ -13976,9 +13976,9 @@ var describeQuery = {
13976
13976
  return [ACTION(() => C.factory.wildcard(C.factory.sourceLocation(star2)))];
13977
13977
  } }
13978
13978
  ]);
13979
- const from2 = SUBRULE1(datasetClauseStar, void 0);
13980
- const where2 = OPTION(() => SUBRULE1(whereClause, void 0));
13981
- const modifiers = SUBRULE1(solutionModifier, void 0);
13979
+ const from2 = SUBRULE1(datasetClauseStar);
13980
+ const where2 = OPTION(() => SUBRULE1(whereClause));
13981
+ const modifiers = SUBRULE1(solutionModifier);
13982
13982
  return ACTION(() => ({
13983
13983
  subType: "describe",
13984
13984
  variables,
@@ -14003,23 +14003,23 @@ var describeQuery = {
14003
14003
  F3.printFilter(ast, () => PRINT_WORD("*"));
14004
14004
  } else {
14005
14005
  for (const variable of ast.variables) {
14006
- SUBRULE(varOrTerm, variable, void 0);
14006
+ SUBRULE(varOrTerm, variable);
14007
14007
  }
14008
14008
  }
14009
- SUBRULE(datasetClauseStar, ast.datasets, void 0);
14009
+ SUBRULE(datasetClauseStar, ast.datasets);
14010
14010
  if (ast.where) {
14011
- SUBRULE(whereClause, F3.wrap(ast.where, ast.loc), void 0);
14011
+ SUBRULE(whereClause, F3.wrap(ast.where, ast.loc));
14012
14012
  }
14013
- SUBRULE(solutionModifier, ast.solutionModifiers, void 0);
14013
+ SUBRULE(solutionModifier, ast.solutionModifiers);
14014
14014
  }
14015
14015
  };
14016
14016
  var askQuery = {
14017
14017
  name: "askQuery",
14018
14018
  impl: ({ ACTION, SUBRULE, CONSUME }) => (C) => {
14019
14019
  const ask2 = CONSUME(ask);
14020
- const from2 = SUBRULE(datasetClauseStar, void 0);
14021
- const where2 = SUBRULE(whereClause, void 0);
14022
- const modifiers = SUBRULE(solutionModifier, void 0);
14020
+ const from2 = SUBRULE(datasetClauseStar);
14021
+ const where2 = SUBRULE(whereClause);
14022
+ const modifiers = SUBRULE(solutionModifier);
14023
14023
  return ACTION(() => ({
14024
14024
  subType: "ask",
14025
14025
  datasets: from2,
@@ -14038,20 +14038,20 @@ var askQuery = {
14038
14038
  },
14039
14039
  gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F3 }) => {
14040
14040
  F3.printFilter(ast, () => PRINT_WORD("ASK"));
14041
- SUBRULE(datasetClauseStar, ast.datasets, void 0);
14042
- SUBRULE(whereClause, F3.wrap(ast.where, ast.loc), void 0);
14043
- SUBRULE(solutionModifier, ast.solutionModifiers, void 0);
14041
+ SUBRULE(datasetClauseStar, ast.datasets);
14042
+ SUBRULE(whereClause, F3.wrap(ast.where, ast.loc));
14043
+ SUBRULE(solutionModifier, ast.solutionModifiers);
14044
14044
  }
14045
14045
  };
14046
14046
  var valuesClause = {
14047
14047
  name: "valuesClause",
14048
- impl: ({ OPTION, SUBRULE }) => () => OPTION(() => SUBRULE(inlineData, void 0))
14048
+ impl: ({ OPTION, SUBRULE }) => () => OPTION(() => SUBRULE(inlineData))
14049
14049
  };
14050
14050
  var constructTemplate = {
14051
14051
  name: "constructTemplate",
14052
14052
  impl: ({ ACTION, SUBRULE1, CONSUME, OPTION }) => (C) => {
14053
14053
  const open = CONSUME(symbols_exports.LCurly);
14054
- const triples = OPTION(() => SUBRULE1(constructTriples, void 0));
14054
+ const triples = OPTION(() => SUBRULE1(constructTriples));
14055
14055
  const close = CONSUME(symbols_exports.RCurly);
14056
14056
  return ACTION(() => C.factory.wrap(
14057
14057
  triples ?? C.factory.patternBgp([], C.factory.sourceLocation()),
@@ -14064,27 +14064,27 @@ var constructTriples = {
14064
14064
  impl: triplesTemplate.impl
14065
14065
  };
14066
14066
 
14067
- // ../rules-sparql-1-1/lib/grammar/updateUnit/updateUnit.ts
14067
+ // ../rules-sparql-1-1/lib/grammar/updateUnit.ts
14068
14068
  var updateUnit = {
14069
14069
  name: "updateUnit",
14070
- impl: ({ SUBRULE }) => () => SUBRULE(update, void 0)
14070
+ impl: ({ SUBRULE }) => () => SUBRULE(update)
14071
14071
  };
14072
14072
  var update = {
14073
14073
  name: "update",
14074
14074
  impl: ({ ACTION, SUBRULE, SUBRULE1, SUBRULE2, CONSUME, OPTION1, MANY }) => (C) => {
14075
14075
  const updates = [];
14076
- const prologueValues = SUBRULE1(prologue, void 0);
14076
+ const prologueValues = SUBRULE1(prologue);
14077
14077
  updates.push({ context: prologueValues });
14078
14078
  let parsedSemi = true;
14079
14079
  MANY({
14080
14080
  GATE: () => parsedSemi,
14081
14081
  DEF: () => {
14082
14082
  parsedSemi = false;
14083
- updates.at(-1).operation = SUBRULE(update1, void 0);
14083
+ updates.at(-1).operation = SUBRULE(update1);
14084
14084
  OPTION1(() => {
14085
14085
  CONSUME(symbols_exports.semi);
14086
14086
  parsedSemi = true;
14087
- const innerPrologue = SUBRULE2(prologue, void 0);
14087
+ const innerPrologue = SUBRULE2(prologue);
14088
14088
  updates.push({ context: innerPrologue });
14089
14089
  });
14090
14090
  }
@@ -14106,9 +14106,9 @@ var update = {
14106
14106
  },
14107
14107
  gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F3 }) => {
14108
14108
  for (const update2 of ast.updates) {
14109
- SUBRULE(prologue, update2.context, void 0);
14109
+ SUBRULE(prologue, update2.context);
14110
14110
  if (update2.operation) {
14111
- SUBRULE(update1, update2.operation, void 0);
14111
+ SUBRULE(update1, update2.operation);
14112
14112
  F3.printFilter(ast, () => PRINT_WORD(" ;\n"));
14113
14113
  }
14114
14114
  }
@@ -14117,52 +14117,52 @@ var update = {
14117
14117
  var update1 = {
14118
14118
  name: "update1",
14119
14119
  impl: ({ SUBRULE, OR }) => () => OR([
14120
- { ALT: () => SUBRULE(load2, void 0) },
14121
- { ALT: () => SUBRULE(clear2, void 0) },
14122
- { ALT: () => SUBRULE(drop3, void 0) },
14123
- { ALT: () => SUBRULE(add2, void 0) },
14124
- { ALT: () => SUBRULE(move2, void 0) },
14125
- { ALT: () => SUBRULE(copy2, void 0) },
14126
- { ALT: () => SUBRULE(create2, void 0) },
14127
- { ALT: () => SUBRULE(insertData, void 0) },
14128
- { ALT: () => SUBRULE(deleteData, void 0) },
14129
- { ALT: () => SUBRULE(deleteWhere, void 0) },
14130
- { ALT: () => SUBRULE(modify, void 0) }
14120
+ { ALT: () => SUBRULE(load2) },
14121
+ { ALT: () => SUBRULE(clear2) },
14122
+ { ALT: () => SUBRULE(drop3) },
14123
+ { ALT: () => SUBRULE(add2) },
14124
+ { ALT: () => SUBRULE(move2) },
14125
+ { ALT: () => SUBRULE(copy2) },
14126
+ { ALT: () => SUBRULE(create2) },
14127
+ { ALT: () => SUBRULE(insertData) },
14128
+ { ALT: () => SUBRULE(deleteData) },
14129
+ { ALT: () => SUBRULE(deleteWhere) },
14130
+ { ALT: () => SUBRULE(modify) }
14131
14131
  ]),
14132
14132
  gImpl: ({ SUBRULE }) => (ast) => {
14133
14133
  switch (ast.subType) {
14134
14134
  case "load":
14135
- SUBRULE(load2, ast, void 0);
14135
+ SUBRULE(load2, ast);
14136
14136
  break;
14137
14137
  case "clear":
14138
- SUBRULE(clear2, ast, void 0);
14138
+ SUBRULE(clear2, ast);
14139
14139
  break;
14140
14140
  case "drop":
14141
- SUBRULE(drop3, ast, void 0);
14141
+ SUBRULE(drop3, ast);
14142
14142
  break;
14143
14143
  case "add":
14144
- SUBRULE(add2, ast, void 0);
14144
+ SUBRULE(add2, ast);
14145
14145
  break;
14146
14146
  case "move":
14147
- SUBRULE(move2, ast, void 0);
14147
+ SUBRULE(move2, ast);
14148
14148
  break;
14149
14149
  case "copy":
14150
- SUBRULE(copy2, ast, void 0);
14150
+ SUBRULE(copy2, ast);
14151
14151
  break;
14152
14152
  case "create":
14153
- SUBRULE(create2, ast, void 0);
14153
+ SUBRULE(create2, ast);
14154
14154
  break;
14155
14155
  case "insertdata":
14156
- SUBRULE(insertData, ast, void 0);
14156
+ SUBRULE(insertData, ast);
14157
14157
  break;
14158
14158
  case "deletedata":
14159
- SUBRULE(deleteData, ast, void 0);
14159
+ SUBRULE(deleteData, ast);
14160
14160
  break;
14161
14161
  case "deletewhere":
14162
- SUBRULE(deleteWhere, ast, void 0);
14162
+ SUBRULE(deleteWhere, ast);
14163
14163
  break;
14164
14164
  case "modify":
14165
- SUBRULE(modify, ast, void 0);
14165
+ SUBRULE(modify, ast);
14166
14166
  break;
14167
14167
  }
14168
14168
  }
@@ -14172,10 +14172,10 @@ var load2 = {
14172
14172
  impl: ({ ACTION, SUBRULE1, CONSUME, OPTION1, OPTION2 }) => (C) => {
14173
14173
  const loadToken = CONSUME(load);
14174
14174
  const silent2 = OPTION1(() => CONSUME(silent));
14175
- const source = SUBRULE1(iri2, void 0);
14175
+ const source = SUBRULE1(iri2);
14176
14176
  const destination = OPTION2(() => {
14177
14177
  CONSUME(loadInto);
14178
- return SUBRULE1(graphRef, void 0);
14178
+ return SUBRULE1(graphRef);
14179
14179
  });
14180
14180
  return ACTION(() => C.factory.updateOperationLoad(
14181
14181
  C.factory.sourceLocation(loadToken, source, destination),
@@ -14191,10 +14191,10 @@ var load2 = {
14191
14191
  PRINT_WORD("SILENT");
14192
14192
  }
14193
14193
  });
14194
- SUBRULE(iri2, ast.source, void 0);
14194
+ SUBRULE(iri2, ast.source);
14195
14195
  if (ast.destination) {
14196
14196
  F3.printFilter(ast, () => PRINT_WORD("INTO"));
14197
- SUBRULE(graphRefAll, ast.destination, void 0);
14197
+ SUBRULE(graphRefAll, ast.destination);
14198
14198
  }
14199
14199
  }
14200
14200
  };
@@ -14204,7 +14204,7 @@ function clearOrDrop(operation) {
14204
14204
  impl: ({ ACTION, SUBRULE1, CONSUME, OPTION }) => (C) => {
14205
14205
  const opToken = CONSUME(operation);
14206
14206
  const silent2 = OPTION(() => CONSUME(silent));
14207
- const destination = SUBRULE1(graphRefAll, void 0);
14207
+ const destination = SUBRULE1(graphRefAll);
14208
14208
  return ACTION(() => C.factory.updateOperationClearDrop(
14209
14209
  unCapitalize(operation.name),
14210
14210
  Boolean(silent2),
@@ -14219,7 +14219,7 @@ function clearOrDrop(operation) {
14219
14219
  PRINT_WORD("SILENT");
14220
14220
  }
14221
14221
  });
14222
- SUBRULE(graphRefAll, ast.destination, void 0);
14222
+ SUBRULE(graphRefAll, ast.destination);
14223
14223
  }
14224
14224
  };
14225
14225
  }
@@ -14230,7 +14230,7 @@ var create2 = {
14230
14230
  impl: ({ ACTION, SUBRULE1, CONSUME, OPTION }) => (C) => {
14231
14231
  const createToken3 = CONSUME(create);
14232
14232
  const silent2 = OPTION(() => CONSUME(silent));
14233
- const destination = SUBRULE1(graphRef, void 0);
14233
+ const destination = SUBRULE1(graphRef);
14234
14234
  return ACTION(() => C.factory.updateOperationCreate(
14235
14235
  destination,
14236
14236
  Boolean(silent2),
@@ -14244,7 +14244,7 @@ var create2 = {
14244
14244
  PRINT_WORD("SILENT");
14245
14245
  }
14246
14246
  });
14247
- SUBRULE(graphRefAll, ast.destination, void 0);
14247
+ SUBRULE(graphRefAll, ast.destination);
14248
14248
  }
14249
14249
  };
14250
14250
  function copyMoveAddOperation(operation) {
@@ -14253,9 +14253,9 @@ function copyMoveAddOperation(operation) {
14253
14253
  impl: ({ ACTION, CONSUME, SUBRULE1, SUBRULE2, OPTION }) => (C) => {
14254
14254
  const op = CONSUME(operation);
14255
14255
  const silent2 = OPTION(() => CONSUME(silent));
14256
- const source = SUBRULE1(graphOrDefault, void 0);
14256
+ const source = SUBRULE1(graphOrDefault);
14257
14257
  CONSUME(to);
14258
- const destination = SUBRULE2(graphOrDefault, void 0);
14258
+ const destination = SUBRULE2(graphOrDefault);
14259
14259
  return ACTION(() => C.factory.updateOperationAddMoveCopy(
14260
14260
  unCapitalize(operation.name),
14261
14261
  source,
@@ -14271,9 +14271,9 @@ function copyMoveAddOperation(operation) {
14271
14271
  PRINT_WORD("SILENT");
14272
14272
  }
14273
14273
  });
14274
- SUBRULE(graphRefAll, ast.source, void 0);
14274
+ SUBRULE(graphRefAll, ast.source);
14275
14275
  F3.printFilter(ast, () => PRINT_WORD("TO"));
14276
- SUBRULE(graphRefAll, ast.destination, void 0);
14276
+ SUBRULE(graphRefAll, ast.destination);
14277
14277
  }
14278
14278
  };
14279
14279
  }
@@ -14284,7 +14284,7 @@ var quadPattern = {
14284
14284
  name: "quadPattern",
14285
14285
  impl: ({ ACTION, SUBRULE1, CONSUME }) => (C) => {
14286
14286
  const open = CONSUME(symbols_exports.LCurly);
14287
- const val = SUBRULE1(quads, void 0);
14287
+ const val = SUBRULE1(quads);
14288
14288
  const close = CONSUME(symbols_exports.RCurly);
14289
14289
  return ACTION(() => C.factory.wrap(val.val, C.factory.sourceLocation(open, close)));
14290
14290
  }
@@ -14294,7 +14294,7 @@ var quadData = {
14294
14294
  impl: ({ ACTION, SUBRULE1, CONSUME }) => (C) => {
14295
14295
  const open = CONSUME(symbols_exports.LCurly);
14296
14296
  const couldParseVars = ACTION(() => C.parseMode.delete("canParseVars"));
14297
- const val = SUBRULE1(quads, void 0);
14297
+ const val = SUBRULE1(quads);
14298
14298
  ACTION(() => couldParseVars && C.parseMode.add("canParseVars"));
14299
14299
  const close = CONSUME(symbols_exports.RCurly);
14300
14300
  return ACTION(() => C.factory.wrap(val.val, C.factory.sourceLocation(open, close)));
@@ -14310,7 +14310,7 @@ function insertDeleteDelWhere(name, subType, cons1, cons2, dataRule) {
14310
14310
  if (name !== "insertData") {
14311
14311
  couldCreateBlankNodes = ACTION(() => C.parseMode.delete("canCreateBlankNodes"));
14312
14312
  }
14313
- const data = SUBRULE1(dataRule, void 0);
14313
+ const data = SUBRULE1(dataRule);
14314
14314
  if (name !== "insertData") {
14315
14315
  ACTION(() => couldCreateBlankNodes && C.parseMode.add("canCreateBlankNodes"));
14316
14316
  }
@@ -14321,7 +14321,7 @@ function insertDeleteDelWhere(name, subType, cons1, cons2, dataRule) {
14321
14321
  subType === "insertdata" ? "INSERT DATA" : subType === "deletedata" ? "DELETE DATA" : "DELETE WHERE",
14322
14322
  "{"
14323
14323
  ));
14324
- SUBRULE(quads, F3.wrap(ast.data, ast.loc), void 0);
14324
+ SUBRULE(quads, F3.wrap(ast.data, ast.loc));
14325
14325
  F3.printFilter(ast, () => PRINT_WORD("}"));
14326
14326
  }
14327
14327
  };
@@ -14334,23 +14334,23 @@ var modify = {
14334
14334
  impl: ({ ACTION, CONSUME, SUBRULE1, SUBRULE2, OPTION1, OPTION2, OR }) => (C) => {
14335
14335
  const graph2 = OPTION1(() => {
14336
14336
  const withToken = CONSUME(modifyWith);
14337
- const graph3 = SUBRULE1(iri2, void 0);
14337
+ const graph3 = SUBRULE1(iri2);
14338
14338
  return { withToken, graph: graph3 };
14339
14339
  });
14340
14340
  const { insert, del } = OR([
14341
14341
  { ALT: () => {
14342
- const del2 = SUBRULE1(deleteClause2, void 0);
14343
- const insert2 = OPTION2(() => SUBRULE1(insertClause2, void 0));
14342
+ const del2 = SUBRULE1(deleteClause2);
14343
+ const insert2 = OPTION2(() => SUBRULE1(insertClause2));
14344
14344
  return { del: del2, insert: insert2 };
14345
14345
  } },
14346
14346
  { ALT: () => {
14347
- const insert2 = SUBRULE2(insertClause2, void 0);
14347
+ const insert2 = SUBRULE2(insertClause2);
14348
14348
  return { insert: insert2, del: void 0 };
14349
14349
  } }
14350
14350
  ]);
14351
- const using = SUBRULE1(usingClauseStar, void 0);
14351
+ const using = SUBRULE1(usingClauseStar);
14352
14352
  CONSUME(where);
14353
- const where2 = SUBRULE1(groupGraphPattern, void 0);
14353
+ const where2 = SUBRULE1(groupGraphPattern);
14354
14354
  return ACTION(() => C.factory.updateOperationModify(
14355
14355
  C.factory.sourceLocation(graph2?.withToken, del, insert, where2),
14356
14356
  insert?.val ?? [],
@@ -14363,21 +14363,21 @@ var modify = {
14363
14363
  gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F3 }) => {
14364
14364
  if (ast.graph) {
14365
14365
  F3.printFilter(ast, () => PRINT_WORD("WITH"));
14366
- SUBRULE(iri2, ast.graph, void 0);
14366
+ SUBRULE(iri2, ast.graph);
14367
14367
  }
14368
14368
  if (ast.delete.length > 0) {
14369
14369
  F3.printFilter(ast, () => PRINT_WORD("DELETE", "{"));
14370
- SUBRULE(quads, F3.wrap(ast.delete, ast.loc), void 0);
14370
+ SUBRULE(quads, F3.wrap(ast.delete, ast.loc));
14371
14371
  F3.printFilter(ast, () => PRINT_WORD("}"));
14372
14372
  }
14373
14373
  if (ast.insert.length > 0) {
14374
14374
  F3.printFilter(ast, () => PRINT_WORD("INSERT", "{"));
14375
- SUBRULE(quads, F3.wrap(ast.insert, ast.loc), void 0);
14375
+ SUBRULE(quads, F3.wrap(ast.insert, ast.loc));
14376
14376
  F3.printFilter(ast, () => PRINT_WORD("}"));
14377
14377
  }
14378
- SUBRULE(usingClauseStar, ast.from, void 0);
14378
+ SUBRULE(usingClauseStar, ast.from);
14379
14379
  F3.printFilter(ast, () => PRINT_WORD("WHERE"));
14380
- SUBRULE(groupGraphPattern, ast.where, void 0);
14380
+ SUBRULE(groupGraphPattern, ast.where);
14381
14381
  }
14382
14382
  };
14383
14383
  var deleteClause2 = {
@@ -14385,7 +14385,7 @@ var deleteClause2 = {
14385
14385
  impl: ({ ACTION, SUBRULE, CONSUME }) => (C) => {
14386
14386
  const delToken = CONSUME(deleteClause);
14387
14387
  const couldCreateBlankNodes = ACTION(() => C.parseMode.delete("canCreateBlankNodes"));
14388
- const del = SUBRULE(quadPattern, void 0);
14388
+ const del = SUBRULE(quadPattern);
14389
14389
  ACTION(() => couldCreateBlankNodes && C.parseMode.add("canCreateBlankNodes"));
14390
14390
  return ACTION(() => C.factory.wrap(del.val, C.factory.sourceLocation(delToken, del)));
14391
14391
  }
@@ -14394,7 +14394,7 @@ var insertClause2 = {
14394
14394
  name: "insertClause",
14395
14395
  impl: ({ ACTION, SUBRULE, CONSUME }) => (C) => {
14396
14396
  const insertToken = CONSUME(insertClause);
14397
- const insert = SUBRULE(quadPattern, void 0);
14397
+ const insert = SUBRULE(quadPattern);
14398
14398
  return ACTION(() => C.factory.wrap(insert.val, C.factory.sourceLocation(insertToken, insert)));
14399
14399
  }
14400
14400
  };
@@ -14407,7 +14407,7 @@ var graphOrDefault = {
14407
14407
  } },
14408
14408
  { ALT: () => {
14409
14409
  const graph2 = OPTION(() => CONSUME(graph_exports.graph));
14410
- const name = SUBRULE1(iri2, void 0);
14410
+ const name = SUBRULE1(iri2);
14411
14411
  return ACTION(() => C.factory.graphRefSpecific(name, C.factory.sourceLocation(graph2, name)));
14412
14412
  } }
14413
14413
  ])
@@ -14416,18 +14416,18 @@ var graphRef = {
14416
14416
  name: "graphRef",
14417
14417
  impl: ({ ACTION, SUBRULE, CONSUME }) => (C) => {
14418
14418
  const graph2 = CONSUME(graph_exports.graph);
14419
- const val = SUBRULE(iri2, void 0);
14419
+ const val = SUBRULE(iri2);
14420
14420
  return ACTION(() => C.factory.graphRefSpecific(val, C.factory.sourceLocation(graph2, val)));
14421
14421
  },
14422
14422
  gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F3 }) => {
14423
14423
  F3.printFilter(ast, () => PRINT_WORD("GRAPH"));
14424
- SUBRULE(iri2, ast.graph, void 0);
14424
+ SUBRULE(iri2, ast.graph);
14425
14425
  }
14426
14426
  };
14427
14427
  var graphRefAll = {
14428
14428
  name: "graphRefAll",
14429
14429
  impl: ({ ACTION, SUBRULE, CONSUME, OR }) => (C) => OR([
14430
- { ALT: () => SUBRULE(graphRef, void 0) },
14430
+ { ALT: () => SUBRULE(graphRef) },
14431
14431
  { ALT: () => {
14432
14432
  const def = CONSUME(graph_exports.default_);
14433
14433
  return ACTION(() => C.factory.graphRefDefault(C.factory.sourceLocation(def)));
@@ -14443,7 +14443,7 @@ var graphRefAll = {
14443
14443
  ]),
14444
14444
  gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F3 }) => {
14445
14445
  if (F3.isGraphRefSpecific(ast)) {
14446
- SUBRULE(graphRef, ast, void 0);
14446
+ SUBRULE(graphRef, ast);
14447
14447
  } else if (F3.isGraphRefDefault(ast)) {
14448
14448
  F3.printFilter(ast, () => PRINT_WORD("DEFAULT"));
14449
14449
  } else if (F3.isGraphRefNamed(ast)) {
@@ -14459,12 +14459,12 @@ var quads = {
14459
14459
  const quads2 = [];
14460
14460
  let last2;
14461
14461
  OPTION1(() => {
14462
- const triples = SUBRULE1(triplesTemplate, void 0);
14462
+ const triples = SUBRULE1(triplesTemplate);
14463
14463
  last2 = triples;
14464
14464
  ACTION(() => quads2.push(triples));
14465
14465
  });
14466
14466
  MANY(() => {
14467
- const notTriples = SUBRULE(quadsNotTriples, void 0);
14467
+ const notTriples = SUBRULE(quadsNotTriples);
14468
14468
  last2 = notTriples;
14469
14469
  quads2.push(notTriples);
14470
14470
  OPTION2(() => {
@@ -14473,7 +14473,7 @@ var quads = {
14473
14473
  return dotToken;
14474
14474
  });
14475
14475
  OPTION3(() => {
14476
- const triples = SUBRULE2(triplesTemplate, void 0);
14476
+ const triples = SUBRULE2(triplesTemplate);
14477
14477
  last2 = triples;
14478
14478
  ACTION(() => quads2.push(triples));
14479
14479
  });
@@ -14483,9 +14483,9 @@ var quads = {
14483
14483
  gImpl: ({ SUBRULE }) => (ast, { factory: F3 }) => {
14484
14484
  for (const quad of ast.val) {
14485
14485
  if (F3.isPattern(quad)) {
14486
- SUBRULE(triplesBlock, quad, void 0);
14486
+ SUBRULE(triplesBlock, quad);
14487
14487
  } else {
14488
- SUBRULE(quadsNotTriples, quad, void 0);
14488
+ SUBRULE(quadsNotTriples, quad);
14489
14489
  }
14490
14490
  }
14491
14491
  }
@@ -14494,9 +14494,9 @@ var quadsNotTriples = {
14494
14494
  name: "quadsNotTriples",
14495
14495
  impl: ({ ACTION, SUBRULE1, CONSUME, OPTION }) => (C) => {
14496
14496
  const graph2 = CONSUME(graph_exports.graph);
14497
- const name = SUBRULE1(varOrIri, void 0);
14497
+ const name = SUBRULE1(varOrIri);
14498
14498
  CONSUME(symbols_exports.LCurly);
14499
- const triples = OPTION(() => SUBRULE1(triplesTemplate, void 0));
14499
+ const triples = OPTION(() => SUBRULE1(triplesTemplate));
14500
14500
  const close = CONSUME(symbols_exports.RCurly);
14501
14501
  return ACTION(() => C.factory.graphQuads(
14502
14502
  name,
@@ -14506,31 +14506,93 @@ var quadsNotTriples = {
14506
14506
  },
14507
14507
  gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F3 }) => {
14508
14508
  F3.printFilter(ast, () => PRINT_WORD("GRAPH"));
14509
- SUBRULE(varOrTerm, ast.graph, void 0);
14509
+ SUBRULE(varOrTerm, ast.graph);
14510
14510
  F3.printFilter(ast, () => PRINT_WORD("{"));
14511
- SUBRULE(triplesBlock, ast.triples, void 0);
14511
+ SUBRULE(triplesBlock, ast.triples);
14512
14512
  F3.printFilter(ast, () => PRINT_WORD("}"));
14513
14513
  }
14514
14514
  };
14515
14515
 
14516
+ // ../rules-sparql-1-1/lib/grammar/index.ts
14517
+ var queryOrUpdate = {
14518
+ name: "queryOrUpdate",
14519
+ impl: ({ ACTION, SUBRULE, OR1, OR2, MANY, OPTION1, CONSUME, SUBRULE2 }) => (C) => {
14520
+ const prologueValues = SUBRULE(prologue);
14521
+ return OR1([
14522
+ { ALT: () => {
14523
+ const subType = OR2([
14524
+ { ALT: () => SUBRULE(selectQuery) },
14525
+ { ALT: () => SUBRULE(constructQuery) },
14526
+ { ALT: () => SUBRULE(describeQuery) },
14527
+ { ALT: () => SUBRULE(askQuery) }
14528
+ ]);
14529
+ const values3 = SUBRULE(valuesClause);
14530
+ return ACTION(() => ({
14531
+ context: prologueValues,
14532
+ ...subType,
14533
+ type: "query",
14534
+ ...values3 && { values: values3 },
14535
+ loc: C.factory.sourceLocation(
14536
+ prologueValues.at(0),
14537
+ subType,
14538
+ values3
14539
+ )
14540
+ }));
14541
+ } },
14542
+ { ALT: () => {
14543
+ const updates = [];
14544
+ updates.push({ context: prologueValues });
14545
+ let parsedSemi = true;
14546
+ MANY({
14547
+ GATE: () => parsedSemi,
14548
+ DEF: () => {
14549
+ parsedSemi = false;
14550
+ updates.at(-1).operation = SUBRULE(update1);
14551
+ OPTION1(() => {
14552
+ CONSUME(symbols_exports.semi);
14553
+ parsedSemi = true;
14554
+ const innerPrologue = SUBRULE2(prologue);
14555
+ updates.push({ context: innerPrologue });
14556
+ });
14557
+ }
14558
+ });
14559
+ return ACTION(() => {
14560
+ const update2 = {
14561
+ type: "update",
14562
+ updates,
14563
+ loc: C.factory.sourceLocation(
14564
+ ...updates[0].context,
14565
+ updates[0].operation,
14566
+ ...updates.at(-1).context,
14567
+ updates.at(-1)?.operation
14568
+ )
14569
+ };
14570
+ updateNoReuseBlankNodeLabels(update2);
14571
+ return update2;
14572
+ });
14573
+ } }
14574
+ ]);
14575
+ }
14576
+ };
14577
+
14516
14578
  // lib/lexer.ts
14517
14579
  var lexer_exports2 = {};
14518
14580
  __export(lexer_exports2, {
14519
14581
  LANG_DIR: () => LANG_DIR,
14520
14582
  annotationClose: () => annotationClose,
14521
14583
  annotationOpen: () => annotationOpen,
14522
- builtinHasLang: () => builtinHasLang,
14523
- builtinHasLangDir: () => builtinHasLangDir,
14524
- builtinIsTRIPLE: () => builtinIsTRIPLE,
14525
- builtinLangDir: () => builtinLangDir,
14526
- builtinOBJECT: () => builtinOBJECT,
14527
- builtinPREDICATE: () => builtinPREDICATE,
14528
- builtinSUBJECT: () => builtinSUBJECT,
14529
- builtinStrLangDir: () => builtinStrLangDir,
14530
- builtinTRIPLE: () => builtinTRIPLE,
14584
+ buildInHasLang: () => buildInHasLang,
14585
+ buildInHasLangDir: () => buildInHasLangDir,
14586
+ buildInIsTRIPLE: () => buildInIsTRIPLE,
14587
+ buildInLangDir: () => buildInLangDir,
14588
+ buildInOBJECT: () => buildInOBJECT,
14589
+ buildInPREDICATE: () => buildInPREDICATE,
14590
+ buildInSUBJECT: () => buildInSUBJECT,
14591
+ buildInStrLangDir: () => buildInStrLangDir,
14592
+ buildInTRIPLE: () => buildInTRIPLE,
14531
14593
  reificationClose: () => reificationClose,
14532
14594
  reificationOpen: () => reificationOpen,
14533
- sparql12Tokens: () => sparql12Tokens,
14595
+ sparql12LexerBuilder: () => sparql12LexerBuilder,
14534
14596
  tilde: () => tilde,
14535
14597
  tripleTermClose: () => tripleTermClose,
14536
14598
  tripleTermOpen: () => tripleTermOpen,
@@ -14544,29 +14606,29 @@ var reificationOpen = createToken2({ name: "ReificationOpen", pattern: "<<", lab
14544
14606
  var reificationClose = createToken2({ name: "ReificationClose", pattern: ">>", label: "Reification close >>" });
14545
14607
  var tripleTermOpen = createToken2({ name: "TripleTermOpen", pattern: "<<(", label: "Triple Term Open <<(" });
14546
14608
  var tripleTermClose = createToken2({ name: "TripleTermClose", pattern: ")>>", label: "Triple Term Close )>>" });
14547
- var builtinLangDir = createToken2({ name: "BuiltInLangdir", pattern: /langdir/i, label: "LANGDIR" });
14548
- var builtinStrLangDir = createToken2({
14609
+ var buildInLangDir = createToken2({ name: "BuiltInLangdir", pattern: /langdir/i, label: "LANGDIR" });
14610
+ var buildInStrLangDir = createToken2({
14549
14611
  name: "BuiltInStrLangdir",
14550
14612
  pattern: /strlangdir/i,
14551
14613
  label: "STRLANGDIR"
14552
14614
  });
14553
- var builtinHasLang = createToken2({ name: "BuiltInHasLang", pattern: /haslang/i, label: "hasLANG" });
14554
- var builtinHasLangDir = createToken2({
14615
+ var buildInHasLang = createToken2({ name: "BuiltInHasLang", pattern: /haslang/i, label: "hasLANG" });
14616
+ var buildInHasLangDir = createToken2({
14555
14617
  name: "BuiltInHasLangdir",
14556
14618
  pattern: /haslangdir/i,
14557
14619
  label: "hasLANGDIR"
14558
14620
  });
14559
- var builtinIsTRIPLE = createToken2({ name: "BuiltInIsTriple", pattern: /istriple/i, label: "isTRIPLE" });
14560
- var builtinTRIPLE = createToken2({ name: "BuiltInTriple", pattern: /triple/i, label: "TRIPLE" });
14561
- var builtinSUBJECT = createToken2({ name: "BuiltInSubject", pattern: /subject/i, label: "SUBJECT" });
14562
- var builtinPREDICATE = createToken2({ name: "BuiltInPredicate", pattern: /predicate/i, label: "PREDICATE" });
14563
- var builtinOBJECT = createToken2({ name: "BuiltInObject", pattern: /object/i, label: "OBJECT" });
14621
+ var buildInIsTRIPLE = createToken2({ name: "BuiltInIsTriple", pattern: /istriple/i, label: "isTRIPLE" });
14622
+ var buildInTRIPLE = createToken2({ name: "BuiltInTriple", pattern: /triple/i, label: "TRIPLE" });
14623
+ var buildInSUBJECT = createToken2({ name: "BuiltInSubject", pattern: /subject/i, label: "SUBJECT" });
14624
+ var buildInPREDICATE = createToken2({ name: "BuiltInPredicate", pattern: /predicate/i, label: "PREDICATE" });
14625
+ var buildInOBJECT = createToken2({ name: "BuiltInObject", pattern: /object/i, label: "OBJECT" });
14564
14626
  var LANG_DIR = createToken2({
14565
14627
  name: "LANG_DIR",
14566
14628
  pattern: /@[a-z]+(?:-[\da-z]+)*(?:--[a-z]+)?/i,
14567
14629
  label: "LANG_DIR"
14568
14630
  });
14569
- var sparql12Tokens = LexerBuilder.create(lexer_exports.sparql11Tokens).addBefore(
14631
+ var sparql12LexerBuilder = LexerBuilder.create(lexer_exports.sparql11LexerBuilder).addBefore(
14570
14632
  lexer_exports.symbols.logicAnd,
14571
14633
  tilde,
14572
14634
  annotationOpen,
@@ -14578,15 +14640,15 @@ var sparql12Tokens = LexerBuilder.create(lexer_exports.sparql11Tokens).addBefore
14578
14640
  version
14579
14641
  ).addBefore(
14580
14642
  lexer_exports.builtIn.langmatches,
14581
- builtinLangDir,
14582
- builtinStrLangDir,
14583
- builtinHasLangDir,
14584
- builtinHasLang,
14585
- builtinIsTRIPLE,
14586
- builtinTRIPLE,
14587
- builtinSUBJECT,
14588
- builtinPREDICATE,
14589
- builtinOBJECT
14643
+ buildInLangDir,
14644
+ buildInStrLangDir,
14645
+ buildInHasLangDir,
14646
+ buildInHasLang,
14647
+ buildInIsTRIPLE,
14648
+ buildInTRIPLE,
14649
+ buildInSUBJECT,
14650
+ buildInPREDICATE,
14651
+ buildInOBJECT
14590
14652
  ).addBefore(lexer_exports.terminals.langTag, LANG_DIR).delete(lexer_exports.terminals.langTag);
14591
14653
 
14592
14654
  // lib/validator.ts
@@ -14594,7 +14656,7 @@ var F2 = new Factory();
14594
14656
  function isLangDir(dir) {
14595
14657
  return dir === "ltr" || dir === "rtl";
14596
14658
  }
14597
- function langTagHasCorrectDomain(literal) {
14659
+ function langTagHasCorrectRange(literal) {
14598
14660
  if (F2.isTermLiteralLangStr(literal)) {
14599
14661
  const dirSplit = literal.langOrIri.split("--");
14600
14662
  if (dirSplit.length > 1) {
@@ -14611,7 +14673,7 @@ var versionDecl = {
14611
14673
  name: "versionDecl",
14612
14674
  impl: ({ ACTION, SUBRULE, CONSUME }) => (C) => {
14613
14675
  const versionToken = CONSUME(version);
14614
- const identifier = SUBRULE(versionSpecifier, void 0);
14676
+ const identifier = SUBRULE(versionSpecifier);
14615
14677
  return ACTION(() => C.factory.contextDefinitionVersion(identifier.val, C.factory.sourceLocation(versionToken, identifier)));
14616
14678
  },
14617
14679
  gImpl: ({ PRINT_WORDS }) => (ast, { factory: F3 }) => {
@@ -14635,22 +14697,22 @@ var prologue2 = {
14635
14697
  impl: ({ SUBRULE, MANY, OR }) => () => {
14636
14698
  const result = [];
14637
14699
  MANY(() => OR([
14638
- { ALT: () => result.push(SUBRULE(grammar_exports.baseDecl, void 0)) },
14700
+ { ALT: () => result.push(SUBRULE(grammar_exports.baseDecl)) },
14639
14701
  // TODO: the [spec](https://www.w3.org/TR/sparql11-query/#iriRefs) says you cannot redefine prefixes.
14640
14702
  // We might need to check this.
14641
- { ALT: () => result.push(SUBRULE(grammar_exports.prefixDecl, void 0)) },
14642
- { ALT: () => result.push(SUBRULE(versionDecl, void 0)) }
14703
+ { ALT: () => result.push(SUBRULE(grammar_exports.prefixDecl)) },
14704
+ { ALT: () => result.push(SUBRULE(versionDecl)) }
14643
14705
  ]));
14644
14706
  return result;
14645
14707
  },
14646
14708
  gImpl: ({ SUBRULE }) => (ast, { factory: F3 }) => {
14647
14709
  for (const context of ast) {
14648
14710
  if (F3.isContextDefinitionBase(context)) {
14649
- SUBRULE(grammar_exports.baseDecl, context, void 0);
14711
+ SUBRULE(grammar_exports.baseDecl, context);
14650
14712
  } else if (F3.isContextDefinitionPrefix(context)) {
14651
- SUBRULE(grammar_exports.prefixDecl, context, void 0);
14713
+ SUBRULE(grammar_exports.prefixDecl, context);
14652
14714
  } else if (F3.isContextDefinitionVersion(context)) {
14653
- SUBRULE(versionDecl, context, void 0);
14715
+ SUBRULE(versionDecl, context);
14654
14716
  }
14655
14717
  }
14656
14718
  }
@@ -14659,10 +14721,10 @@ function reifiedTripleBlockImpl(name, allowPath) {
14659
14721
  return {
14660
14722
  name,
14661
14723
  impl: ({ ACTION, SUBRULE }) => (C) => {
14662
- const triple = SUBRULE(reifiedTriple, void 0);
14724
+ const triple = SUBRULE(reifiedTriple);
14663
14725
  const properties = SUBRULE(
14664
14726
  allowPath ? grammar_exports.propertyListPath : grammar_exports.propertyList,
14665
- { subject: ACTION(() => C.factory.dematerialized(triple.identifier)) }
14727
+ ACTION(() => C.factory.dematerialized(triple.identifier))
14666
14728
  );
14667
14729
  return ACTION(() => [triple, ...properties]);
14668
14730
  }
@@ -14673,37 +14735,40 @@ var reifiedTripleBlockPath = reifiedTripleBlockImpl("reifiedTripleBlockPath", tr
14673
14735
  var dataBlockValue2 = {
14674
14736
  name: "dataBlockValue",
14675
14737
  impl: ($) => (C) => $.OR2([
14676
- { ALT: () => grammar_exports.dataBlockValue.impl($)(C, void 0) },
14677
- { ALT: () => $.SUBRULE(tripleTermData, void 0) }
14738
+ { ALT: () => grammar_exports.dataBlockValue.impl($)(C) },
14739
+ { ALT: () => $.SUBRULE(tripleTermData) }
14678
14740
  ])
14679
14741
  };
14680
14742
  var reifier = {
14681
14743
  name: "reifier",
14682
14744
  impl: ({ ACTION, CONSUME, SUBRULE, OPTION }) => (C) => {
14683
- CONSUME(tilde);
14684
- const reifier2 = OPTION(() => SUBRULE(varOrReifierId, void 0));
14745
+ const tildeToken = CONSUME(tilde);
14746
+ const reifier2 = OPTION(() => SUBRULE(varOrReifierId));
14685
14747
  return ACTION(() => {
14686
14748
  if (reifier2 === void 0 && !C.parseMode.has("canCreateBlankNodes")) {
14687
14749
  throw new Error("Cannot create blanknodes in current parse mode");
14688
14750
  }
14689
- return reifier2 ?? C.factory.blankNode(void 0, C.factory.sourceLocation());
14751
+ return C.factory.wrap(
14752
+ reifier2 ?? C.factory.blankNode(void 0, C.factory.sourceLocation()),
14753
+ C.factory.sourceLocation(tildeToken, reifier2)
14754
+ );
14690
14755
  });
14691
14756
  }
14692
14757
  };
14693
14758
  var varOrReifierId = {
14694
14759
  name: "varOrReifierId",
14695
14760
  impl: ({ SUBRULE, OR }) => (C) => OR([
14696
- { GATE: () => C.parseMode.has("canParseVars"), ALT: () => SUBRULE(grammar_exports.var_, void 0) },
14697
- { ALT: () => SUBRULE(grammar_exports.iri, void 0) },
14698
- { ALT: () => SUBRULE(grammar_exports.blankNode, void 0) }
14761
+ { GATE: () => C.parseMode.has("canParseVars"), ALT: () => SUBRULE(grammar_exports.var_) },
14762
+ { ALT: () => SUBRULE(grammar_exports.iri) },
14763
+ { ALT: () => SUBRULE(grammar_exports.blankNode) }
14699
14764
  ])
14700
14765
  };
14701
14766
  function triplesSameSubjectImpl2(name, allowPaths) {
14702
14767
  return {
14703
14768
  name,
14704
14769
  impl: ($) => (C) => $.OR2([
14705
- { ALT: () => allowPaths ? grammar_exports.triplesSameSubjectPath.impl($)(C, void 0) : grammar_exports.triplesSameSubject.impl($)(C, void 0) },
14706
- { ALT: () => $.SUBRULE(allowPaths ? reifiedTripleBlockPath : reifiedTripleBlock, void 0) }
14770
+ { ALT: () => allowPaths ? grammar_exports.triplesSameSubjectPath.impl($)(C) : grammar_exports.triplesSameSubject.impl($)(C) },
14771
+ { ALT: () => $.SUBRULE(allowPaths ? reifiedTripleBlockPath : reifiedTripleBlock) }
14707
14772
  ])
14708
14773
  };
14709
14774
  }
@@ -14712,11 +14777,10 @@ var triplesSameSubjectPath2 = triplesSameSubjectImpl2("triplesSameSubjectPath",
14712
14777
  function objectImpl2(name, allowPaths) {
14713
14778
  return {
14714
14779
  name,
14715
- impl: ({ ACTION, SUBRULE }) => (C, arg) => {
14716
- const objectVal = SUBRULE(allowPaths ? graphNodePath2 : graphNode2, void 0);
14717
- const annotationVal = SUBRULE(allowPaths ? annotationPath : annotation, void 0);
14780
+ impl: ({ ACTION, SUBRULE }) => (C, subject, predicate) => {
14781
+ const objectVal = SUBRULE(allowPaths ? graphNodePath2 : graphNode2);
14782
+ const annotationVal = SUBRULE(allowPaths ? annotationPath : annotation);
14718
14783
  return ACTION(() => {
14719
- const { subject, predicate } = arg;
14720
14784
  const F3 = C.factory;
14721
14785
  if (F3.isPathPure(predicate) && annotationVal.length > 0) {
14722
14786
  throw new Error("Note 17 violation");
@@ -14742,9 +14806,9 @@ function annotationImpl(name, allowPaths) {
14742
14806
  MANY(() => {
14743
14807
  OR([
14744
14808
  { ALT: () => {
14745
- const node = SUBRULE(reifier, void 0);
14809
+ const node = SUBRULE(reifier);
14746
14810
  annotations.push(node);
14747
- currentReifier = node;
14811
+ currentReifier = node.val;
14748
14812
  } },
14749
14813
  { ALT: () => {
14750
14814
  ACTION(() => {
@@ -14768,11 +14832,11 @@ function annotationImpl(name, allowPaths) {
14768
14832
  },
14769
14833
  gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F3 }) => {
14770
14834
  for (const annotation2 of ast) {
14771
- if (F3.isTerm(annotation2)) {
14772
- F3.printFilter(annotation2, () => PRINT_WORD("~"));
14773
- SUBRULE(graphNodePath2, annotation2, void 0);
14835
+ if (F3.isTripleCollectionBlankNodeProperties(annotation2)) {
14836
+ SUBRULE(annotationBlockPath, annotation2);
14774
14837
  } else {
14775
- SUBRULE(annotationBlockPath, annotation2, void 0);
14838
+ F3.printFilter(annotation2, () => PRINT_WORD("~"));
14839
+ SUBRULE(graphNodePath2, annotation2.val);
14776
14840
  }
14777
14841
  }
14778
14842
  }
@@ -14787,7 +14851,7 @@ function annotationBlockImpl(name, allowPaths) {
14787
14851
  const open = CONSUME(annotationOpen);
14788
14852
  const res = SUBRULE(
14789
14853
  allowPaths ? grammar_exports.propertyListPathNotEmpty : grammar_exports.propertyListNotEmpty,
14790
- { subject: arg }
14854
+ arg
14791
14855
  );
14792
14856
  const close = CONSUME(annotationClose);
14793
14857
  return ACTION(() => C.factory.tripleCollectionBlankNodeProperties(
@@ -14801,11 +14865,11 @@ function annotationBlockImpl(name, allowPaths) {
14801
14865
  for (const triple of ast.triples) {
14802
14866
  HANDLE_LOC(triple, () => {
14803
14867
  if (F3.isTerm(triple.predicate)) {
14804
- SUBRULE(graphNodePath2, triple.predicate, void 0);
14868
+ SUBRULE(graphNodePath2, triple.predicate);
14805
14869
  } else {
14806
14870
  SUBRULE(grammar_exports.pathGenerator, triple.predicate, void 0);
14807
14871
  }
14808
- SUBRULE(graphNodePath2, triple.object, void 0);
14872
+ SUBRULE(graphNodePath2, triple.object);
14809
14873
  F3.printFilter(ast, () => PRINT_WORD(";"));
14810
14874
  });
14811
14875
  }
@@ -14818,38 +14882,38 @@ var annotationBlock = annotationBlockImpl("annotationBlock", false);
14818
14882
  var graphNode2 = {
14819
14883
  name: "graphNode",
14820
14884
  impl: ($) => (C) => $.OR2([
14821
- { ALT: () => grammar_exports.graphNode.impl($)(C, void 0) },
14822
- { ALT: () => $.SUBRULE(reifiedTriple, void 0) }
14885
+ { ALT: () => grammar_exports.graphNode.impl($)(C) },
14886
+ { ALT: () => $.SUBRULE(reifiedTriple) }
14823
14887
  ])
14824
14888
  };
14825
14889
  var graphNodePath2 = {
14826
14890
  name: "graphNodePath",
14827
14891
  impl: ($) => (C) => $.OR2([
14828
- { ALT: () => grammar_exports.graphNodePath.impl($)(C, void 0) },
14829
- { ALT: () => $.SUBRULE(reifiedTriple, void 0) }
14892
+ { ALT: () => grammar_exports.graphNodePath.impl($)(C) },
14893
+ { ALT: () => $.SUBRULE(reifiedTriple) }
14830
14894
  ]),
14831
- gImpl: ($) => (ast, C, params) => {
14895
+ gImpl: ($) => (ast, C) => {
14832
14896
  if (C.factory.isTripleCollectionReifiedTriple(ast)) {
14833
- $.SUBRULE(reifiedTriple, ast, void 0);
14897
+ $.SUBRULE(reifiedTriple, ast);
14834
14898
  } else {
14835
- grammar_exports.graphNodePath.gImpl($)(ast, C, params);
14899
+ grammar_exports.graphNodePath.gImpl($)(ast, C);
14836
14900
  }
14837
14901
  }
14838
14902
  };
14839
14903
  var varOrTerm2 = {
14840
14904
  name: "varOrTerm",
14841
14905
  impl: ({ ACTION, SUBRULE, OR, CONSUME }) => (C) => OR([
14842
- { GATE: () => C.parseMode.has("canParseVars"), ALT: () => SUBRULE(grammar_exports.var_, void 0) },
14843
- { ALT: () => SUBRULE(grammar_exports.iri, void 0) },
14844
- { ALT: () => SUBRULE(rdfLiteral2, void 0) },
14845
- { ALT: () => SUBRULE(grammar_exports.numericLiteral, void 0) },
14846
- { ALT: () => SUBRULE(grammar_exports.booleanLiteral, void 0) },
14847
- { ALT: () => SUBRULE(grammar_exports.blankNode, void 0) },
14906
+ { GATE: () => C.parseMode.has("canParseVars"), ALT: () => SUBRULE(grammar_exports.var_) },
14907
+ { ALT: () => SUBRULE(grammar_exports.iri) },
14908
+ { ALT: () => SUBRULE(rdfLiteral2) },
14909
+ { ALT: () => SUBRULE(grammar_exports.numericLiteral) },
14910
+ { ALT: () => SUBRULE(grammar_exports.booleanLiteral) },
14911
+ { ALT: () => SUBRULE(grammar_exports.blankNode) },
14848
14912
  { ALT: () => {
14849
14913
  const token = CONSUME(lexer_exports.terminals.nil);
14850
14914
  return ACTION(() => C.factory.namedNode(C.factory.sourceLocation(token), "http://www.w3.org/1999/02/22-rdf-syntax-ns#nil" /* NIL */));
14851
14915
  } },
14852
- { ALT: () => SUBRULE(tripleTerm, void 0) }
14916
+ { ALT: () => SUBRULE(tripleTerm) }
14853
14917
  ])
14854
14918
  // Generation remains untouched - go through graphTerm
14855
14919
  };
@@ -14857,10 +14921,10 @@ var reifiedTriple = {
14857
14921
  name: "reifiedTriple",
14858
14922
  impl: ({ ACTION, CONSUME, SUBRULE, OPTION }) => (C) => {
14859
14923
  const open = CONSUME(reificationOpen);
14860
- const subject = SUBRULE(reifiedTripleSubject, void 0);
14861
- const predicate = SUBRULE(grammar_exports.verb, void 0);
14862
- const object3 = SUBRULE(reifiedTripleObject, void 0);
14863
- const reifierVal = OPTION(() => SUBRULE(reifier, void 0));
14924
+ const subject = SUBRULE(reifiedTripleSubject);
14925
+ const predicate = SUBRULE(grammar_exports.verb);
14926
+ const object3 = SUBRULE(reifiedTripleObject);
14927
+ const reifierVal = OPTION(() => SUBRULE(reifier));
14864
14928
  const close = CONSUME(reificationClose);
14865
14929
  return ACTION(() => {
14866
14930
  if (reifierVal === void 0 && !C.parseMode.has("canCreateBlankNodes")) {
@@ -14871,35 +14935,35 @@ var reifiedTriple = {
14871
14935
  subject,
14872
14936
  predicate,
14873
14937
  object3,
14874
- reifierVal
14938
+ reifierVal?.val
14875
14939
  );
14876
14940
  });
14877
14941
  },
14878
14942
  gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F3 }) => {
14879
14943
  F3.printFilter(ast, () => PRINT_WORD("<<"));
14880
14944
  const triple = ast.triples[0];
14881
- SUBRULE(graphNodePath2, triple.subject, void 0);
14945
+ SUBRULE(graphNodePath2, triple.subject);
14882
14946
  if (F3.isPathPure(triple.predicate)) {
14883
14947
  SUBRULE(grammar_exports.pathGenerator, triple.predicate, void 0);
14884
14948
  } else {
14885
- SUBRULE(graphNodePath2, triple.predicate, void 0);
14949
+ SUBRULE(graphNodePath2, triple.predicate);
14886
14950
  }
14887
- SUBRULE(graphNodePath2, triple.object, void 0);
14888
- SUBRULE(annotationPath, [ast.identifier], void 0);
14951
+ SUBRULE(graphNodePath2, triple.object);
14952
+ SUBRULE(annotationPath, [F3.wrap(ast.identifier, ast.identifier.loc)]);
14889
14953
  F3.printFilter(ast, () => PRINT_WORD(">>"));
14890
14954
  }
14891
14955
  };
14892
14956
  var reifiedTripleSubject = {
14893
14957
  name: "reifiedTripleSubject",
14894
14958
  impl: ({ OR, SUBRULE }) => (C) => OR([
14895
- { GATE: () => C.parseMode.has("canParseVars"), ALT: () => SUBRULE(grammar_exports.var_, void 0) },
14896
- { ALT: () => SUBRULE(grammar_exports.iri, void 0) },
14897
- { ALT: () => SUBRULE(rdfLiteral2, void 0) },
14898
- { ALT: () => SUBRULE(grammar_exports.numericLiteral, void 0) },
14899
- { ALT: () => SUBRULE(grammar_exports.booleanLiteral, void 0) },
14900
- { ALT: () => SUBRULE(grammar_exports.blankNode, void 0) },
14901
- { ALT: () => SUBRULE(reifiedTriple, void 0) },
14902
- { ALT: () => SUBRULE(tripleTerm, void 0) }
14959
+ { GATE: () => C.parseMode.has("canParseVars"), ALT: () => SUBRULE(grammar_exports.var_) },
14960
+ { ALT: () => SUBRULE(grammar_exports.iri) },
14961
+ { ALT: () => SUBRULE(rdfLiteral2) },
14962
+ { ALT: () => SUBRULE(grammar_exports.numericLiteral) },
14963
+ { ALT: () => SUBRULE(grammar_exports.booleanLiteral) },
14964
+ { ALT: () => SUBRULE(grammar_exports.blankNode) },
14965
+ { ALT: () => SUBRULE(reifiedTriple) },
14966
+ { ALT: () => SUBRULE(tripleTerm) }
14903
14967
  ])
14904
14968
  };
14905
14969
  var reifiedTripleObject = {
@@ -14910,30 +14974,30 @@ var tripleTerm = {
14910
14974
  name: "tripleTerm",
14911
14975
  impl: ({ ACTION, CONSUME, SUBRULE }) => (C) => {
14912
14976
  const open = CONSUME(tripleTermOpen);
14913
- const subject = SUBRULE(tripleTermSubject, void 0);
14914
- const predicate = SUBRULE(grammar_exports.verb, void 0);
14915
- const object3 = SUBRULE(tripleTermObject, void 0);
14977
+ const subject = SUBRULE(tripleTermSubject);
14978
+ const predicate = SUBRULE(grammar_exports.verb);
14979
+ const object3 = SUBRULE(tripleTermObject);
14916
14980
  const close = CONSUME(tripleTermClose);
14917
14981
  return ACTION(() => C.factory.termTriple(subject, predicate, object3, C.factory.sourceLocation(open, close)));
14918
14982
  },
14919
14983
  gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F3 }) => {
14920
14984
  F3.printFilter(ast, () => PRINT_WORD("<<("));
14921
- SUBRULE(graphNodePath2, ast.subject, void 0);
14922
- SUBRULE(graphNodePath2, ast.predicate, void 0);
14923
- SUBRULE(graphNodePath2, ast.object, void 0);
14985
+ SUBRULE(graphNodePath2, ast.subject);
14986
+ SUBRULE(graphNodePath2, ast.predicate);
14987
+ SUBRULE(graphNodePath2, ast.object);
14924
14988
  F3.printFilter(ast, () => PRINT_WORD(")>>"));
14925
14989
  }
14926
14990
  };
14927
14991
  var tripleTermSubject = {
14928
14992
  name: "tripleTermSubject",
14929
14993
  impl: ({ SUBRULE, OR }) => (C) => OR([
14930
- { GATE: () => C.parseMode.has("canParseVars"), ALT: () => SUBRULE(grammar_exports.var_, void 0) },
14931
- { ALT: () => SUBRULE(grammar_exports.iri, void 0) },
14932
- { ALT: () => SUBRULE(rdfLiteral2, void 0) },
14933
- { ALT: () => SUBRULE(grammar_exports.numericLiteral, void 0) },
14934
- { ALT: () => SUBRULE(grammar_exports.booleanLiteral, void 0) },
14935
- { ALT: () => SUBRULE(grammar_exports.blankNode, void 0) },
14936
- { ALT: () => SUBRULE(tripleTerm, void 0) }
14994
+ { GATE: () => C.parseMode.has("canParseVars"), ALT: () => SUBRULE(grammar_exports.var_) },
14995
+ { ALT: () => SUBRULE(grammar_exports.iri) },
14996
+ { ALT: () => SUBRULE(rdfLiteral2) },
14997
+ { ALT: () => SUBRULE(grammar_exports.numericLiteral) },
14998
+ { ALT: () => SUBRULE(grammar_exports.booleanLiteral) },
14999
+ { ALT: () => SUBRULE(grammar_exports.blankNode) },
15000
+ { ALT: () => SUBRULE(tripleTerm) }
14937
15001
  ])
14938
15002
  };
14939
15003
  var tripleTermObject = {
@@ -14944,15 +15008,15 @@ var tripleTermData = {
14944
15008
  name: "tripleTermData",
14945
15009
  impl: ({ ACTION, CONSUME, OR, SUBRULE }) => (C) => {
14946
15010
  const open = CONSUME(tripleTermOpen);
14947
- const subject = SUBRULE(tripleTermDataSubject, void 0);
15011
+ const subject = SUBRULE(tripleTermDataSubject);
14948
15012
  const predicate = OR([
14949
- { ALT: () => SUBRULE(grammar_exports.iri, void 0) },
15013
+ { ALT: () => SUBRULE(grammar_exports.iri) },
14950
15014
  { ALT: () => {
14951
15015
  const token = CONSUME(lexer_exports.a);
14952
15016
  return ACTION(() => C.factory.namedNode(C.factory.sourceLocation(token), "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" /* TYPE */));
14953
15017
  } }
14954
15018
  ]);
14955
- const object3 = SUBRULE(tripleTermDataObject, void 0);
15019
+ const object3 = SUBRULE(tripleTermDataObject);
14956
15020
  const close = CONSUME(tripleTermClose);
14957
15021
  return ACTION(() => C.factory.termTriple(subject, predicate, object3, C.factory.sourceLocation(open, close)));
14958
15022
  }
@@ -14960,11 +15024,11 @@ var tripleTermData = {
14960
15024
  var tripleTermDataSubject = {
14961
15025
  name: "tripleTermDataSubject",
14962
15026
  impl: ({ OR, SUBRULE }) => () => OR([
14963
- { ALT: () => SUBRULE(grammar_exports.iri, void 0) },
14964
- { ALT: () => SUBRULE(rdfLiteral2, void 0) },
14965
- { ALT: () => SUBRULE(grammar_exports.numericLiteral, void 0) },
14966
- { ALT: () => SUBRULE(grammar_exports.booleanLiteral, void 0) },
14967
- { ALT: () => SUBRULE(tripleTermData, void 0) }
15027
+ { ALT: () => SUBRULE(grammar_exports.iri) },
15028
+ { ALT: () => SUBRULE(rdfLiteral2) },
15029
+ { ALT: () => SUBRULE(grammar_exports.numericLiteral) },
15030
+ { ALT: () => SUBRULE(grammar_exports.booleanLiteral) },
15031
+ { ALT: () => SUBRULE(tripleTermData) }
14968
15032
  ])
14969
15033
  };
14970
15034
  var tripleTermDataObject = {
@@ -14974,17 +15038,17 @@ var tripleTermDataObject = {
14974
15038
  var primaryExpression2 = {
14975
15039
  name: "primaryExpression",
14976
15040
  impl: ($) => (C) => $.OR2([
14977
- { ALT: () => grammar_exports.primaryExpression.impl($)(C, void 0) },
14978
- { ALT: () => $.SUBRULE(exprTripleTerm, void 0) }
15041
+ { ALT: () => grammar_exports.primaryExpression.impl($)(C) },
15042
+ { ALT: () => $.SUBRULE(exprTripleTerm) }
14979
15043
  ])
14980
15044
  };
14981
15045
  var exprTripleTerm = {
14982
15046
  name: "exprTripleTerm",
14983
15047
  impl: ({ ACTION, CONSUME, SUBRULE }) => (C) => {
14984
15048
  const open = CONSUME(tripleTermOpen);
14985
- const subject = SUBRULE(exprTripleTermSubject, void 0);
14986
- const predicate = SUBRULE(grammar_exports.verb, void 0);
14987
- const object3 = SUBRULE(exprTripleTermObject, void 0);
15049
+ const subject = SUBRULE(exprTripleTermSubject);
15050
+ const predicate = SUBRULE(grammar_exports.verb);
15051
+ const object3 = SUBRULE(exprTripleTermObject);
14988
15052
  const close = CONSUME(tripleTermClose);
14989
15053
  return ACTION(() => C.factory.termTriple(
14990
15054
  subject,
@@ -14997,46 +15061,46 @@ var exprTripleTerm = {
14997
15061
  var exprTripleTermSubject = {
14998
15062
  name: "exprTripleTermSubject",
14999
15063
  impl: ({ OR, SUBRULE }) => (C) => OR([
15000
- { ALT: () => SUBRULE(grammar_exports.iri, void 0) },
15001
- { ALT: () => SUBRULE(rdfLiteral2, void 0) },
15002
- { ALT: () => SUBRULE(grammar_exports.numericLiteral, void 0) },
15003
- { ALT: () => SUBRULE(grammar_exports.booleanLiteral, void 0) },
15004
- { GATE: () => C.parseMode.has("canParseVars"), ALT: () => SUBRULE(grammar_exports.var_, void 0) },
15005
- { ALT: () => SUBRULE(exprTripleTerm, void 0) }
15064
+ { ALT: () => SUBRULE(grammar_exports.iri) },
15065
+ { ALT: () => SUBRULE(rdfLiteral2) },
15066
+ { ALT: () => SUBRULE(grammar_exports.numericLiteral) },
15067
+ { ALT: () => SUBRULE(grammar_exports.booleanLiteral) },
15068
+ { GATE: () => C.parseMode.has("canParseVars"), ALT: () => SUBRULE(grammar_exports.var_) },
15069
+ { ALT: () => SUBRULE(exprTripleTerm) }
15006
15070
  ])
15007
15071
  };
15008
15072
  var exprTripleTermObject = {
15009
15073
  name: "exprTripleTermObject",
15010
15074
  impl: exprTripleTermSubject.impl
15011
15075
  };
15012
- var builtinLangDir2 = funcExpr1(builtinLangDir);
15013
- var builtinLangStrDir = funcExpr3(builtinStrLangDir);
15014
- var builtinHasLang2 = funcExpr1(builtinHasLang);
15015
- var builtinHasLangDir2 = funcExpr1(builtinHasLangDir);
15016
- var builtinIsTriple = funcExpr1(builtinIsTRIPLE);
15017
- var builtinTriple = funcExpr3(builtinTRIPLE);
15018
- var builtinSubject = funcExpr1(builtinSUBJECT);
15019
- var builtinPredicate = funcExpr1(builtinPREDICATE);
15020
- var builtinObject = funcExpr1(builtinOBJECT);
15076
+ var buildInLangDir2 = funcExpr1(buildInLangDir);
15077
+ var buildInLangStrDir = funcExpr3(buildInStrLangDir);
15078
+ var buildInHasLang2 = funcExpr1(buildInHasLang);
15079
+ var buildInHasLangDir2 = funcExpr1(buildInHasLangDir);
15080
+ var buildInIsTriple = funcExpr1(buildInIsTRIPLE);
15081
+ var buildInTriple = funcExpr3(buildInTRIPLE);
15082
+ var buildInSubject = funcExpr1(buildInSUBJECT);
15083
+ var buildInPredicate = funcExpr1(buildInPREDICATE);
15084
+ var buildInObject = funcExpr1(buildInOBJECT);
15021
15085
  var builtInCall2 = {
15022
15086
  name: "builtInCall",
15023
15087
  impl: ($) => (C) => $.OR2([
15024
- { ALT: () => grammar_exports.builtInCall.impl($)(C, void 0) },
15025
- { ALT: () => $.SUBRULE(builtinLangDir2, void 0) },
15026
- { ALT: () => $.SUBRULE(builtinLangStrDir, void 0) },
15027
- { ALT: () => $.SUBRULE(builtinHasLang2, void 0) },
15028
- { ALT: () => $.SUBRULE(builtinHasLangDir2, void 0) },
15029
- { ALT: () => $.SUBRULE(builtinIsTriple, void 0) },
15030
- { ALT: () => $.SUBRULE(builtinTriple, void 0) },
15031
- { ALT: () => $.SUBRULE(builtinSubject, void 0) },
15032
- { ALT: () => $.SUBRULE(builtinPredicate, void 0) },
15033
- { ALT: () => $.SUBRULE(builtinObject, void 0) }
15088
+ { ALT: () => grammar_exports.builtInCall.impl($)(C) },
15089
+ { ALT: () => $.SUBRULE(buildInLangDir2) },
15090
+ { ALT: () => $.SUBRULE(buildInLangStrDir) },
15091
+ { ALT: () => $.SUBRULE(buildInHasLang2) },
15092
+ { ALT: () => $.SUBRULE(buildInHasLangDir2) },
15093
+ { ALT: () => $.SUBRULE(buildInIsTriple) },
15094
+ { ALT: () => $.SUBRULE(buildInTriple) },
15095
+ { ALT: () => $.SUBRULE(buildInSubject) },
15096
+ { ALT: () => $.SUBRULE(buildInPredicate) },
15097
+ { ALT: () => $.SUBRULE(buildInObject) }
15034
15098
  ])
15035
15099
  };
15036
15100
  var rdfLiteral2 = {
15037
15101
  name: "rdfLiteral",
15038
15102
  impl: ({ ACTION, SUBRULE, OPTION, CONSUME, OR }) => (C) => {
15039
- const value = SUBRULE(grammar_exports.string, void 0);
15103
+ const value = SUBRULE(grammar_exports.string);
15040
15104
  return OPTION(() => OR([
15041
15105
  { ALT: () => {
15042
15106
  const langTag2 = CONSUME(LANG_DIR);
@@ -15046,13 +15110,13 @@ var rdfLiteral2 = {
15046
15110
  value.value,
15047
15111
  langTag2.image.slice(1).toLowerCase()
15048
15112
  );
15049
- langTagHasCorrectDomain(literal);
15113
+ langTagHasCorrectRange(literal);
15050
15114
  return literal;
15051
15115
  });
15052
15116
  } },
15053
15117
  { ALT: () => {
15054
15118
  CONSUME(lexer_exports.symbols.hathat);
15055
- const iriVal = SUBRULE(grammar_exports.iri, void 0);
15119
+ const iriVal = SUBRULE(grammar_exports.iri);
15056
15120
  return ACTION(() => C.factory.literalTerm(
15057
15121
  C.factory.sourceLocation(value, iriVal),
15058
15122
  value.value,
@@ -15069,17 +15133,17 @@ var generateTriplesBlock = {
15069
15133
  HANDLE_LOC(triple, () => {
15070
15134
  const nextTriple = ast.triples.at(index);
15071
15135
  if (F3.isTripleCollection(triple)) {
15072
- SUBRULE(graphNodePath2, triple, void 0);
15136
+ SUBRULE(graphNodePath2, triple);
15073
15137
  F3.printFilter(triple, () => PRINT_WORD("."));
15074
15138
  } else {
15075
- SUBRULE(graphNodePath2, triple.subject, void 0);
15139
+ SUBRULE(graphNodePath2, triple.subject);
15076
15140
  if (F3.isPathPure(triple.predicate)) {
15077
15141
  SUBRULE(grammar_exports.pathGenerator, triple.predicate, void 0);
15078
15142
  } else {
15079
- SUBRULE(graphNodePath2, triple.predicate, void 0);
15143
+ SUBRULE(graphNodePath2, triple.predicate);
15080
15144
  }
15081
- SUBRULE(graphNodePath2, triple.object, void 0);
15082
- SUBRULE(annotationPath, triple.annotations ?? [], void 0);
15145
+ SUBRULE(graphNodePath2, triple.object);
15146
+ SUBRULE(annotationPath, triple.annotations ?? []);
15083
15147
  if (nextTriple === void 0 || F3.isTripleCollection(nextTriple) || !F3.isSourceLocationNoMaterialize(nextTriple.subject.loc)) {
15084
15148
  F3.printFilter(ast, () => PRINT_WORD("."));
15085
15149
  } else if (F3.isSourceLocationNoMaterialize(nextTriple.predicate.loc)) {
@@ -15094,31 +15158,17 @@ var generateTriplesBlock = {
15094
15158
  };
15095
15159
  var generateGraphTerm = {
15096
15160
  name: "graphTerm",
15097
- gImpl: ($) => (ast, C, par) => {
15161
+ gImpl: ($) => (ast, C) => {
15098
15162
  if (C.factory.isTermTriple(ast)) {
15099
- $.SUBRULE(tripleTerm, ast, void 0);
15163
+ $.SUBRULE(tripleTerm, ast);
15100
15164
  } else {
15101
- grammar_exports.graphTerm.gImpl($)(ast, C, par);
15165
+ grammar_exports.graphTerm.gImpl($)(ast, C);
15102
15166
  }
15103
15167
  }
15104
15168
  };
15105
15169
 
15106
15170
  // lib/Factory.ts
15107
15171
  var Factory2 = class extends Factory {
15108
- constructor() {
15109
- super(...arguments);
15110
- /**
15111
- * Overwritten triple constructor to always contain an empty annotations list
15112
- */
15113
- this.triple = (subject, predicate, object3, loc) => ({
15114
- type: "triple",
15115
- subject,
15116
- predicate,
15117
- object: object3,
15118
- annotations: [],
15119
- loc: loc ?? this.sourceLocation(subject, predicate, object3)
15120
- });
15121
- }
15122
15172
  termTriple(subject, predicate, object3, loc) {
15123
15173
  return {
15124
15174
  type: "term",
@@ -15153,6 +15203,17 @@ var Factory2 = class extends Factory {
15153
15203
  loc
15154
15204
  };
15155
15205
  }
15206
+ /**
15207
+ * Overwritten triple constructor to always contain an empty annotations list
15208
+ */
15209
+ triple = (subject, predicate, object3, loc) => ({
15210
+ type: "triple",
15211
+ subject,
15212
+ predicate,
15213
+ object: object3,
15214
+ annotations: [],
15215
+ loc: loc ?? this.sourceLocation(subject, predicate, object3)
15216
+ });
15156
15217
  annotatedTriple(subject, predicate, object3, annotations, loc) {
15157
15218
  return {
15158
15219
  type: "triple",