@traqula/parser-sparql-1-1-adjust 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
@@ -21,8 +21,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
21
21
  var index_exports = {};
22
22
  __export(index_exports, {
23
23
  Parser: () => Parser2,
24
- adjustBuilder: () => adjustBuilder,
25
- lexerBuilder: () => lexerBuilder
24
+ adjustLexerBuilder: () => adjustLexerBuilder,
25
+ adjustParserBuilder: () => adjustParserBuilder
26
26
  });
27
27
  module.exports = __toCommonJS(index_exports);
28
28
 
@@ -354,10 +354,10 @@ var coreJsData = root_default["__core-js_shared__"];
354
354
  var coreJsData_default = coreJsData;
355
355
 
356
356
  // ../../node_modules/lodash-es/_isMasked.js
357
- var maskSrcKey = function() {
357
+ var maskSrcKey = (function() {
358
358
  var uid = /[^.]+$/.exec(coreJsData_default && coreJsData_default.keys && coreJsData_default.keys.IE_PROTO || "");
359
359
  return uid ? "Symbol(src)_1." + uid : "";
360
- }();
360
+ })();
361
361
  function isMasked(func) {
362
362
  return !!maskSrcKey && maskSrcKey in func;
363
363
  }
@@ -419,7 +419,7 @@ var WeakMap_default = WeakMap2;
419
419
 
420
420
  // ../../node_modules/lodash-es/_baseCreate.js
421
421
  var objectCreate = Object.create;
422
- var baseCreate = /* @__PURE__ */ function() {
422
+ var baseCreate = /* @__PURE__ */ (function() {
423
423
  function object2() {
424
424
  }
425
425
  return function(proto) {
@@ -434,7 +434,7 @@ var baseCreate = /* @__PURE__ */ function() {
434
434
  object2.prototype = void 0;
435
435
  return result;
436
436
  };
437
- }();
437
+ })();
438
438
  var baseCreate_default = baseCreate;
439
439
 
440
440
  // ../../node_modules/lodash-es/_apply.js
@@ -499,14 +499,14 @@ function constant(value) {
499
499
  var constant_default = constant;
500
500
 
501
501
  // ../../node_modules/lodash-es/_defineProperty.js
502
- var defineProperty = function() {
502
+ var defineProperty = (function() {
503
503
  try {
504
504
  var func = getNative_default(Object, "defineProperty");
505
505
  func({}, "", {});
506
506
  return func;
507
507
  } catch (e) {
508
508
  }
509
- }();
509
+ })();
510
510
  var defineProperty_default = defineProperty;
511
511
 
512
512
  // ../../node_modules/lodash-es/_baseSetToString.js
@@ -744,9 +744,9 @@ var baseIsArguments_default = baseIsArguments;
744
744
  var objectProto6 = Object.prototype;
745
745
  var hasOwnProperty4 = objectProto6.hasOwnProperty;
746
746
  var propertyIsEnumerable = objectProto6.propertyIsEnumerable;
747
- var isArguments = baseIsArguments_default(/* @__PURE__ */ function() {
747
+ var isArguments = baseIsArguments_default(/* @__PURE__ */ (function() {
748
748
  return arguments;
749
- }()) ? baseIsArguments_default : function(value) {
749
+ })()) ? baseIsArguments_default : function(value) {
750
750
  return isObjectLike_default(value) && hasOwnProperty4.call(value, "callee") && !propertyIsEnumerable.call(value, "callee");
751
751
  };
752
752
  var isArguments_default = isArguments;
@@ -812,7 +812,7 @@ var freeExports2 = typeof exports == "object" && exports && !exports.nodeType &&
812
812
  var freeModule2 = freeExports2 && typeof module == "object" && module && !module.nodeType && module;
813
813
  var moduleExports2 = freeModule2 && freeModule2.exports === freeExports2;
814
814
  var freeProcess = moduleExports2 && freeGlobal_default.process;
815
- var nodeUtil = function() {
815
+ var nodeUtil = (function() {
816
816
  try {
817
817
  var types = freeModule2 && freeModule2.require && freeModule2.require("util").types;
818
818
  if (types) {
@@ -821,7 +821,7 @@ var nodeUtil = function() {
821
821
  return freeProcess && freeProcess.binding && freeProcess.binding("util");
822
822
  } catch (e) {
823
823
  }
824
- }();
824
+ })();
825
825
  var nodeUtil_default = nodeUtil;
826
826
 
827
827
  // ../../node_modules/lodash-es/isTypedArray.js
@@ -9373,6 +9373,7 @@ var EmbeddedActionsParser = class extends Parser {
9373
9373
 
9374
9374
  // ../../packages/core/lib/lexer-builder/LexerBuilder.ts
9375
9375
  var LexerBuilder = class _LexerBuilder {
9376
+ tokens;
9376
9377
  static create(starter) {
9377
9378
  return new _LexerBuilder(starter);
9378
9379
  }
@@ -9469,6 +9470,7 @@ var LexerBuilder = class _LexerBuilder {
9469
9470
 
9470
9471
  // ../../packages/core/lib/parser-builder/dynamicParser.ts
9471
9472
  var DynamicParser = class extends EmbeddedActionsParser {
9473
+ context;
9472
9474
  setContext(context) {
9473
9475
  this.context = context;
9474
9476
  }
@@ -9476,7 +9478,7 @@ var DynamicParser = class extends EmbeddedActionsParser {
9476
9478
  super(tokenVocabulary, {
9477
9479
  // RecoveryEnabled: true,
9478
9480
  maxLookahead: 2,
9479
- // SkipValidations: true,
9481
+ skipValidations: true,
9480
9482
  ...config
9481
9483
  });
9482
9484
  this.context = void 0;
@@ -9491,7 +9493,7 @@ var DynamicParser = class extends EmbeddedActionsParser {
9491
9493
  this.performSelfAnalysis();
9492
9494
  }
9493
9495
  constructSelfRef() {
9494
- const subRuleImpl = (chevrotainSubrule) => (cstDef, arg) => chevrotainSubrule(this[cstDef.name], { ARGS: [this.context, arg] });
9496
+ const subRuleImpl = (chevrotainSubrule) => ((cstDef, ...arg) => chevrotainSubrule(this[cstDef.name], { ARGS: [this.context, ...arg] }));
9495
9497
  return {
9496
9498
  CONSUME: (tokenType, option) => this.CONSUME(tokenType, option),
9497
9499
  CONSUME1: (tokenType, option) => this.CONSUME1(tokenType, option),
@@ -9598,6 +9600,7 @@ var ParserBuilder = class _ParserBuilder {
9598
9600
  }
9599
9601
  return new _ParserBuilder(listToRuleDefMap(start));
9600
9602
  }
9603
+ rules;
9601
9604
  constructor(startRules) {
9602
9605
  this.rules = startRules;
9603
9606
  }
@@ -9678,7 +9681,7 @@ var ParserBuilder = class _ParserBuilder {
9678
9681
  const firstError = errors[0];
9679
9682
  const messageBuilder = ["Parse error"];
9680
9683
  const lineIdx = firstError.token.startLine;
9681
- if (lineIdx !== void 0) {
9684
+ if (lineIdx !== void 0 && !Number.isNaN(lineIdx)) {
9682
9685
  const errorLine = input.split("\n")[lineIdx - 1];
9683
9686
  messageBuilder.push(` on line ${lineIdx}
9684
9687
  ${errorLine}`);
@@ -9702,9 +9705,9 @@ ${firstError.message}`);
9702
9705
  const lexer = LexerBuilder.create().add(...tokenVocabulary).build({
9703
9706
  positionTracking: "full",
9704
9707
  recoveryEnabled: false,
9705
- // SafeMode: true,
9706
- // SkipValidations: true,
9707
- // ensureOptimizations: true,
9708
+ ensureOptimizations: true,
9709
+ safeMode: false,
9710
+ skipValidations: true,
9708
9711
  ...lexerConfig
9709
9712
  });
9710
9713
  const parser = this.consume({
@@ -9713,12 +9716,12 @@ ${firstError.message}`);
9713
9716
  });
9714
9717
  const selfSufficientParser = {};
9715
9718
  for (const rule of Object.values(this.rules)) {
9716
- selfSufficientParser[rule.name] = (input, context, arg) => {
9719
+ selfSufficientParser[rule.name] = ((input, context, ...args) => {
9717
9720
  const processedInput = queryPreProcessor(input);
9718
9721
  const lexResult = lexer.tokenize(processedInput);
9719
9722
  parser.input = lexResult.tokens;
9720
9723
  parser.setContext(context);
9721
- const result = parser[rule.name](context, arg);
9724
+ const result = parser[rule.name](context, ...args);
9722
9725
  if (parser.errors.length > 0) {
9723
9726
  if (errorHandler) {
9724
9727
  errorHandler(parser.errors);
@@ -9727,7 +9730,7 @@ ${firstError.message}`);
9727
9730
  }
9728
9731
  }
9729
9732
  return result;
9730
- };
9733
+ });
9731
9734
  }
9732
9735
  return selfSufficientParser;
9733
9736
  }
@@ -9982,6 +9985,7 @@ __export(grammar_exports, {
9982
9985
  quads: () => quads,
9983
9986
  quadsNotTriples: () => quadsNotTriples,
9984
9987
  query: () => query,
9988
+ queryOrUpdate: () => queryOrUpdate,
9985
9989
  queryUnit: () => queryUnit,
9986
9990
  rdfLiteral: () => rdfLiteral,
9987
9991
  regexExpression: () => regexExpression,
@@ -10030,7 +10034,7 @@ __export(lexer_exports, {
10030
10034
  ask: () => ask,
10031
10035
  baseDecl: () => baseDecl,
10032
10036
  bind: () => bind,
10033
- builtIn: () => BuildinCalls_exports,
10037
+ builtIn: () => BuiltInCalls_exports,
10034
10038
  by: () => by,
10035
10039
  clear: () => clear,
10036
10040
  construct: () => construct,
@@ -10067,7 +10071,7 @@ __export(lexer_exports, {
10067
10071
  separator: () => separator,
10068
10072
  service: () => service,
10069
10073
  silent: () => silent,
10070
- sparql11Tokens: () => sparql11Tokens,
10074
+ sparql11LexerBuilder: () => sparql11LexerBuilder,
10071
10075
  symbols: () => symbols_exports,
10072
10076
  terminals: () => terminals_exports,
10073
10077
  to: () => to,
@@ -10079,10 +10083,10 @@ __export(lexer_exports, {
10079
10083
  where: () => where
10080
10084
  });
10081
10085
 
10082
- // ../../packages/rules-sparql-1-1/lib/lexer/BuildinCalls.ts
10083
- var BuildinCalls_exports = {};
10084
- __export(BuildinCalls_exports, {
10085
- BuildInCalls: () => BuildInCalls,
10086
+ // ../../packages/rules-sparql-1-1/lib/lexer/BuiltInCalls.ts
10087
+ var BuiltInCalls_exports = {};
10088
+ __export(BuiltInCalls_exports, {
10089
+ BuiltInCalls: () => BuiltInCalls,
10086
10090
  abs: () => abs,
10087
10091
  allBuiltInCalls: () => allBuiltInCalls,
10088
10092
  avg: () => avg,
@@ -10146,70 +10150,70 @@ __export(BuildinCalls_exports, {
10146
10150
  uuid: () => uuid,
10147
10151
  year: () => year
10148
10152
  });
10149
- var BuildInCalls = /* @__PURE__ */ ((BuildInCalls2) => {
10150
- BuildInCalls2["Str"] = "builtInStr";
10151
- BuildInCalls2["Lang"] = "builtInLang";
10152
- BuildInCalls2["Langmatches"] = "builtInLangmatches";
10153
- BuildInCalls2["Datatype"] = "builtInDatatype";
10154
- BuildInCalls2["Bound"] = "builtInBound";
10155
- BuildInCalls2["Iri"] = "builtInIri";
10156
- BuildInCalls2["Uri"] = "builtInUri";
10157
- BuildInCalls2["Bnode"] = "builtInBnode";
10158
- BuildInCalls2["Rand"] = "builtInRand";
10159
- BuildInCalls2["Abs"] = "builtInAbs";
10160
- BuildInCalls2["Ceil"] = "builtInCeil";
10161
- BuildInCalls2["Floor"] = "builtInFloor";
10162
- BuildInCalls2["Round"] = "builtInRound";
10163
- BuildInCalls2["Concat"] = "builtInConcat";
10164
- BuildInCalls2["Strlen"] = "builtInStrlen";
10165
- BuildInCalls2["Ucase"] = "builtInUcase";
10166
- BuildInCalls2["Lcase"] = "builtInLcase";
10167
- BuildInCalls2["Encode_for_uri"] = "builtInEncode_for_uri";
10168
- BuildInCalls2["Contains"] = "builtInContains";
10169
- BuildInCalls2["Strstarts"] = "builtInStrstarts";
10170
- BuildInCalls2["Strends"] = "builtInStrends";
10171
- BuildInCalls2["Strbefore"] = "builtInStrbefore";
10172
- BuildInCalls2["Strafter"] = "builtInStrafter";
10173
- BuildInCalls2["Year"] = "builtInYear";
10174
- BuildInCalls2["Month"] = "builtInMonth";
10175
- BuildInCalls2["Day"] = "builtInDay";
10176
- BuildInCalls2["Hours"] = "builtInHours";
10177
- BuildInCalls2["Minutes"] = "builtInMinutes";
10178
- BuildInCalls2["Seconds"] = "builtInSeconds";
10179
- BuildInCalls2["Timezone"] = "builtInTimezone";
10180
- BuildInCalls2["Tz"] = "builtInTz";
10181
- BuildInCalls2["Now"] = "builtInNow";
10182
- BuildInCalls2["Uuid"] = "builtInUuid";
10183
- BuildInCalls2["Struuid"] = "builtInStruuid";
10184
- BuildInCalls2["Md5"] = "builtInMd5";
10185
- BuildInCalls2["Sha1"] = "builtInSha1";
10186
- BuildInCalls2["Sha256"] = "builtInSha256";
10187
- BuildInCalls2["Sha384"] = "builtInSha384";
10188
- BuildInCalls2["Sha512"] = "builtInSha512";
10189
- BuildInCalls2["Coalesce"] = "builtInCoalesce";
10190
- BuildInCalls2["If"] = "builtInIf";
10191
- BuildInCalls2["Strlang"] = "builtInStrlang";
10192
- BuildInCalls2["Strdt"] = "builtInStrdt";
10193
- BuildInCalls2["Sameterm"] = "builtInSameterm";
10194
- BuildInCalls2["Isiri"] = "builtInIsiri";
10195
- BuildInCalls2["Isuri"] = "builtInIsuri";
10196
- BuildInCalls2["Isblank"] = "builtInIsblank";
10197
- BuildInCalls2["Isliteral"] = "builtInIsliteral";
10198
- BuildInCalls2["Isnumeric"] = "builtInIsnumeric";
10199
- BuildInCalls2["Regex"] = "builtInRegex";
10200
- BuildInCalls2["Substr"] = "builtInSubstr";
10201
- BuildInCalls2["Replace"] = "builtInReplace";
10202
- BuildInCalls2["Exists"] = "builtInExists";
10203
- BuildInCalls2["Notexists"] = "builtInNotexists";
10204
- BuildInCalls2["Count"] = "builtInCount";
10205
- BuildInCalls2["Sum"] = "builtInSum";
10206
- BuildInCalls2["Min"] = "builtInMin";
10207
- BuildInCalls2["Max"] = "builtInMax";
10208
- BuildInCalls2["Avg"] = "builtInAvg";
10209
- BuildInCalls2["Sample"] = "builtInSample";
10210
- BuildInCalls2["Group_concat"] = "builtInGroup_concat";
10211
- return BuildInCalls2;
10212
- })(BuildInCalls || {});
10153
+ var BuiltInCalls = /* @__PURE__ */ ((BuiltInCalls2) => {
10154
+ BuiltInCalls2["Str"] = "builtInStr";
10155
+ BuiltInCalls2["Lang"] = "builtInLang";
10156
+ BuiltInCalls2["Langmatches"] = "builtInLangmatches";
10157
+ BuiltInCalls2["Datatype"] = "builtInDatatype";
10158
+ BuiltInCalls2["Bound"] = "builtInBound";
10159
+ BuiltInCalls2["Iri"] = "builtInIri";
10160
+ BuiltInCalls2["Uri"] = "builtInUri";
10161
+ BuiltInCalls2["Bnode"] = "builtInBnode";
10162
+ BuiltInCalls2["Rand"] = "builtInRand";
10163
+ BuiltInCalls2["Abs"] = "builtInAbs";
10164
+ BuiltInCalls2["Ceil"] = "builtInCeil";
10165
+ BuiltInCalls2["Floor"] = "builtInFloor";
10166
+ BuiltInCalls2["Round"] = "builtInRound";
10167
+ BuiltInCalls2["Concat"] = "builtInConcat";
10168
+ BuiltInCalls2["Strlen"] = "builtInStrlen";
10169
+ BuiltInCalls2["Ucase"] = "builtInUcase";
10170
+ BuiltInCalls2["Lcase"] = "builtInLcase";
10171
+ BuiltInCalls2["Encode_for_uri"] = "builtInEncode_for_uri";
10172
+ BuiltInCalls2["Contains"] = "builtInContains";
10173
+ BuiltInCalls2["Strstarts"] = "builtInStrstarts";
10174
+ BuiltInCalls2["Strends"] = "builtInStrends";
10175
+ BuiltInCalls2["Strbefore"] = "builtInStrbefore";
10176
+ BuiltInCalls2["Strafter"] = "builtInStrafter";
10177
+ BuiltInCalls2["Year"] = "builtInYear";
10178
+ BuiltInCalls2["Month"] = "builtInMonth";
10179
+ BuiltInCalls2["Day"] = "builtInDay";
10180
+ BuiltInCalls2["Hours"] = "builtInHours";
10181
+ BuiltInCalls2["Minutes"] = "builtInMinutes";
10182
+ BuiltInCalls2["Seconds"] = "builtInSeconds";
10183
+ BuiltInCalls2["Timezone"] = "builtInTimezone";
10184
+ BuiltInCalls2["Tz"] = "builtInTz";
10185
+ BuiltInCalls2["Now"] = "builtInNow";
10186
+ BuiltInCalls2["Uuid"] = "builtInUuid";
10187
+ BuiltInCalls2["Struuid"] = "builtInStruuid";
10188
+ BuiltInCalls2["Md5"] = "builtInMd5";
10189
+ BuiltInCalls2["Sha1"] = "builtInSha1";
10190
+ BuiltInCalls2["Sha256"] = "builtInSha256";
10191
+ BuiltInCalls2["Sha384"] = "builtInSha384";
10192
+ BuiltInCalls2["Sha512"] = "builtInSha512";
10193
+ BuiltInCalls2["Coalesce"] = "builtInCoalesce";
10194
+ BuiltInCalls2["If"] = "builtInIf";
10195
+ BuiltInCalls2["Strlang"] = "builtInStrlang";
10196
+ BuiltInCalls2["Strdt"] = "builtInStrdt";
10197
+ BuiltInCalls2["Sameterm"] = "builtInSameterm";
10198
+ BuiltInCalls2["Isiri"] = "builtInIsiri";
10199
+ BuiltInCalls2["Isuri"] = "builtInIsuri";
10200
+ BuiltInCalls2["Isblank"] = "builtInIsblank";
10201
+ BuiltInCalls2["Isliteral"] = "builtInIsliteral";
10202
+ BuiltInCalls2["Isnumeric"] = "builtInIsnumeric";
10203
+ BuiltInCalls2["Regex"] = "builtInRegex";
10204
+ BuiltInCalls2["Substr"] = "builtInSubstr";
10205
+ BuiltInCalls2["Replace"] = "builtInReplace";
10206
+ BuiltInCalls2["Exists"] = "builtInExists";
10207
+ BuiltInCalls2["Notexists"] = "builtInNotexists";
10208
+ BuiltInCalls2["Count"] = "builtInCount";
10209
+ BuiltInCalls2["Sum"] = "builtInSum";
10210
+ BuiltInCalls2["Min"] = "builtInMin";
10211
+ BuiltInCalls2["Max"] = "builtInMax";
10212
+ BuiltInCalls2["Avg"] = "builtInAvg";
10213
+ BuiltInCalls2["Sample"] = "builtInSample";
10214
+ BuiltInCalls2["Group_concat"] = "builtInGroup_concat";
10215
+ return BuiltInCalls2;
10216
+ })(BuiltInCalls || {});
10213
10217
  function capitalize(string2) {
10214
10218
  return string2.charAt(0).toUpperCase() + string2.slice(1);
10215
10219
  }
@@ -10713,7 +10717,7 @@ var allBaseTokens = LexerBuilder.create().add(
10713
10717
  notIn,
10714
10718
  separator
10715
10719
  );
10716
- 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);
10720
+ 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);
10717
10721
 
10718
10722
  // ../../packages/rules-sparql-1-1/lib/factoryMixins/ContextFactory.ts
10719
10723
  var nodeType = "contextDef";
@@ -11158,10 +11162,7 @@ function SolutionModifiersFactoryMixin(Base) {
11158
11162
  var nodeType8 = "term";
11159
11163
  function TermFactoryMixin(Base) {
11160
11164
  return class TermFactory extends Base {
11161
- constructor() {
11162
- super(...arguments);
11163
- this.__blankNodeCounter = 0;
11164
- }
11165
+ __blankNodeCounter = 0;
11165
11166
  resetBlankNodeCounter() {
11166
11167
  this.__blankNodeCounter = 0;
11167
11168
  }
@@ -11637,6 +11638,29 @@ function updateNoReuseBlankNodeLabels(updateQuery) {
11637
11638
  }
11638
11639
  }
11639
11640
 
11641
+ // ../../packages/rules-sparql-1-1/lib/utils.ts
11642
+ function sparqlCodepointEscape(input) {
11643
+ const sanitizedInput = input.replaceAll(
11644
+ /\\u([0-9a-fA-F]{4})|\\U([0-9a-fA-F]{8})/gu,
11645
+ (_, unicode4, unicode8) => {
11646
+ if (unicode4) {
11647
+ const charCode2 = Number.parseInt(unicode4, 16);
11648
+ return String.fromCodePoint(charCode2);
11649
+ }
11650
+ const charCode = Number.parseInt(unicode8, 16);
11651
+ if (charCode < 65535) {
11652
+ return String.fromCodePoint(charCode);
11653
+ }
11654
+ const substractedCharCode = charCode - 65536;
11655
+ return String.fromCodePoint(55296 + (substractedCharCode >> 10), 56320 + (substractedCharCode & 1023));
11656
+ }
11657
+ );
11658
+ if (/[\uD800-\uDBFF](?:[^\uDC00-\uDFFF]|$)/u.test(sanitizedInput)) {
11659
+ throw new Error(`Invalid unicode codepoint of surrogate pair without corresponding codepoint`);
11660
+ }
11661
+ return sanitizedInput;
11662
+ }
11663
+
11640
11664
  // ../../packages/rules-sparql-1-1/lib/grammar/literals.ts
11641
11665
  function stringEscapedLexical(str2) {
11642
11666
  const lexical = str2.replaceAll(/["\\\t\n\r\b\f]/gu, (char) => {
@@ -11664,7 +11688,7 @@ function stringEscapedLexical(str2) {
11664
11688
  var rdfLiteral = {
11665
11689
  name: "rdfLiteral",
11666
11690
  impl: ({ ACTION, SUBRULE1, CONSUME, OPTION, OR }) => (C) => {
11667
- const value = SUBRULE1(string, void 0);
11691
+ const value = SUBRULE1(string);
11668
11692
  return OPTION(() => OR([
11669
11693
  { ALT: () => {
11670
11694
  const lang2 = CONSUME(terminals_exports.langTag);
@@ -11676,7 +11700,7 @@ var rdfLiteral = {
11676
11700
  } },
11677
11701
  { ALT: () => {
11678
11702
  CONSUME(symbols_exports.hathat);
11679
- const iriVal = SUBRULE1(iri2, void 0);
11703
+ const iriVal = SUBRULE1(iri2);
11680
11704
  return ACTION(() => C.factory.literalTerm(
11681
11705
  C.factory.sourceLocation(value, iriVal),
11682
11706
  value.value,
@@ -11692,7 +11716,7 @@ var rdfLiteral = {
11692
11716
  factory.printFilter(ast, () => PRINT("@", ast.langOrIri));
11693
11717
  } else {
11694
11718
  factory.printFilter(ast, () => PRINT("^^"));
11695
- SUBRULE(iri2, ast.langOrIri, void 0);
11719
+ SUBRULE(iri2, ast.langOrIri);
11696
11720
  }
11697
11721
  }
11698
11722
  }
@@ -11700,9 +11724,9 @@ var rdfLiteral = {
11700
11724
  var numericLiteral = {
11701
11725
  name: "numericLiteral",
11702
11726
  impl: ({ SUBRULE, OR }) => () => OR([
11703
- { ALT: () => SUBRULE(numericLiteralUnsigned, void 0) },
11704
- { ALT: () => SUBRULE(numericLiteralPositive, void 0) },
11705
- { ALT: () => SUBRULE(numericLiteralNegative, void 0) }
11727
+ { ALT: () => SUBRULE(numericLiteralUnsigned) },
11728
+ { ALT: () => SUBRULE(numericLiteralPositive) },
11729
+ { ALT: () => SUBRULE(numericLiteralNegative) }
11706
11730
  ])
11707
11731
  };
11708
11732
  var numericLiteralUnsigned = {
@@ -11810,10 +11834,10 @@ var string = {
11810
11834
  var iri2 = {
11811
11835
  name: "iri",
11812
11836
  impl: ({ SUBRULE, OR }) => () => OR([
11813
- { ALT: () => SUBRULE(iriFull, void 0) },
11814
- { ALT: () => SUBRULE(prefixedName, void 0) }
11837
+ { ALT: () => SUBRULE(iriFull) },
11838
+ { ALT: () => SUBRULE(prefixedName) }
11815
11839
  ]),
11816
- gImpl: ({ SUBRULE }) => (ast, { factory: F2 }) => F2.isTermNamedPrefixed(ast) ? SUBRULE(prefixedName, ast, void 0) : SUBRULE(iriFull, ast, void 0)
11840
+ gImpl: ({ SUBRULE }) => (ast, { factory: F2 }) => F2.isTermNamedPrefixed(ast) ? SUBRULE(prefixedName, ast) : SUBRULE(iriFull, ast)
11817
11841
  };
11818
11842
  var iriFull = {
11819
11843
  name: "iriFull",
@@ -11877,93 +11901,25 @@ var verbA = {
11877
11901
  }
11878
11902
  };
11879
11903
 
11880
- // ../../packages/rules-sparql-1-1/lib/grammar/dataSetClause.ts
11881
- function datasetClauseUsing(name, token) {
11882
- return {
11883
- name,
11884
- impl: ({ ACTION, SUBRULE, CONSUME, OR }) => (C) => {
11885
- const start = CONSUME(token);
11886
- return OR([
11887
- { ALT: () => {
11888
- const iri3 = SUBRULE(defaultGraphClause, void 0);
11889
- return ACTION(() => C.factory.wrap({ clauseType: "default", value: iri3 }, C.factory.sourceLocation(start, iri3)));
11890
- } },
11891
- { ALT: () => {
11892
- const namedClause = SUBRULE(namedGraphClause, void 0);
11893
- return ACTION(() => C.factory.wrap({
11894
- clauseType: "named",
11895
- value: namedClause.val
11896
- }, C.factory.sourceLocation(start, namedClause)));
11897
- } }
11898
- ]);
11899
- }
11900
- };
11901
- }
11902
- var datasetClause = datasetClauseUsing("datasetClause", from);
11903
- var defaultGraphClause = {
11904
- name: "defaultGraphClause",
11905
- impl: ({ SUBRULE }) => () => SUBRULE(sourceSelector, void 0)
11906
- };
11907
- var usingClause2 = datasetClauseUsing("usingClause", usingClause);
11908
- function datasetClauseUsingStar(name, subRule, fromUsing) {
11909
- return {
11910
- name,
11911
- impl: ({ ACTION, MANY, SUBRULE }) => (C) => {
11912
- const clauses = [];
11913
- MANY(() => {
11914
- const clause = SUBRULE(subRule, void 0);
11915
- clauses.push(clause);
11916
- });
11917
- return ACTION(() => C.factory.datasetClauses(
11918
- clauses.map((clause) => clause.val),
11919
- C.factory.sourceLocation(...clauses)
11920
- ));
11921
- },
11922
- gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F2 }) => {
11923
- for (const clause of ast.clauses) {
11924
- F2.printFilter(ast, () => PRINT_WORD(fromUsing));
11925
- if (clause.clauseType === "named") {
11926
- F2.printFilter(ast, () => PRINT_WORD("NAMED"));
11927
- }
11928
- SUBRULE(iri2, clause.value, void 0);
11929
- }
11930
- }
11931
- };
11932
- }
11933
- var datasetClauseStar = datasetClauseUsingStar("datasetClauses", datasetClause, "FROM");
11934
- var usingClauseStar = datasetClauseUsingStar("usingClauses", usingClause2, "USING");
11935
- var namedGraphClause = {
11936
- name: "namedGraphClause",
11937
- impl: ({ ACTION, SUBRULE, CONSUME }) => (C) => {
11938
- const named2 = CONSUME(graph_exports.named);
11939
- const iri3 = SUBRULE(sourceSelector, void 0);
11940
- return ACTION(() => C.factory.wrap(iri3, C.factory.sourceLocation(named2, iri3)));
11941
- }
11942
- };
11943
- var sourceSelector = {
11944
- name: "sourceSelector",
11945
- impl: ({ SUBRULE }) => () => SUBRULE(iri2, void 0)
11946
- };
11947
-
11948
11904
  // ../../packages/rules-sparql-1-1/lib/grammar/general.ts
11949
11905
  var prologue = {
11950
11906
  name: "prologue",
11951
11907
  impl: ({ SUBRULE, MANY, OR }) => () => {
11952
11908
  const result = [];
11953
11909
  MANY(() => OR([
11954
- { ALT: () => result.push(SUBRULE(baseDecl2, void 0)) },
11910
+ { ALT: () => result.push(SUBRULE(baseDecl2)) },
11955
11911
  // TODO: the [spec](https://www.w3.org/TR/sparql11-query/#iriRefs) says you cannot redefine prefixes.
11956
11912
  // We might need to check this.
11957
- { ALT: () => result.push(SUBRULE(prefixDecl2, void 0)) }
11913
+ { ALT: () => result.push(SUBRULE(prefixDecl2)) }
11958
11914
  ]));
11959
11915
  return result;
11960
11916
  },
11961
11917
  gImpl: ({ SUBRULE }) => (ast, { factory: F2 }) => {
11962
11918
  for (const context of ast) {
11963
11919
  if (F2.isContextDefinitionBase(context)) {
11964
- SUBRULE(baseDecl2, context, void 0);
11920
+ SUBRULE(baseDecl2, context);
11965
11921
  } else if (F2.isContextDefinitionPrefix(context)) {
11966
- SUBRULE(prefixDecl2, context, void 0);
11922
+ SUBRULE(prefixDecl2, context);
11967
11923
  }
11968
11924
  }
11969
11925
  }
@@ -11972,12 +11928,12 @@ var baseDecl2 = {
11972
11928
  name: "baseDecl",
11973
11929
  impl: ({ ACTION, CONSUME, SUBRULE }) => (C) => {
11974
11930
  const base = CONSUME(baseDecl);
11975
- const val = SUBRULE(iriFull, void 0);
11931
+ const val = SUBRULE(iriFull);
11976
11932
  return ACTION(() => C.factory.contextDefinitionBase(C.factory.sourceLocation(base, val), val));
11977
11933
  },
11978
11934
  gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F2 }) => {
11979
11935
  F2.printFilter(ast, () => PRINT_WORD("BASE"));
11980
- SUBRULE(iri2, ast.value, void 0);
11936
+ SUBRULE(iri2, ast.value);
11981
11937
  }
11982
11938
  };
11983
11939
  var prefixDecl2 = {
@@ -11985,41 +11941,41 @@ var prefixDecl2 = {
11985
11941
  impl: ({ ACTION, CONSUME, SUBRULE }) => (C) => {
11986
11942
  const prefix = CONSUME(prefixDecl);
11987
11943
  const name = CONSUME(terminals_exports.pNameNs).image.slice(0, -1);
11988
- const value = SUBRULE(iriFull, void 0);
11944
+ const value = SUBRULE(iriFull);
11989
11945
  return ACTION(() => C.factory.contextDefinitionPrefix(C.factory.sourceLocation(prefix, value), name, value));
11990
11946
  },
11991
11947
  gImpl: ({ SUBRULE, PRINT_WORDS }) => (ast, { factory: F2 }) => {
11992
11948
  F2.printFilter(ast, () => {
11993
11949
  PRINT_WORDS("PREFIX", `${ast.key}:`);
11994
11950
  });
11995
- SUBRULE(iri2, ast.value, void 0);
11951
+ SUBRULE(iri2, ast.value);
11996
11952
  }
11997
11953
  };
11998
11954
  var verb = {
11999
11955
  name: "verb",
12000
11956
  impl: ({ SUBRULE, OR }) => () => OR([
12001
- { ALT: () => SUBRULE(varOrIri, void 0) },
12002
- { ALT: () => SUBRULE(verbA, void 0) }
11957
+ { ALT: () => SUBRULE(varOrIri) },
11958
+ { ALT: () => SUBRULE(verbA) }
12003
11959
  ])
12004
11960
  };
12005
11961
  var varOrTerm = {
12006
11962
  name: "varOrTerm",
12007
11963
  impl: ({ SUBRULE, OR }) => (C) => OR([
12008
- { GATE: () => C.parseMode.has("canParseVars"), ALT: () => SUBRULE(var_, void 0) },
12009
- { ALT: () => SUBRULE(graphTerm, void 0) }
11964
+ { GATE: () => C.parseMode.has("canParseVars"), ALT: () => SUBRULE(var_) },
11965
+ { ALT: () => SUBRULE(graphTerm) }
12010
11966
  ]),
12011
11967
  gImpl: ({ SUBRULE }) => (ast, { factory: F2 }) => {
12012
11968
  if (F2.isTermVariable(ast)) {
12013
- return SUBRULE(var_, ast, void 0);
11969
+ return SUBRULE(var_, ast);
12014
11970
  }
12015
- return SUBRULE(graphTerm, ast, void 0);
11971
+ return SUBRULE(graphTerm, ast);
12016
11972
  }
12017
11973
  };
12018
11974
  var varOrIri = {
12019
11975
  name: "varOrIri",
12020
11976
  impl: ({ SUBRULE, OR }) => (C) => OR([
12021
- { GATE: () => C.parseMode.has("canParseVars"), ALT: () => SUBRULE(var_, void 0) },
12022
- { ALT: () => SUBRULE(iri2, void 0) }
11977
+ { GATE: () => C.parseMode.has("canParseVars"), ALT: () => SUBRULE(var_) },
11978
+ { ALT: () => SUBRULE(iri2) }
12023
11979
  ])
12024
11980
  };
12025
11981
  var var_ = {
@@ -12038,11 +11994,11 @@ var var_ = {
12038
11994
  var graphTerm = {
12039
11995
  name: "graphTerm",
12040
11996
  impl: ({ ACTION, SUBRULE, CONSUME, OR }) => (C) => OR([
12041
- { ALT: () => SUBRULE(iri2, void 0) },
12042
- { ALT: () => SUBRULE(rdfLiteral, void 0) },
12043
- { ALT: () => SUBRULE(numericLiteral, void 0) },
12044
- { ALT: () => SUBRULE(booleanLiteral, void 0) },
12045
- { GATE: () => C.parseMode.has("canCreateBlankNodes"), ALT: () => SUBRULE(blankNode, void 0) },
11997
+ { ALT: () => SUBRULE(iri2) },
11998
+ { ALT: () => SUBRULE(rdfLiteral) },
11999
+ { ALT: () => SUBRULE(numericLiteral) },
12000
+ { ALT: () => SUBRULE(booleanLiteral) },
12001
+ { GATE: () => C.parseMode.has("canCreateBlankNodes"), ALT: () => SUBRULE(blankNode) },
12046
12002
  { ALT: () => {
12047
12003
  const tokenNil = CONSUME(terminals_exports.nil);
12048
12004
  return ACTION(() => C.factory.namedNode(C.factory.sourceLocation(tokenNil), "http://www.w3.org/1999/02/22-rdf-syntax-ns#nil" /* NIL */));
@@ -12050,1275 +12006,1344 @@ var graphTerm = {
12050
12006
  ]),
12051
12007
  gImpl: ({ SUBRULE }) => (ast, { factory: F2 }) => {
12052
12008
  if (F2.isTermNamed(ast)) {
12053
- SUBRULE(iri2, ast, void 0);
12009
+ SUBRULE(iri2, ast);
12054
12010
  } else if (F2.isTermLiteral(ast)) {
12055
- SUBRULE(rdfLiteral, ast, void 0);
12011
+ SUBRULE(rdfLiteral, ast);
12056
12012
  } else if (F2.isTermBlank(ast)) {
12057
- SUBRULE(blankNode, ast, void 0);
12013
+ SUBRULE(blankNode, ast);
12058
12014
  }
12059
12015
  }
12060
12016
  };
12061
12017
 
12062
- // ../../packages/rules-sparql-1-1/lib/grammar/propertyPaths.ts
12063
- var path = {
12064
- name: "path",
12065
- impl: ({ SUBRULE }) => () => SUBRULE(pathAlternative, void 0)
12066
- };
12067
- var pathGenerator = {
12068
- name: "path",
12069
- gImpl: ({ PRINT, SUBRULE }) => (ast, { factory: F2 }, braces = true) => {
12070
- if (F2.isTerm(ast) && F2.isTermNamed(ast)) {
12071
- SUBRULE(iri2, ast, void 0);
12072
- } else {
12073
- F2.printFilter(ast, () => braces && PRINT("("));
12074
- switch (ast.subType) {
12075
- case "|":
12076
- case "/": {
12077
- const [head2, ...tail] = ast.items;
12078
- SUBRULE(pathGenerator, head2, braces);
12079
- for (const val of tail) {
12080
- F2.printFilter(ast, () => PRINT(ast.subType));
12081
- SUBRULE(pathGenerator, val, braces);
12082
- }
12083
- break;
12084
- }
12085
- case "^":
12086
- F2.printFilter(ast, () => PRINT("^"));
12087
- SUBRULE(pathGenerator, ast.items[0], braces);
12088
- break;
12089
- case "?":
12090
- case "*":
12091
- case "+":
12092
- SUBRULE(pathGenerator, ast.items[0], braces);
12093
- F2.printFilter(ast, () => PRINT(ast.subType));
12094
- break;
12095
- case "!":
12096
- F2.printFilter(ast, () => PRINT("!"));
12097
- F2.printFilter(ast, () => PRINT("("));
12098
- SUBRULE(pathGenerator, ast.items[0], false);
12099
- F2.printFilter(ast, () => PRINT(")"));
12100
- break;
12101
- }
12102
- F2.printFilter(ast, () => braces && PRINT(")"));
12018
+ // ../../packages/rules-sparql-1-1/lib/grammar/dataSetClause.ts
12019
+ function datasetClauseUsing(name, token) {
12020
+ return {
12021
+ name,
12022
+ impl: ({ ACTION, SUBRULE, CONSUME, OR }) => (C) => {
12023
+ const start = CONSUME(token);
12024
+ return OR([
12025
+ { ALT: () => {
12026
+ const iri3 = SUBRULE(defaultGraphClause);
12027
+ return ACTION(() => C.factory.wrap({ clauseType: "default", value: iri3 }, C.factory.sourceLocation(start, iri3)));
12028
+ } },
12029
+ { ALT: () => {
12030
+ const namedClause = SUBRULE(namedGraphClause);
12031
+ return ACTION(() => C.factory.wrap({
12032
+ clauseType: "named",
12033
+ value: namedClause.val
12034
+ }, C.factory.sourceLocation(start, namedClause)));
12035
+ } }
12036
+ ]);
12103
12037
  }
12104
- }
12038
+ };
12039
+ }
12040
+ var datasetClause = datasetClauseUsing("datasetClause", from);
12041
+ var defaultGraphClause = {
12042
+ name: "defaultGraphClause",
12043
+ impl: ({ SUBRULE }) => () => SUBRULE(sourceSelector)
12105
12044
  };
12106
- function pathChainHelper(name, SEP, subType, subRule) {
12045
+ var usingClause2 = datasetClauseUsing("usingClause", usingClause);
12046
+ function datasetClauseUsingStar(name, subRule, fromUsing) {
12107
12047
  return {
12108
12048
  name,
12109
- impl: ({ ACTION, CONSUME, SUBRULE1, SUBRULE2, MANY }) => (C) => {
12110
- const head2 = SUBRULE1(subRule, void 0);
12111
- let tailEnd = head2;
12112
- const tail = [];
12049
+ impl: ({ ACTION, MANY, SUBRULE }) => (C) => {
12050
+ const clauses = [];
12113
12051
  MANY(() => {
12114
- CONSUME(SEP);
12115
- tailEnd = SUBRULE2(subRule, void 0);
12116
- tail.push(tailEnd);
12052
+ const clause = SUBRULE(subRule);
12053
+ clauses.push(clause);
12117
12054
  });
12118
- return ACTION(() => tail.length === 0 ? head2 : C.factory.path(subType, [head2, ...tail], C.factory.sourceLocation(head2, tailEnd)));
12055
+ return ACTION(() => C.factory.datasetClauses(
12056
+ clauses.map((clause) => clause.val),
12057
+ C.factory.sourceLocation(...clauses)
12058
+ ));
12059
+ },
12060
+ gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F2 }) => {
12061
+ for (const clause of ast.clauses) {
12062
+ F2.printFilter(ast, () => PRINT_WORD(fromUsing));
12063
+ if (clause.clauseType === "named") {
12064
+ F2.printFilter(ast, () => PRINT_WORD("NAMED"));
12065
+ }
12066
+ SUBRULE(iri2, clause.value);
12067
+ }
12119
12068
  }
12120
12069
  };
12121
12070
  }
12122
- var pathEltOrInverse = {
12123
- name: "pathEltOrInverse",
12124
- impl: ({ ACTION, CONSUME, SUBRULE1, SUBRULE2, OR }) => (C) => OR([
12125
- { ALT: () => SUBRULE1(pathElt, void 0) },
12126
- { ALT: () => {
12127
- const hat2 = CONSUME(symbols_exports.hat);
12128
- const item = SUBRULE2(pathElt, void 0);
12129
- return ACTION(() => C.factory.path("^", [item], C.factory.sourceLocation(hat2, item)));
12130
- } }
12131
- ])
12132
- };
12133
- var pathSequence = pathChainHelper("pathSequence", symbols_exports.slash, "/", pathEltOrInverse);
12134
- var pathAlternative = pathChainHelper("pathAlternative", symbols_exports.pipe, "|", pathSequence);
12135
- var pathElt = {
12136
- name: "pathElt",
12137
- impl: ({ ACTION, SUBRULE, OPTION }) => (C) => {
12138
- const item = SUBRULE(pathPrimary, void 0);
12139
- const modification = OPTION(() => SUBRULE(pathMod, void 0));
12140
- return ACTION(() => modification === void 0 ? item : C.factory.path(modification.image, [item], C.factory.sourceLocation(item, modification)));
12071
+ var datasetClauseStar = datasetClauseUsingStar("datasetClauses", datasetClause, "FROM");
12072
+ var usingClauseStar = datasetClauseUsingStar("usingClauses", usingClause2, "USING");
12073
+ var namedGraphClause = {
12074
+ name: "namedGraphClause",
12075
+ impl: ({ ACTION, SUBRULE, CONSUME }) => (C) => {
12076
+ const named2 = CONSUME(graph_exports.named);
12077
+ const iri3 = SUBRULE(sourceSelector);
12078
+ return ACTION(() => C.factory.wrap(iri3, C.factory.sourceLocation(named2, iri3)));
12141
12079
  }
12142
12080
  };
12143
- var pathMod = {
12144
- name: "pathMod",
12145
- impl: ({ CONSUME, OR }) => () => OR([
12146
- { ALT: () => CONSUME(symbols_exports.question) },
12147
- { ALT: () => CONSUME(symbols_exports.star) },
12148
- { ALT: () => CONSUME(symbols_exports.opPlus) }
12149
- ])
12081
+ var sourceSelector = {
12082
+ name: "sourceSelector",
12083
+ impl: ({ SUBRULE }) => () => SUBRULE(iri2)
12150
12084
  };
12151
- var pathPrimary = {
12152
- name: "pathPrimary",
12153
- impl: ({ SUBRULE, CONSUME, OR }) => () => OR([
12154
- { ALT: () => SUBRULE(iri2, void 0) },
12155
- { ALT: () => SUBRULE(verbA, void 0) },
12156
- { ALT: () => SUBRULE(pathNegatedPropertySet, void 0) },
12157
- { ALT: () => {
12085
+
12086
+ // ../../packages/rules-sparql-1-1/lib/expressionHelpers.ts
12087
+ function funcExpr1(func) {
12088
+ return {
12089
+ name: unCapitalize(func.name),
12090
+ impl: ({ ACTION, SUBRULE, CONSUME }) => (C) => {
12091
+ const operator = CONSUME(func);
12158
12092
  CONSUME(symbols_exports.LParen);
12159
- const resRecursive = SUBRULE(path, void 0);
12160
- CONSUME(symbols_exports.RParen);
12161
- return resRecursive;
12162
- } }
12163
- ])
12164
- };
12165
- var pathNegatedPropertySet = {
12166
- name: "pathNegatedPropertySet",
12167
- impl: ({ ACTION, CONSUME, SUBRULE1, SUBRULE2, SUBRULE3, OR, MANY }) => (C) => {
12168
- const exclamation2 = CONSUME(symbols_exports.exclamation);
12169
- return OR([
12170
- { ALT: () => {
12171
- const noAlternative = SUBRULE1(pathOneInPropertySet, void 0);
12172
- return ACTION(() => C.factory.path("!", [noAlternative], C.factory.sourceLocation(exclamation2, noAlternative)));
12173
- } },
12174
- { ALT: () => {
12175
- const open = CONSUME(symbols_exports.LParen);
12176
- const head2 = SUBRULE2(pathOneInPropertySet, void 0);
12177
- const tail = [];
12178
- MANY(() => {
12179
- CONSUME(symbols_exports.pipe);
12180
- const item = SUBRULE3(pathOneInPropertySet, void 0);
12181
- tail.push(item);
12182
- });
12183
- const close = CONSUME(symbols_exports.RParen);
12184
- return ACTION(() => {
12185
- const F2 = C.factory;
12186
- if (tail.length === 0) {
12187
- return F2.path("!", [head2], F2.sourceLocation(exclamation2, close));
12188
- }
12189
- return F2.path(
12190
- "!",
12191
- [F2.path("|", [head2, ...tail], F2.sourceLocation(open, close))],
12192
- F2.sourceLocation(exclamation2, close)
12193
- );
12194
- });
12195
- } }
12196
- ]);
12197
- }
12198
- };
12199
- var pathOneInPropertySet = {
12200
- name: "pathOneInPropertySet",
12201
- impl: ({ ACTION, CONSUME, SUBRULE1, SUBRULE2, OR1, OR2 }) => (C) => OR1([
12202
- { ALT: () => SUBRULE1(iri2, void 0) },
12203
- { ALT: () => SUBRULE1(verbA, void 0) },
12204
- { ALT: () => {
12205
- const hat2 = CONSUME(symbols_exports.hat);
12206
- const item = OR2([
12207
- { ALT: () => SUBRULE2(iri2, void 0) },
12208
- { ALT: () => SUBRULE2(verbA, void 0) }
12209
- ]);
12210
- return ACTION(() => C.factory.path("^", [item], C.factory.sourceLocation(hat2, item)));
12211
- } }
12212
- ])
12213
- };
12214
-
12215
- // ../../packages/rules-sparql-1-1/lib/grammar/tripleBlock.ts
12216
- function triplesDotSeperated(triplesSameSubjectSubrule) {
12217
- return ({ ACTION, AT_LEAST_ONE, SUBRULE, CONSUME, OPTION }) => (C) => {
12218
- const triples = [];
12219
- let parsedDot = true;
12220
- let dotToken;
12221
- AT_LEAST_ONE({
12222
- GATE: () => parsedDot,
12223
- DEF: () => {
12224
- parsedDot = false;
12225
- const template = SUBRULE(triplesSameSubjectSubrule, void 0);
12226
- ACTION(() => {
12227
- triples.push(...template);
12228
- });
12229
- OPTION(() => {
12230
- dotToken = CONSUME(symbols_exports.dot);
12231
- parsedDot = true;
12232
- });
12233
- }
12234
- });
12235
- return ACTION(() => C.factory.patternBgp(triples, C.factory.sourceLocation(...triples, dotToken)));
12236
- };
12237
- }
12238
- var triplesBlock = {
12239
- name: "triplesBlock",
12240
- impl: (implArgs) => (C) => triplesDotSeperated(triplesSameSubjectPath)(implArgs)(C, void 0),
12241
- gImpl: ({ SUBRULE, PRINT_WORD, HANDLE_LOC }) => (ast, { factory: F2 }) => {
12242
- for (const [index, triple] of ast.triples.entries()) {
12243
- HANDLE_LOC(triple, () => {
12244
- const nextTriple = ast.triples.at(index);
12245
- if (F2.isTripleCollection(triple)) {
12246
- SUBRULE(graphNodePath, triple, void 0);
12247
- F2.printFilter(triple, () => PRINT_WORD("."));
12248
- } else {
12249
- SUBRULE(graphNodePath, triple.subject, void 0);
12250
- if (F2.isTerm(triple.predicate) && F2.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
- if (nextTriple === void 0 || F2.isTripleCollection(nextTriple) || !F2.isSourceLocationNoMaterialize(nextTriple.subject.loc)) {
12257
- F2.printFilter(ast, () => PRINT_WORD("."));
12258
- } else if (F2.isSourceLocationNoMaterialize(nextTriple.predicate.loc)) {
12259
- F2.printFilter(ast, () => PRINT_WORD(","));
12260
- } else {
12261
- F2.printFilter(ast, () => PRINT_WORD(";"));
12262
- }
12263
- }
12264
- });
12093
+ const arg = SUBRULE(expression);
12094
+ const close = CONSUME(symbols_exports.RParen);
12095
+ return ACTION(() => C.factory.expressionOperation(operator.image, [arg], C.factory.sourceLocation(operator, close)));
12265
12096
  }
12266
- }
12267
- };
12268
- function triplesSameSubjectImpl(name, allowPaths) {
12269
- return {
12270
- name,
12271
- impl: ({ ACTION, SUBRULE, OR }) => (C) => OR([
12272
- { ALT: () => {
12273
- const subject = SUBRULE(varOrTerm, void 0);
12274
- const res = SUBRULE(
12275
- allowPaths ? propertyListPathNotEmpty : propertyListNotEmpty,
12276
- { subject: ACTION(() => C.factory.dematerialized(subject)) }
12277
- );
12278
- return ACTION(() => {
12279
- if (res.length > 0) {
12280
- res[0].subject = subject;
12281
- res[0].loc = C.factory.sourceLocation(subject, res[0]);
12282
- }
12283
- return res;
12284
- });
12285
- } },
12286
- { ALT: () => {
12287
- const subjectNode = SUBRULE(allowPaths ? triplesNodePath : triplesNode, void 0);
12288
- const restNode = SUBRULE(
12289
- allowPaths ? propertyListPath : propertyList,
12290
- { subject: ACTION(() => C.factory.graphNodeIdentifier(subjectNode)) }
12291
- );
12292
- return ACTION(() => {
12293
- if (restNode.length === 0) {
12294
- return [subjectNode];
12295
- }
12296
- restNode[0].subject = subjectNode;
12297
- restNode[0].loc = C.factory.sourceLocation(subjectNode, restNode[0]);
12298
- return restNode;
12299
- });
12300
- } }
12301
- ])
12302
12097
  };
12303
12098
  }
12304
- var triplesSameSubject = triplesSameSubjectImpl("triplesSameSubject", false);
12305
- var triplesSameSubjectPath = triplesSameSubjectImpl("triplesSameSubjectPath", true);
12306
- var triplesTemplate = {
12307
- name: "triplesTemplate",
12308
- impl: triplesDotSeperated(triplesSameSubject)
12309
- };
12310
- function propertyListImpl(name, allowPaths) {
12099
+ function funcExpr2(func) {
12311
12100
  return {
12312
- name,
12313
- impl: ({ SUBRULE, OPTION }) => (_, arg) => OPTION(() => SUBRULE(allowPaths ? propertyListPathNotEmpty : propertyListNotEmpty, arg)) ?? []
12101
+ name: unCapitalize(func.name),
12102
+ impl: ({ ACTION, CONSUME, SUBRULE1, SUBRULE2 }) => (C) => {
12103
+ const operator = CONSUME(func);
12104
+ CONSUME(symbols_exports.LParen);
12105
+ const arg1 = SUBRULE1(expression);
12106
+ CONSUME(symbols_exports.comma);
12107
+ const arg2 = SUBRULE2(expression);
12108
+ const close = CONSUME(symbols_exports.RParen);
12109
+ return ACTION(() => C.factory.expressionOperation(operator.image, [arg1, arg2], C.factory.sourceLocation(operator, close)));
12110
+ }
12314
12111
  };
12315
12112
  }
12316
- var propertyList = propertyListImpl("propertyList", false);
12317
- var propertyListPath = propertyListImpl("propertyListPath", true);
12318
- function propertyListNotEmptyImplementation(name, allowPaths) {
12113
+ function funcExpr3(func) {
12319
12114
  return {
12320
- name,
12321
- impl: ({ ACTION, CONSUME, AT_LEAST_ONE, SUBRULE1, MANY2, OR1 }) => (_, arg) => {
12322
- const result = [];
12323
- let parsedSemi = true;
12324
- AT_LEAST_ONE({
12325
- GATE: () => parsedSemi,
12326
- DEF: () => {
12327
- parsedSemi = false;
12328
- const predicate = allowPaths ? OR1([
12329
- { ALT: () => SUBRULE1(verbPath, void 0) },
12330
- { ALT: () => SUBRULE1(verbSimple, void 0) }
12331
- ]) : SUBRULE1(verb, void 0);
12332
- const triples = SUBRULE1(
12333
- allowPaths ? objectListPath : objectList,
12334
- ACTION(() => ({ subject: arg.subject, predicate }))
12335
- );
12336
- MANY2(() => {
12337
- CONSUME(symbols_exports.semi);
12338
- parsedSemi = true;
12339
- });
12340
- ACTION(() => {
12341
- result.push(...triples);
12342
- });
12343
- }
12344
- });
12345
- return result;
12115
+ name: unCapitalize(func.name),
12116
+ impl: ({ ACTION, CONSUME, CONSUME1, CONSUME2, SUBRULE1, SUBRULE2, SUBRULE3 }) => (C) => {
12117
+ const operator = CONSUME(func);
12118
+ CONSUME(symbols_exports.LParen);
12119
+ const arg1 = SUBRULE1(expression);
12120
+ CONSUME1(symbols_exports.comma);
12121
+ const arg2 = SUBRULE2(expression);
12122
+ CONSUME2(symbols_exports.comma);
12123
+ const arg3 = SUBRULE3(expression);
12124
+ const close = CONSUME(symbols_exports.RParen);
12125
+ return ACTION(() => C.factory.expressionOperation(operator.image, [arg1, arg2, arg3], C.factory.sourceLocation(operator, close)));
12346
12126
  }
12347
12127
  };
12348
12128
  }
12349
- var propertyListNotEmpty = propertyListNotEmptyImplementation("propertyListNotEmpty", false);
12350
- var propertyListPathNotEmpty = propertyListNotEmptyImplementation("propertyListPathNotEmpty", true);
12351
- var verbPath = {
12352
- name: "verbPath",
12353
- impl: ({ SUBRULE }) => () => SUBRULE(path, void 0)
12354
- };
12355
- var verbSimple = {
12356
- name: "verbSimple",
12357
- impl: ({ SUBRULE }) => () => SUBRULE(var_, void 0)
12358
- };
12359
- function objectListImpl(name, allowPaths) {
12129
+ function funcVar1(func) {
12360
12130
  return {
12361
- name,
12362
- impl: ({ ACTION, SUBRULE, AT_LEAST_ONE_SEP }) => (_, arg) => {
12363
- const objects = [];
12364
- AT_LEAST_ONE_SEP({
12365
- SEP: symbols_exports.comma,
12366
- DEF: () => {
12367
- const objectTriple = SUBRULE(allowPaths ? objectPath : object, arg);
12368
- ACTION(() => {
12369
- objects.push(objectTriple);
12370
- });
12371
- }
12372
- });
12373
- return objects;
12131
+ name: unCapitalize(func.name),
12132
+ impl: ({ ACTION, SUBRULE, CONSUME }) => (C) => {
12133
+ const operator = CONSUME(func);
12134
+ CONSUME(symbols_exports.LParen);
12135
+ const arg = SUBRULE(var_);
12136
+ const close = CONSUME(symbols_exports.RParen);
12137
+ return ACTION(() => C.factory.expressionOperation(operator.image, [arg], C.factory.sourceLocation(operator, close)));
12374
12138
  }
12375
12139
  };
12376
12140
  }
12377
- var objectList = objectListImpl("objectList", false);
12378
- var objectListPath = objectListImpl("objectListPath", true);
12379
- function objectImpl(name, allowPaths) {
12141
+ function funcExprOrNil1(func) {
12380
12142
  return {
12381
- name,
12382
- impl: ({ ACTION, SUBRULE }) => (C, arg) => {
12383
- const node = SUBRULE(allowPaths ? graphNodePath : graphNode, void 0);
12384
- return ACTION(() => C.factory.triple(arg.subject, arg.predicate, node));
12143
+ name: unCapitalize(func.name),
12144
+ impl: ({ ACTION, CONSUME, OR, SUBRULE }) => (C) => {
12145
+ const operator = CONSUME(func);
12146
+ return OR([
12147
+ { ALT: () => {
12148
+ CONSUME(symbols_exports.LParen);
12149
+ const arg = SUBRULE(expression);
12150
+ const close = CONSUME(symbols_exports.RParen);
12151
+ return ACTION(() => C.factory.expressionOperation(operator.image, [arg], C.factory.sourceLocation(operator, close)));
12152
+ } },
12153
+ { ALT: () => {
12154
+ const nil2 = CONSUME(terminals_exports.nil);
12155
+ return ACTION(() => C.factory.expressionOperation(operator.image, [], C.factory.sourceLocation(operator, nil2)));
12156
+ } }
12157
+ ]);
12385
12158
  }
12386
12159
  };
12387
12160
  }
12388
- var object = objectImpl("object", false);
12389
- var objectPath = objectImpl("objectPath", true);
12390
- function collectionImpl(name, allowPaths) {
12161
+ function funcNil1(func) {
12391
12162
  return {
12392
- name,
12393
- impl: ({ ACTION, AT_LEAST_ONE, SUBRULE, CONSUME }) => (C) => {
12394
- const terms = [];
12395
- const startToken = CONSUME(symbols_exports.LParen);
12396
- AT_LEAST_ONE(() => {
12397
- terms.push(SUBRULE(allowPaths ? graphNodePath : graphNode, void 0));
12398
- });
12399
- const endToken = CONSUME(symbols_exports.RParen);
12400
- return ACTION(() => {
12401
- const F2 = C.factory;
12402
- const triples = [];
12403
- const predFirst = F2.namedNode(F2.sourceLocationNoMaterialize(), "http://www.w3.org/1999/02/22-rdf-syntax-ns#first" /* FIRST */, void 0);
12404
- const predRest = F2.namedNode(F2.sourceLocationNoMaterialize(), "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest" /* REST */, void 0);
12405
- const predNil = F2.namedNode(F2.sourceLocationNoMaterialize(), "http://www.w3.org/1999/02/22-rdf-syntax-ns#nil" /* NIL */, void 0);
12406
- const listHead = F2.blankNode(void 0, F2.sourceLocationNoMaterialize());
12407
- let iterHead = listHead;
12408
- for (const [index, term] of terms.entries()) {
12409
- const lastInList = index === terms.length - 1;
12410
- const headTriple = F2.triple(
12411
- iterHead,
12412
- predFirst,
12413
- term
12414
- );
12415
- triples.push(headTriple);
12416
- if (lastInList) {
12417
- const nilTriple = F2.triple(iterHead, predRest, predNil);
12418
- triples.push(nilTriple);
12419
- } else {
12420
- const tail = F2.blankNode(void 0, F2.sourceLocationNoMaterialize());
12421
- const linkTriple = F2.triple(iterHead, predRest, tail);
12422
- triples.push(linkTriple);
12423
- iterHead = tail;
12424
- }
12425
- }
12426
- return F2.tripleCollectionList(listHead, triples, F2.sourceLocation(startToken, endToken));
12427
- });
12428
- },
12429
- gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F2 }) => {
12430
- F2.printFilter(ast, () => PRINT_WORD("("));
12431
- for (const [idx, triple] of ast.triples.entries()) {
12432
- if (idx % 2 === 0) {
12433
- SUBRULE(allowPaths ? graphNodePath : graphNode, triple.object, void 0);
12434
- }
12435
- }
12436
- F2.printFilter(ast, () => PRINT_WORD(")"));
12163
+ name: unCapitalize(func.name),
12164
+ impl: ({ ACTION, CONSUME }) => (C) => {
12165
+ const operator = CONSUME(func);
12166
+ const nil2 = CONSUME(terminals_exports.nil);
12167
+ return ACTION(() => C.factory.expressionOperation(operator.image, [], C.factory.sourceLocation(operator, nil2)));
12437
12168
  }
12438
12169
  };
12439
12170
  }
12440
- var collection = collectionImpl("collection", false);
12441
- var collectionPath = collectionImpl("collectionPath", true);
12442
- function triplesNodeImpl(name, allowPaths) {
12171
+ function funcExprList1(func) {
12443
12172
  return {
12444
- name,
12445
- impl: ({ SUBRULE, OR }) => () => OR([
12446
- { ALT: () => SUBRULE(allowPaths ? collectionPath : collection, void 0) },
12447
- { ALT: () => SUBRULE(allowPaths ? blankNodePropertyListPath : blankNodePropertyList, void 0) }
12448
- ]),
12449
- gImpl: ({ SUBRULE }) => (ast) => ast.subType === "list" ? SUBRULE(allowPaths ? collectionPath : collection, ast, void 0) : SUBRULE(allowPaths ? blankNodePropertyListPath : blankNodePropertyList, ast, void 0)
12173
+ name: unCapitalize(func.name),
12174
+ impl: ({ ACTION, CONSUME, SUBRULE }) => (C) => {
12175
+ const operator = CONSUME(func);
12176
+ const args = SUBRULE(expressionList);
12177
+ return ACTION(() => C.factory.expressionOperation(operator.image, args.val, C.factory.sourceLocation(operator, args)));
12178
+ }
12450
12179
  };
12451
12180
  }
12452
- var triplesNode = triplesNodeImpl("triplesNode", false);
12453
- var triplesNodePath = triplesNodeImpl("triplesNodePath", true);
12454
- function blankNodePropertyListImpl(name, allowPaths) {
12455
- const propertyPathNotEmptyImpl = allowPaths ? propertyListPathNotEmpty : propertyListNotEmpty;
12181
+ function funcExpr2or3(func) {
12456
12182
  return {
12457
- name,
12183
+ name: unCapitalize(func.name),
12184
+ impl: ({ ACTION, CONSUME, SUBRULE1, SUBRULE2, SUBRULE3, CONSUME1, OPTION, CONSUME2 }) => (C) => {
12185
+ const operator = CONSUME(func);
12186
+ CONSUME(symbols_exports.LParen);
12187
+ const arg1 = SUBRULE1(expression);
12188
+ CONSUME1(symbols_exports.comma);
12189
+ const arg2 = SUBRULE2(expression);
12190
+ const arg3 = OPTION(() => {
12191
+ CONSUME2(symbols_exports.comma);
12192
+ return SUBRULE3(expression);
12193
+ });
12194
+ const close = CONSUME(symbols_exports.RParen);
12195
+ return ACTION(() => C.factory.expressionOperation(
12196
+ operator.image,
12197
+ arg3 ? [arg1, arg2, arg3] : [arg1, arg2],
12198
+ C.factory.sourceLocation(operator, close)
12199
+ ));
12200
+ }
12201
+ };
12202
+ }
12203
+ function funcExpr3or4(func) {
12204
+ return {
12205
+ name: unCapitalize(func.name),
12206
+ impl: ({
12207
+ ACTION,
12208
+ CONSUME,
12209
+ SUBRULE1,
12210
+ SUBRULE2,
12211
+ SUBRULE3,
12212
+ SUBRULE4,
12213
+ CONSUME1,
12214
+ OPTION,
12215
+ CONSUME2,
12216
+ CONSUME3
12217
+ }) => (C) => {
12218
+ const operator = CONSUME(func);
12219
+ CONSUME(symbols_exports.LParen);
12220
+ const arg1 = SUBRULE1(expression);
12221
+ CONSUME1(symbols_exports.comma);
12222
+ const arg2 = SUBRULE2(expression);
12223
+ CONSUME2(symbols_exports.comma);
12224
+ const arg3 = SUBRULE3(expression);
12225
+ const arg4 = OPTION(() => {
12226
+ CONSUME3(symbols_exports.comma);
12227
+ return SUBRULE4(expression);
12228
+ });
12229
+ const close = CONSUME(symbols_exports.RParen);
12230
+ return ACTION(() => C.factory.expressionOperation(
12231
+ operator.image,
12232
+ arg4 ? [arg1, arg2, arg3, arg4] : [arg1, arg2, arg3],
12233
+ C.factory.sourceLocation(operator, close)
12234
+ ));
12235
+ }
12236
+ };
12237
+ }
12238
+ function funcGroupGraphPattern(func) {
12239
+ return {
12240
+ name: unCapitalize(func.name),
12458
12241
  impl: ({ ACTION, SUBRULE, CONSUME }) => (C) => {
12459
- const startToken = CONSUME(symbols_exports.LSquare);
12460
- const blankNode2 = ACTION(() => C.factory.blankNode(void 0, C.factory.sourceLocationNoMaterialize()));
12461
- const propList = SUBRULE(propertyPathNotEmptyImpl, { subject: blankNode2 });
12462
- const endToken = CONSUME(symbols_exports.RSquare);
12463
- return ACTION(() => C.factory.tripleCollectionBlankNodeProperties(
12464
- blankNode2,
12465
- propList,
12466
- C.factory.sourceLocation(startToken, endToken)
12242
+ const operator = CONSUME(func);
12243
+ const group = SUBRULE(groupGraphPattern);
12244
+ return ACTION(() => C.factory.expressionPatternOperation(
12245
+ operator.image,
12246
+ group,
12247
+ C.factory.sourceLocation(operator, group)
12467
12248
  ));
12468
- },
12469
- gImpl: ({ SUBRULE, PRINT, PRINT_WORD, HANDLE_LOC }) => (ast, { factory: F2 }) => {
12470
- F2.printFilter(ast, () => PRINT("["));
12471
- for (const triple of ast.triples) {
12472
- HANDLE_LOC(triple, () => {
12473
- if (F2.isTerm(triple.predicate) && F2.isTermVariable(triple.predicate)) {
12474
- SUBRULE(varOrTerm, triple.predicate, void 0);
12475
- } else {
12476
- SUBRULE(pathGenerator, triple.predicate, void 0);
12477
- }
12478
- SUBRULE(graphNodePath, triple.object, void 0);
12479
- F2.printFilter(ast, () => PRINT_WORD(";"));
12480
- });
12481
- }
12482
- F2.printFilter(ast, () => PRINT("]"));
12483
12249
  }
12484
12250
  };
12485
12251
  }
12486
- var blankNodePropertyList = blankNodePropertyListImpl("blankNodePropertyList", false);
12487
- var blankNodePropertyListPath = blankNodePropertyListImpl("blankNodePropertyListPath", true);
12488
- function graphNodeImpl(name, allowPaths) {
12489
- const triplesNodeRule = allowPaths ? triplesNodePath : triplesNode;
12252
+ function baseAggregateFunc(func) {
12490
12253
  return {
12491
- name,
12492
- impl: ({ SUBRULE, OR }) => (C) => OR([
12493
- { ALT: () => SUBRULE(varOrTerm, void 0) },
12494
- {
12495
- GATE: () => C.parseMode.has("canCreateBlankNodes"),
12496
- ALT: () => SUBRULE(triplesNodeRule, void 0)
12497
- }
12498
- ]),
12499
- gImpl: ({ SUBRULE }) => (ast, { factory: F2 }) => {
12500
- if (F2.isTerm(ast)) {
12501
- SUBRULE(varOrTerm, ast, void 0);
12502
- } else {
12503
- SUBRULE(triplesNodeRule, ast, void 0);
12504
- }
12254
+ name: unCapitalize(func.name),
12255
+ impl: ({ ACTION, CONSUME, SUBRULE, OPTION }) => (C) => {
12256
+ const operator = CONSUME(func);
12257
+ CONSUME(symbols_exports.LParen);
12258
+ const distinct2 = OPTION(() => CONSUME(distinct));
12259
+ const expr1 = SUBRULE(expression);
12260
+ const close = CONSUME(symbols_exports.RParen);
12261
+ return ACTION(() => C.factory.aggregate(
12262
+ operator.image,
12263
+ distinct2 !== void 0,
12264
+ expr1,
12265
+ void 0,
12266
+ C.factory.sourceLocation(operator, close)
12267
+ ));
12505
12268
  }
12506
12269
  };
12507
12270
  }
12508
- var graphNode = graphNodeImpl("graphNode", false);
12509
- var graphNodePath = graphNodeImpl("graphNodePath", true);
12510
12271
 
12511
- // ../../packages/rules-sparql-1-1/lib/grammar/whereClause.ts
12512
- var whereClause = {
12513
- name: "whereClause",
12514
- impl: ({ ACTION, SUBRULE, CONSUME, OPTION }) => (C) => {
12515
- const where2 = OPTION(() => CONSUME(where));
12516
- const group = SUBRULE(groupGraphPattern, void 0);
12517
- return ACTION(() => C.factory.wrap(group, C.factory.sourceLocation(where2, group)));
12518
- },
12519
- gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F2 }) => {
12520
- F2.printFilter(ast, () => PRINT_WORD("WHERE"));
12521
- SUBRULE(groupGraphPattern, ast.val, void 0);
12522
- }
12523
- };
12524
- var groupGraphPattern = {
12525
- name: "groupGraphPattern",
12526
- impl: ({ ACTION, SUBRULE, CONSUME, OR }) => (C) => {
12527
- const open = CONSUME(symbols_exports.LCurly);
12528
- const patterns = OR([
12529
- { ALT: () => [SUBRULE(subSelect, void 0)] },
12530
- { ALT: () => SUBRULE(groupGraphPatternSub, void 0) }
12531
- ]);
12532
- const close = CONSUME(symbols_exports.RCurly);
12533
- return ACTION(() => C.factory.patternGroup(patterns, C.factory.sourceLocation(open, close)));
12534
- },
12535
- gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F2 }) => {
12536
- F2.printFilter(ast, () => PRINT_WORD("{"));
12537
- for (const pattern of ast.patterns) {
12538
- SUBRULE(generatePattern, pattern, void 0);
12539
- }
12540
- F2.printFilter(ast, () => PRINT_WORD("}"));
12541
- }
12542
- };
12543
- var generatePattern = {
12544
- name: "generatePattern",
12545
- gImpl: ({ SUBRULE }) => (ast, { factory: F2 }) => {
12546
- if (ast.type === "query") {
12547
- SUBRULE(query, F2.querySelect({
12548
- context: [],
12549
- datasets: F2.datasetClauses([], F2.sourceLocation()),
12550
- where: ast.where,
12551
- variables: ast.variables,
12552
- solutionModifiers: ast.solutionModifiers,
12553
- values: ast.values,
12554
- distinct: ast.distinct,
12555
- reduced: ast.reduced
12556
- }, ast.loc), void 0);
12557
- } else if (ast.subType === "group") {
12558
- SUBRULE(groupGraphPattern, ast, void 0);
12559
- } else if (ast.subType === "bgp") {
12560
- SUBRULE(triplesBlock, ast, void 0);
12561
- } else {
12562
- SUBRULE(graphPatternNotTriples, ast, void 0);
12272
+ // ../../packages/rules-sparql-1-1/lib/grammar/builtIn.ts
12273
+ var builtInStr = funcExpr1(BuiltInCalls_exports.str);
12274
+ var builtInLang = funcExpr1(BuiltInCalls_exports.lang);
12275
+ var builtInLangmatches = funcExpr2(BuiltInCalls_exports.langmatches);
12276
+ var builtInDatatype = funcExpr1(BuiltInCalls_exports.datatype);
12277
+ var builtInBound = funcVar1(BuiltInCalls_exports.bound);
12278
+ var builtInIri = funcExpr1(BuiltInCalls_exports.iri);
12279
+ var builtInUri = funcExpr1(BuiltInCalls_exports.uri);
12280
+ var builtInBnodeSparqlJs = funcExprOrNil1(BuiltInCalls_exports.bnode);
12281
+ var builtInRand = funcNil1(BuiltInCalls_exports.rand);
12282
+ var builtInAbs = funcExpr1(BuiltInCalls_exports.abs);
12283
+ var builtInCeil = funcExpr1(BuiltInCalls_exports.ceil);
12284
+ var builtInFloor = funcExpr1(BuiltInCalls_exports.floor);
12285
+ var builtInRound = funcExpr1(BuiltInCalls_exports.round);
12286
+ var builtInConcat = funcExprList1(BuiltInCalls_exports.concat);
12287
+ var builtInStrlen = funcExpr1(BuiltInCalls_exports.strlen);
12288
+ var builtInUcase = funcExpr1(BuiltInCalls_exports.ucase);
12289
+ var builtInLcase = funcExpr1(BuiltInCalls_exports.lcase);
12290
+ var builtInEncode_for_uri = funcExpr1(BuiltInCalls_exports.encode_for_uri);
12291
+ var builtInContains = funcExpr2(BuiltInCalls_exports.contains);
12292
+ var builtInStrstarts = funcExpr2(BuiltInCalls_exports.strstarts);
12293
+ var builtInStrends = funcExpr2(BuiltInCalls_exports.strends);
12294
+ var builtInStrbefore = funcExpr2(BuiltInCalls_exports.strbefore);
12295
+ var builtInStrafter = funcExpr2(BuiltInCalls_exports.strafter);
12296
+ var builtInYear = funcExpr1(BuiltInCalls_exports.year);
12297
+ var builtInMonth = funcExpr1(BuiltInCalls_exports.month);
12298
+ var builtInDay = funcExpr1(BuiltInCalls_exports.day);
12299
+ var builtInHours = funcExpr1(BuiltInCalls_exports.hours);
12300
+ var builtInMinutes = funcExpr1(BuiltInCalls_exports.minutes);
12301
+ var builtInSeconds = funcExpr1(BuiltInCalls_exports.seconds);
12302
+ var builtInTimezone = funcExpr1(BuiltInCalls_exports.timezone);
12303
+ var builtInTz = funcExpr1(BuiltInCalls_exports.tz);
12304
+ var builtInNow = funcNil1(BuiltInCalls_exports.now);
12305
+ var builtInUuid = funcNil1(BuiltInCalls_exports.uuid);
12306
+ var builtInStruuid = funcNil1(BuiltInCalls_exports.struuid);
12307
+ var builtInMd5 = funcExpr1(BuiltInCalls_exports.md5);
12308
+ var builtInSha1 = funcExpr1(BuiltInCalls_exports.sha1);
12309
+ var builtInSha256 = funcExpr1(BuiltInCalls_exports.sha256);
12310
+ var builtInSha384 = funcExpr1(BuiltInCalls_exports.sha384);
12311
+ var builtInSha512 = funcExpr1(BuiltInCalls_exports.sha512);
12312
+ var builtInCoalesce = funcExprList1(BuiltInCalls_exports.coalesce);
12313
+ var builtInIf = funcExpr3(BuiltInCalls_exports.if_);
12314
+ var builtInStrlang = funcExpr2(BuiltInCalls_exports.strlang);
12315
+ var builtInStrdt = funcExpr2(BuiltInCalls_exports.strdt);
12316
+ var builtInSameterm = funcExpr2(BuiltInCalls_exports.sameterm);
12317
+ var builtInIsiri = funcExpr1(BuiltInCalls_exports.isiri);
12318
+ var builtInIsuri = funcExpr1(BuiltInCalls_exports.isuri);
12319
+ var builtInIsblank = funcExpr1(BuiltInCalls_exports.isblank);
12320
+ var builtInIsliteral = funcExpr1(BuiltInCalls_exports.isliteral);
12321
+ var builtInIsnumeric = funcExpr1(BuiltInCalls_exports.isnumeric);
12322
+ function builtInCallList(SUBRULE) {
12323
+ return [
12324
+ { ALT: () => SUBRULE(aggregate) },
12325
+ { ALT: () => SUBRULE(builtInStr) },
12326
+ { ALT: () => SUBRULE(builtInLang) },
12327
+ { ALT: () => SUBRULE(builtInLangmatches) },
12328
+ { ALT: () => SUBRULE(builtInDatatype) },
12329
+ { ALT: () => SUBRULE(builtInBound) },
12330
+ { ALT: () => SUBRULE(builtInIri) },
12331
+ { ALT: () => SUBRULE(builtInUri) },
12332
+ { ALT: () => SUBRULE(builtInBnodeSparqlJs) },
12333
+ { ALT: () => SUBRULE(builtInRand) },
12334
+ { ALT: () => SUBRULE(builtInAbs) },
12335
+ { ALT: () => SUBRULE(builtInCeil) },
12336
+ { ALT: () => SUBRULE(builtInFloor) },
12337
+ { ALT: () => SUBRULE(builtInRound) },
12338
+ { ALT: () => SUBRULE(builtInConcat) },
12339
+ { ALT: () => SUBRULE(substringExpression) },
12340
+ { ALT: () => SUBRULE(builtInStrlen) },
12341
+ { ALT: () => SUBRULE(strReplaceExpression) },
12342
+ { ALT: () => SUBRULE(builtInUcase) },
12343
+ { ALT: () => SUBRULE(builtInLcase) },
12344
+ { ALT: () => SUBRULE(builtInEncode_for_uri) },
12345
+ { ALT: () => SUBRULE(builtInContains) },
12346
+ { ALT: () => SUBRULE(builtInStrstarts) },
12347
+ { ALT: () => SUBRULE(builtInStrends) },
12348
+ { ALT: () => SUBRULE(builtInStrbefore) },
12349
+ { ALT: () => SUBRULE(builtInStrafter) },
12350
+ { ALT: () => SUBRULE(builtInYear) },
12351
+ { ALT: () => SUBRULE(builtInMonth) },
12352
+ { ALT: () => SUBRULE(builtInDay) },
12353
+ { ALT: () => SUBRULE(builtInHours) },
12354
+ { ALT: () => SUBRULE(builtInMinutes) },
12355
+ { ALT: () => SUBRULE(builtInSeconds) },
12356
+ { ALT: () => SUBRULE(builtInTimezone) },
12357
+ { ALT: () => SUBRULE(builtInTz) },
12358
+ { ALT: () => SUBRULE(builtInNow) },
12359
+ { ALT: () => SUBRULE(builtInUuid) },
12360
+ { ALT: () => SUBRULE(builtInStruuid) },
12361
+ { ALT: () => SUBRULE(builtInMd5) },
12362
+ { ALT: () => SUBRULE(builtInSha1) },
12363
+ { ALT: () => SUBRULE(builtInSha256) },
12364
+ { ALT: () => SUBRULE(builtInSha384) },
12365
+ { ALT: () => SUBRULE(builtInSha512) },
12366
+ { ALT: () => SUBRULE(builtInCoalesce) },
12367
+ { ALT: () => SUBRULE(builtInIf) },
12368
+ { ALT: () => SUBRULE(builtInStrlang) },
12369
+ { ALT: () => SUBRULE(builtInStrdt) },
12370
+ { ALT: () => SUBRULE(builtInSameterm) },
12371
+ { ALT: () => SUBRULE(builtInIsiri) },
12372
+ { ALT: () => SUBRULE(builtInIsuri) },
12373
+ { ALT: () => SUBRULE(builtInIsblank) },
12374
+ { ALT: () => SUBRULE(builtInIsliteral) },
12375
+ { ALT: () => SUBRULE(builtInIsnumeric) },
12376
+ { ALT: () => SUBRULE(regexExpression) },
12377
+ { ALT: () => SUBRULE(existsFunc) },
12378
+ { ALT: () => SUBRULE(notExistsFunc) }
12379
+ ];
12380
+ }
12381
+ var builtInCall = {
12382
+ name: "builtInCall",
12383
+ impl: ({ OR, SUBRULE, cache }) => () => {
12384
+ const cached = cache.get(builtInCall);
12385
+ if (cached) {
12386
+ return OR(cached);
12563
12387
  }
12388
+ const builtIns = builtInCallList(SUBRULE);
12389
+ cache.set(builtInCall, builtIns);
12390
+ return OR(builtIns);
12564
12391
  }
12565
12392
  };
12566
- var groupGraphPatternSub = {
12567
- name: "groupGraphPatternSub",
12568
- impl: ({ ACTION, SUBRULE, CONSUME, MANY, SUBRULE1, SUBRULE2, OPTION1, OPTION2, OPTION3 }) => () => {
12569
- const patterns = [];
12570
- const bgpPattern = OPTION1(() => SUBRULE1(triplesBlock, void 0));
12571
- if (bgpPattern) {
12572
- patterns.push(bgpPattern);
12573
- }
12574
- MANY(() => {
12575
- const notTriples = SUBRULE(graphPatternNotTriples, void 0);
12576
- patterns.push(notTriples);
12577
- OPTION2(() => CONSUME(symbols_exports.dot));
12578
- const moreTriples = OPTION3(() => SUBRULE2(triplesBlock, void 0));
12579
- if (moreTriples) {
12580
- patterns.push(moreTriples);
12393
+ var regexExpression = funcExpr2or3(BuiltInCalls_exports.regex);
12394
+ var substringExpression = funcExpr2or3(BuiltInCalls_exports.substr);
12395
+ var strReplaceExpression = funcExpr3or4(BuiltInCalls_exports.replace);
12396
+ var existsFunc = funcGroupGraphPattern(BuiltInCalls_exports.exists);
12397
+ var notExistsFunc = funcGroupGraphPattern(BuiltInCalls_exports.notexists);
12398
+ var aggregateCount = {
12399
+ name: unCapitalize(BuiltInCalls_exports.count.name),
12400
+ impl: ({ ACTION, CONSUME, SUBRULE, OR, OPTION }) => (C) => {
12401
+ const operatorToken = CONSUME(BuiltInCalls_exports.count);
12402
+ CONSUME(symbols_exports.LParen);
12403
+ const distinctToken = OPTION(() => CONSUME(distinct));
12404
+ const expressionVal = OR([
12405
+ { ALT: () => {
12406
+ const starToken = CONSUME(symbols_exports.star);
12407
+ return ACTION(() => C.factory.wildcard(C.factory.sourceLocation(starToken)));
12408
+ } },
12409
+ { ALT: () => SUBRULE(expression) }
12410
+ ]);
12411
+ const closeToken = CONSUME(symbols_exports.RParen);
12412
+ return ACTION(() => {
12413
+ const F2 = C.factory;
12414
+ if (C.factory.isWildcard(expressionVal)) {
12415
+ return F2.aggregate(
12416
+ operatorToken.image,
12417
+ Boolean(distinctToken),
12418
+ expressionVal,
12419
+ void 0,
12420
+ C.factory.sourceLocation(operatorToken, closeToken)
12421
+ );
12581
12422
  }
12423
+ return F2.aggregate(
12424
+ operatorToken.image,
12425
+ Boolean(distinctToken),
12426
+ expressionVal,
12427
+ void 0,
12428
+ C.factory.sourceLocation(operatorToken, closeToken)
12429
+ );
12582
12430
  });
12583
- ACTION(() => checkNote13(patterns));
12584
- return patterns;
12585
12431
  }
12586
12432
  };
12587
- var graphPatternNotTriples = {
12588
- name: "graphPatternNotTriples",
12589
- impl: ({ SUBRULE, OR }) => () => OR([
12590
- { ALT: () => SUBRULE(groupOrUnionGraphPattern, void 0) },
12591
- { ALT: () => SUBRULE(optionalGraphPattern, void 0) },
12592
- { ALT: () => SUBRULE(minusGraphPattern, void 0) },
12593
- { ALT: () => SUBRULE(graphGraphPattern, void 0) },
12594
- { ALT: () => SUBRULE(serviceGraphPattern, void 0) },
12595
- { ALT: () => SUBRULE(filter3, void 0) },
12596
- { ALT: () => SUBRULE(bind2, void 0) },
12597
- { ALT: () => SUBRULE(inlineData, void 0) }
12598
- ]),
12599
- gImpl: ({ SUBRULE }) => (ast) => {
12600
- switch (ast.subType) {
12601
- case "group":
12602
- case "union":
12603
- SUBRULE(groupOrUnionGraphPattern, ast, void 0);
12604
- break;
12605
- case "optional":
12606
- SUBRULE(optionalGraphPattern, ast, void 0);
12607
- break;
12608
- case "minus":
12609
- SUBRULE(minusGraphPattern, ast, void 0);
12610
- break;
12611
- case "graph":
12612
- SUBRULE(graphGraphPattern, ast, void 0);
12613
- break;
12614
- case "service":
12615
- SUBRULE(serviceGraphPattern, ast, void 0);
12616
- break;
12617
- case "filter":
12618
- SUBRULE(filter3, ast, void 0);
12619
- break;
12620
- case "bind":
12621
- SUBRULE(bind2, ast, void 0);
12622
- break;
12623
- case "values":
12624
- SUBRULE(inlineData, ast, void 0);
12625
- break;
12626
- }
12433
+ var aggregateSum = baseAggregateFunc(BuiltInCalls_exports.sum);
12434
+ var aggregateMin = baseAggregateFunc(BuiltInCalls_exports.min);
12435
+ var aggregateMax = baseAggregateFunc(BuiltInCalls_exports.max);
12436
+ var aggregateAvg = baseAggregateFunc(BuiltInCalls_exports.avg);
12437
+ var aggregateSample = baseAggregateFunc(BuiltInCalls_exports.sample);
12438
+ var aggregateGroup_concat = {
12439
+ name: unCapitalize(BuiltInCalls_exports.groupConcat.name),
12440
+ impl: ({ ACTION, CONSUME, OPTION1, SUBRULE, OPTION2 }) => (C) => {
12441
+ const operatorToken = CONSUME(BuiltInCalls_exports.groupConcat);
12442
+ CONSUME(symbols_exports.LParen);
12443
+ const distinctToken = OPTION1(() => CONSUME(distinct));
12444
+ const expr = SUBRULE(expression);
12445
+ const sep = OPTION2(() => {
12446
+ CONSUME(symbols_exports.semi);
12447
+ CONSUME(separator);
12448
+ CONSUME(symbols_exports.equal);
12449
+ return SUBRULE(string);
12450
+ });
12451
+ const closeToken = CONSUME(symbols_exports.RParen);
12452
+ return ACTION(() => {
12453
+ const F2 = C.factory;
12454
+ return F2.aggregate(
12455
+ operatorToken.image,
12456
+ Boolean(distinctToken),
12457
+ expr,
12458
+ sep?.value ?? " ",
12459
+ F2.sourceLocation(operatorToken, closeToken)
12460
+ );
12461
+ });
12627
12462
  }
12628
12463
  };
12629
- var optionalGraphPattern = {
12630
- name: "optionalGraphPattern",
12631
- impl: ({ ACTION, SUBRULE, CONSUME }) => (C) => {
12632
- const optional2 = CONSUME(optional);
12633
- const group = SUBRULE(groupGraphPattern, void 0);
12634
- return ACTION(() => C.factory.patternOptional(group.patterns, C.factory.sourceLocation(optional2, group)));
12635
- },
12636
- gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F2 }) => {
12637
- F2.printFilter(ast, () => PRINT_WORD("OPTIONAL"));
12638
- SUBRULE(groupGraphPattern, F2.patternGroup(ast.patterns, ast.loc), void 0);
12639
- }
12640
- };
12641
- var graphGraphPattern = {
12642
- name: "graphGraphPattern",
12643
- impl: ({ ACTION, SUBRULE, CONSUME }) => (C) => {
12644
- const graph2 = CONSUME(graph_exports.graph);
12645
- const name = SUBRULE(varOrIri, void 0);
12646
- const group = SUBRULE(groupGraphPattern, void 0);
12647
- return ACTION(() => C.factory.patternGraph(name, group.patterns, C.factory.sourceLocation(graph2, group)));
12648
- },
12649
- gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F2 }) => {
12650
- F2.printFilter(ast, () => PRINT_WORD("GRAPH"));
12651
- SUBRULE(varOrTerm, ast.name, void 0);
12652
- SUBRULE(groupGraphPattern, F2.patternGroup(ast.patterns, ast.loc), void 0);
12653
- }
12654
- };
12655
- var serviceGraphPattern = {
12656
- name: "serviceGraphPattern",
12657
- impl: ({ ACTION, SUBRULE1, CONSUME, OPTION }) => (C) => {
12658
- const service2 = CONSUME(service);
12659
- const silent2 = OPTION(() => {
12660
- CONSUME(silent);
12661
- return true;
12662
- }) ?? false;
12663
- const name = SUBRULE1(varOrIri, void 0);
12664
- const group = SUBRULE1(groupGraphPattern, void 0);
12665
- return ACTION(() => C.factory.patternService(name, group.patterns, silent2, C.factory.sourceLocation(service2, group)));
12464
+ var aggregate = {
12465
+ name: "aggregate",
12466
+ impl: ({ ACTION, SUBRULE, OR }) => (C) => {
12467
+ const wasInAggregate = ACTION(() => C.parseMode.has("inAggregate"));
12468
+ ACTION(() => C.parseMode.add("inAggregate"));
12469
+ const result = OR([
12470
+ { ALT: () => SUBRULE(aggregateCount) },
12471
+ { ALT: () => SUBRULE(aggregateSum) },
12472
+ { ALT: () => SUBRULE(aggregateMin) },
12473
+ { ALT: () => SUBRULE(aggregateMax) },
12474
+ { ALT: () => SUBRULE(aggregateAvg) },
12475
+ { ALT: () => SUBRULE(aggregateSample) },
12476
+ { ALT: () => SUBRULE(aggregateGroup_concat) }
12477
+ ]);
12478
+ ACTION(() => !wasInAggregate && C.parseMode.delete("inAggregate"));
12479
+ ACTION(() => {
12480
+ if (!C.parseMode.has("canParseAggregate")) {
12481
+ throw new Error("Aggregates are only allowed in SELECT, HAVING, and ORDER BY clauses.");
12482
+ }
12483
+ if (C.parseMode.has("inAggregate")) {
12484
+ throw new Error("An aggregate function is not allowed within an aggregate function.");
12485
+ }
12486
+ });
12487
+ return result;
12666
12488
  },
12667
12489
  gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F2 }) => {
12668
12490
  F2.printFilter(ast, () => {
12669
- PRINT_WORD("SERVICE");
12670
- if (ast.silent) {
12671
- PRINT_WORD("SILENT");
12491
+ PRINT_WORD(ast.aggregation, "(");
12492
+ if (ast.distinct) {
12493
+ PRINT_WORD("DISTINCT");
12672
12494
  }
12673
12495
  });
12674
- SUBRULE(varOrTerm, ast.name, void 0);
12675
- SUBRULE(groupGraphPattern, F2.patternGroup(ast.patterns, ast.loc), void 0);
12676
- }
12677
- };
12678
- var bind2 = {
12679
- name: "bind",
12680
- impl: ({ ACTION, SUBRULE, CONSUME }) => (C) => {
12681
- const bind3 = CONSUME(bind);
12682
- CONSUME(symbols_exports.LParen);
12683
- const expressionVal = SUBRULE(expression, void 0);
12684
- CONSUME(as);
12685
- const variable = SUBRULE(var_, void 0);
12686
- const close = CONSUME(symbols_exports.RParen);
12687
- return ACTION(() => C.factory.patternBind(expressionVal, variable, C.factory.sourceLocation(bind3, close)));
12688
- },
12689
- gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F2 }) => {
12690
- F2.printFilter(ast, () => PRINT_WORD("BIND", "("));
12691
- SUBRULE(expression, ast.expression, void 0);
12692
- F2.printFilter(ast, () => PRINT_WORD("AS"));
12693
- SUBRULE(var_, ast.variable, void 0);
12496
+ const arg = ast.expression[0];
12497
+ if (F2.isWildcard(arg)) {
12498
+ F2.printFilter(ast, () => PRINT_WORD("*"));
12499
+ } else {
12500
+ SUBRULE(expression, arg);
12501
+ }
12502
+ if (F2.isExpressionAggregateSeparator(ast)) {
12503
+ F2.printFilter(ast, () => PRINT_WORD(";", "SEPARATOR", "=", stringEscapedLexical(ast.separator)));
12504
+ }
12694
12505
  F2.printFilter(ast, () => PRINT_WORD(")"));
12695
12506
  }
12696
12507
  };
12697
- var inlineData = {
12698
- name: "inlineData",
12699
- impl: ({ ACTION, SUBRULE, CONSUME }) => (C) => {
12700
- const values3 = CONSUME(values2);
12701
- const datablock = SUBRULE(dataBlock, void 0);
12702
- return ACTION(() => C.factory.patternValues(datablock.val, C.factory.sourceLocation(values3, datablock)));
12703
- },
12704
- gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F2 }) => {
12705
- const variables = Object.keys(ast.values[0]);
12706
- F2.printFilter(ast, () => {
12707
- PRINT_WORD("VALUES", "(");
12708
- for (const variable of variables) {
12709
- PRINT_WORD(`?${variable}`);
12710
- }
12711
- PRINT_WORD(")", "{");
12712
- });
12713
- for (const mapping of ast.values) {
12714
- F2.printFilter(ast, () => PRINT_WORD("("));
12715
- for (const variable of variables) {
12716
- if (mapping[variable] === void 0) {
12717
- F2.printFilter(ast, () => PRINT_WORD("UNDEF"));
12718
- } else {
12719
- SUBRULE(graphNodePath, mapping[variable], void 0);
12508
+
12509
+ // ../../packages/rules-sparql-1-1/lib/grammar/propertyPaths.ts
12510
+ var path = {
12511
+ name: "path",
12512
+ impl: ({ SUBRULE }) => () => SUBRULE(pathAlternative)
12513
+ };
12514
+ var pathGenerator = {
12515
+ name: "path",
12516
+ gImpl: ({ PRINT, SUBRULE }) => (ast, { factory: F2 }, braces = true) => {
12517
+ if (F2.isTerm(ast) && F2.isTermNamed(ast)) {
12518
+ SUBRULE(iri2, ast);
12519
+ } else {
12520
+ F2.printFilter(ast, () => braces && PRINT("("));
12521
+ switch (ast.subType) {
12522
+ case "|":
12523
+ case "/": {
12524
+ const [head2, ...tail] = ast.items;
12525
+ SUBRULE(pathGenerator, head2, braces);
12526
+ for (const val of tail) {
12527
+ F2.printFilter(ast, () => PRINT(ast.subType));
12528
+ SUBRULE(pathGenerator, val, braces);
12529
+ }
12530
+ break;
12720
12531
  }
12532
+ case "^":
12533
+ F2.printFilter(ast, () => PRINT("^"));
12534
+ SUBRULE(pathGenerator, ast.items[0], braces);
12535
+ break;
12536
+ case "?":
12537
+ case "*":
12538
+ case "+":
12539
+ SUBRULE(pathGenerator, ast.items[0], braces);
12540
+ F2.printFilter(ast, () => PRINT(ast.subType));
12541
+ break;
12542
+ case "!":
12543
+ F2.printFilter(ast, () => PRINT("!"));
12544
+ F2.printFilter(ast, () => PRINT("("));
12545
+ SUBRULE(pathGenerator, ast.items[0], false);
12546
+ F2.printFilter(ast, () => PRINT(")"));
12547
+ break;
12721
12548
  }
12722
- F2.printFilter(ast, () => PRINT_WORD(")"));
12549
+ F2.printFilter(ast, () => braces && PRINT(")"));
12723
12550
  }
12724
- F2.printFilter(ast, () => PRINT_WORD("}"));
12725
12551
  }
12726
12552
  };
12727
- var dataBlock = {
12728
- name: "dataBlock",
12729
- impl: ({ SUBRULE, OR }) => () => OR([
12730
- { ALT: () => SUBRULE(inlineDataOneVar, void 0) },
12731
- { ALT: () => SUBRULE(inlineDataFull, void 0) }
12553
+ function pathChainHelper(name, SEP, subType, subRule) {
12554
+ return {
12555
+ name,
12556
+ impl: ({ ACTION, CONSUME, SUBRULE1, SUBRULE2, MANY }) => (C) => {
12557
+ const head2 = SUBRULE1(subRule);
12558
+ let tailEnd = head2;
12559
+ const tail = [];
12560
+ MANY(() => {
12561
+ CONSUME(SEP);
12562
+ tailEnd = SUBRULE2(subRule);
12563
+ tail.push(tailEnd);
12564
+ });
12565
+ return ACTION(() => tail.length === 0 ? head2 : C.factory.path(subType, [head2, ...tail], C.factory.sourceLocation(head2, tailEnd)));
12566
+ }
12567
+ };
12568
+ }
12569
+ var pathEltOrInverse = {
12570
+ name: "pathEltOrInverse",
12571
+ impl: ({ ACTION, CONSUME, SUBRULE1, SUBRULE2, OR }) => (C) => OR([
12572
+ { ALT: () => SUBRULE1(pathElt) },
12573
+ { ALT: () => {
12574
+ const hat2 = CONSUME(symbols_exports.hat);
12575
+ const item = SUBRULE2(pathElt);
12576
+ return ACTION(() => C.factory.path("^", [item], C.factory.sourceLocation(hat2, item)));
12577
+ } }
12732
12578
  ])
12733
12579
  };
12734
- var inlineDataOneVar = {
12735
- name: "inlineDataOneVar",
12736
- impl: ({ ACTION, SUBRULE, CONSUME, MANY }) => (C) => {
12737
- const res = [];
12738
- const varVal = SUBRULE(var_, void 0);
12739
- CONSUME(symbols_exports.LCurly);
12740
- MANY(() => {
12741
- const value = SUBRULE(dataBlockValue, void 0);
12742
- ACTION(() => {
12743
- res.push({ [varVal.value]: value });
12744
- });
12745
- });
12746
- const close = CONSUME(symbols_exports.RCurly);
12747
- return ACTION(() => C.factory.wrap(res, C.factory.sourceLocation(varVal, close)));
12580
+ var pathSequence = pathChainHelper("pathSequence", symbols_exports.slash, "/", pathEltOrInverse);
12581
+ var pathAlternative = pathChainHelper("pathAlternative", symbols_exports.pipe, "|", pathSequence);
12582
+ var pathElt = {
12583
+ name: "pathElt",
12584
+ impl: ({ ACTION, SUBRULE, OPTION }) => (C) => {
12585
+ const item = SUBRULE(pathPrimary);
12586
+ const modification = OPTION(() => SUBRULE(pathMod));
12587
+ return ACTION(() => modification === void 0 ? item : C.factory.path(modification.image, [item], C.factory.sourceLocation(item, modification)));
12748
12588
  }
12749
12589
  };
12750
- var inlineDataFull = {
12751
- name: "inlineDataFull",
12752
- impl: ({
12753
- ACTION,
12754
- OR,
12755
- MANY1,
12756
- MANY2,
12757
- MANY3,
12758
- MANY4,
12759
- SUBRULE,
12760
- CONSUME1,
12761
- CONSUME2
12762
- }) => (C) => {
12763
- const res = [];
12764
- const vars = [];
12765
- return OR([
12766
- { ALT: () => {
12767
- const nil2 = CONSUME1(terminals_exports.nil);
12768
- CONSUME1(symbols_exports.LCurly);
12769
- MANY1(() => {
12770
- CONSUME2(terminals_exports.nil);
12771
- res.push({});
12772
- });
12773
- const close = CONSUME1(symbols_exports.RCurly);
12774
- return ACTION(() => C.factory.wrap(res, C.factory.sourceLocation(nil2, close)));
12775
- } },
12776
- { ALT: () => {
12777
- const open = CONSUME1(symbols_exports.LParen);
12778
- MANY2(() => {
12779
- vars.push(SUBRULE(var_, void 0));
12780
- });
12781
- CONSUME1(symbols_exports.RParen);
12782
- CONSUME2(symbols_exports.LCurly);
12783
- MANY3(() => {
12784
- let parsedValues = 0;
12785
- const currentRow = {};
12786
- CONSUME2(symbols_exports.LParen);
12787
- MANY4(() => {
12788
- if (parsedValues >= vars.length) {
12789
- throw new Error("Number of dataBlockValues does not match number of variables. Too much values.");
12790
- }
12791
- const value = SUBRULE(dataBlockValue, void 0);
12792
- ACTION(() => {
12793
- currentRow[vars[parsedValues].value] = value;
12794
- parsedValues++;
12795
- });
12796
- });
12797
- CONSUME2(symbols_exports.RParen);
12798
- ACTION(() => {
12799
- res.push(currentRow);
12800
- if (vars.length !== parsedValues) {
12801
- throw new Error("Number of dataBlockValues does not match number of variables. Too few values.");
12802
- }
12803
- });
12804
- });
12805
- const close = CONSUME2(symbols_exports.RCurly);
12806
- return ACTION(() => C.factory.wrap(res, C.factory.sourceLocation(open, close)));
12807
- } }
12808
- ]);
12809
- }
12590
+ var pathMod = {
12591
+ name: "pathMod",
12592
+ impl: ({ CONSUME, OR }) => () => OR([
12593
+ { ALT: () => CONSUME(symbols_exports.question) },
12594
+ { ALT: () => CONSUME(symbols_exports.star) },
12595
+ { ALT: () => CONSUME(symbols_exports.opPlus) }
12596
+ ])
12810
12597
  };
12811
- var dataBlockValue = {
12812
- name: "dataBlockValue",
12598
+ var pathPrimary = {
12599
+ name: "pathPrimary",
12813
12600
  impl: ({ SUBRULE, CONSUME, OR }) => () => OR([
12814
- { ALT: () => SUBRULE(iri2, void 0) },
12815
- { ALT: () => SUBRULE(rdfLiteral, void 0) },
12816
- { ALT: () => SUBRULE(numericLiteral, void 0) },
12817
- { ALT: () => SUBRULE(booleanLiteral, void 0) },
12601
+ { ALT: () => SUBRULE(iri2) },
12602
+ { ALT: () => SUBRULE(verbA) },
12603
+ { ALT: () => SUBRULE(pathNegatedPropertySet) },
12818
12604
  { ALT: () => {
12819
- CONSUME(undef);
12820
- return void 0;
12605
+ CONSUME(symbols_exports.LParen);
12606
+ const resRecursive = SUBRULE(path);
12607
+ CONSUME(symbols_exports.RParen);
12608
+ return resRecursive;
12821
12609
  } }
12822
12610
  ])
12823
12611
  };
12824
- var minusGraphPattern = {
12825
- name: "minusGraphPattern",
12826
- impl: ({ ACTION, SUBRULE, CONSUME }) => (C) => {
12827
- const minus2 = CONSUME(minus);
12828
- const group = SUBRULE(groupGraphPattern, void 0);
12829
- return ACTION(() => C.factory.patternMinus(group.patterns, C.factory.sourceLocation(minus2, group)));
12830
- },
12831
- gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F2 }) => {
12832
- F2.printFilter(ast, () => PRINT_WORD("MINUS"));
12833
- SUBRULE(groupGraphPattern, F2.patternGroup(ast.patterns, ast.loc), void 0);
12834
- }
12835
- };
12836
- var groupOrUnionGraphPattern = {
12837
- name: "groupOrUnionGraphPattern",
12838
- impl: ({ ACTION, MANY, SUBRULE1, SUBRULE2, CONSUME }) => (C) => {
12839
- const groups = [];
12840
- const group = SUBRULE1(groupGraphPattern, void 0);
12841
- groups.push(group);
12842
- MANY(() => {
12843
- CONSUME(union);
12844
- const group2 = SUBRULE2(groupGraphPattern, void 0);
12845
- groups.push(group2);
12846
- });
12847
- return ACTION(() => groups.length === 1 ? groups[0] : C.factory.patternUnion(
12848
- groups,
12849
- C.factory.sourceLocation(group, groups.at(-1))
12850
- ));
12851
- },
12852
- gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F2 }) => {
12853
- if (F2.isPatternUnion(ast)) {
12854
- const [head2, ...tail] = ast.patterns;
12855
- SUBRULE(groupGraphPattern, head2, void 0);
12856
- for (const pattern of tail) {
12857
- F2.printFilter(ast, () => PRINT_WORD("UNION"));
12858
- SUBRULE(groupGraphPattern, pattern, void 0);
12859
- }
12860
- } else {
12861
- SUBRULE(groupGraphPattern, ast, void 0);
12862
- }
12863
- }
12864
- };
12865
- var filter3 = {
12866
- name: "filter",
12867
- impl: ({ ACTION, SUBRULE, CONSUME }) => (C) => {
12868
- const filterToken = CONSUME(filter2);
12869
- const expression2 = SUBRULE(constraint, void 0);
12870
- return ACTION(() => C.factory.patternFilter(expression2, C.factory.sourceLocation(filterToken, expression2)));
12871
- },
12872
- gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F2 }) => {
12873
- F2.printFilter(ast, () => PRINT_WORD("FILTER ("));
12874
- SUBRULE(expression, ast.expression, void 0);
12875
- F2.printFilter(ast, () => PRINT_WORD(")"));
12612
+ var pathNegatedPropertySet = {
12613
+ name: "pathNegatedPropertySet",
12614
+ impl: ({ ACTION, CONSUME, SUBRULE1, SUBRULE2, SUBRULE3, OR, MANY }) => (C) => {
12615
+ const exclamation2 = CONSUME(symbols_exports.exclamation);
12616
+ return OR([
12617
+ { ALT: () => {
12618
+ const noAlternative = SUBRULE1(pathOneInPropertySet);
12619
+ return ACTION(() => C.factory.path("!", [noAlternative], C.factory.sourceLocation(exclamation2, noAlternative)));
12620
+ } },
12621
+ { ALT: () => {
12622
+ const open = CONSUME(symbols_exports.LParen);
12623
+ const head2 = SUBRULE2(pathOneInPropertySet);
12624
+ const tail = [];
12625
+ MANY(() => {
12626
+ CONSUME(symbols_exports.pipe);
12627
+ const item = SUBRULE3(pathOneInPropertySet);
12628
+ tail.push(item);
12629
+ });
12630
+ const close = CONSUME(symbols_exports.RParen);
12631
+ return ACTION(() => {
12632
+ const F2 = C.factory;
12633
+ if (tail.length === 0) {
12634
+ return F2.path("!", [head2], F2.sourceLocation(exclamation2, close));
12635
+ }
12636
+ return F2.path(
12637
+ "!",
12638
+ [F2.path("|", [head2, ...tail], F2.sourceLocation(open, close))],
12639
+ F2.sourceLocation(exclamation2, close)
12640
+ );
12641
+ });
12642
+ } }
12643
+ ]);
12876
12644
  }
12877
12645
  };
12878
- var constraint = {
12879
- name: "constraint",
12880
- impl: ({ SUBRULE, OR }) => () => OR([
12881
- { ALT: () => SUBRULE(brackettedExpression, void 0) },
12882
- { ALT: () => SUBRULE(builtInCall, void 0) },
12883
- { ALT: () => SUBRULE(functionCall, void 0) }
12646
+ var pathOneInPropertySet = {
12647
+ name: "pathOneInPropertySet",
12648
+ impl: ({ ACTION, CONSUME, SUBRULE1, SUBRULE2, OR1, OR2 }) => (C) => OR1([
12649
+ { ALT: () => SUBRULE1(iri2) },
12650
+ { ALT: () => SUBRULE1(verbA) },
12651
+ { ALT: () => {
12652
+ const hat2 = CONSUME(symbols_exports.hat);
12653
+ const item = OR2([
12654
+ { ALT: () => SUBRULE2(iri2) },
12655
+ { ALT: () => SUBRULE2(verbA) }
12656
+ ]);
12657
+ return ACTION(() => C.factory.path("^", [item], C.factory.sourceLocation(hat2, item)));
12658
+ } }
12884
12659
  ])
12885
12660
  };
12886
- var functionCall = {
12887
- name: "functionCall",
12888
- impl: ({ ACTION, SUBRULE }) => (C) => {
12889
- const func = SUBRULE(iri2, void 0);
12890
- const args = SUBRULE(argList, void 0);
12891
- return ACTION(() => C.factory.expressionFunctionCall(
12892
- func,
12893
- args.val.args,
12894
- args.val.distinct,
12895
- C.factory.sourceLocation(func, args)
12896
- ));
12661
+
12662
+ // ../../packages/rules-sparql-1-1/lib/grammar/tripleBlock.ts
12663
+ function triplesDotSeperated(triplesSameSubjectSubrule) {
12664
+ return ({ ACTION, AT_LEAST_ONE, SUBRULE, CONSUME, OPTION }) => (C) => {
12665
+ const triples = [];
12666
+ let parsedDot = true;
12667
+ let dotToken;
12668
+ AT_LEAST_ONE({
12669
+ GATE: () => parsedDot,
12670
+ DEF: () => {
12671
+ parsedDot = false;
12672
+ const template = SUBRULE(triplesSameSubjectSubrule);
12673
+ ACTION(() => {
12674
+ triples.push(...template);
12675
+ });
12676
+ OPTION(() => {
12677
+ dotToken = CONSUME(symbols_exports.dot);
12678
+ parsedDot = true;
12679
+ });
12680
+ }
12681
+ });
12682
+ return ACTION(() => C.factory.patternBgp(triples, C.factory.sourceLocation(...triples, dotToken)));
12683
+ };
12684
+ }
12685
+ var triplesBlock = {
12686
+ name: "triplesBlock",
12687
+ impl: (implArgs) => (C) => triplesDotSeperated(triplesSameSubjectPath)(implArgs)(C),
12688
+ gImpl: ({ SUBRULE, PRINT_WORD, HANDLE_LOC }) => (ast, { factory: F2 }) => {
12689
+ for (const [index, triple] of ast.triples.entries()) {
12690
+ HANDLE_LOC(triple, () => {
12691
+ const nextTriple = ast.triples.at(index);
12692
+ if (F2.isTripleCollection(triple)) {
12693
+ SUBRULE(graphNodePath, triple);
12694
+ F2.printFilter(triple, () => PRINT_WORD("."));
12695
+ } else {
12696
+ SUBRULE(graphNodePath, triple.subject);
12697
+ if (F2.isTerm(triple.predicate) && F2.isTermVariable(triple.predicate)) {
12698
+ SUBRULE(varOrTerm, triple.predicate);
12699
+ } else {
12700
+ SUBRULE(pathGenerator, triple.predicate, void 0);
12701
+ }
12702
+ SUBRULE(graphNodePath, triple.object);
12703
+ if (nextTriple === void 0 || F2.isTripleCollection(nextTriple) || !F2.isSourceLocationNoMaterialize(nextTriple.subject.loc)) {
12704
+ F2.printFilter(ast, () => PRINT_WORD("."));
12705
+ } else if (F2.isSourceLocationNoMaterialize(nextTriple.predicate.loc)) {
12706
+ F2.printFilter(ast, () => PRINT_WORD(","));
12707
+ } else {
12708
+ F2.printFilter(ast, () => PRINT_WORD(";"));
12709
+ }
12710
+ }
12711
+ });
12712
+ }
12897
12713
  }
12898
12714
  };
12899
-
12900
- // ../../packages/rules-sparql-1-1/lib/expressionHelpers.ts
12901
- function funcExpr1(func) {
12715
+ function triplesSameSubjectImpl(name, allowPaths) {
12902
12716
  return {
12903
- name: unCapitalize(func.name),
12904
- impl: ({ ACTION, SUBRULE, CONSUME }) => (C) => {
12905
- const operator = CONSUME(func);
12906
- CONSUME(symbols_exports.LParen);
12907
- const arg = SUBRULE(expression, void 0);
12908
- const close = CONSUME(symbols_exports.RParen);
12909
- return ACTION(() => C.factory.expressionOperation(operator.image, [arg], C.factory.sourceLocation(operator, close)));
12910
- }
12717
+ name,
12718
+ impl: ({ ACTION, SUBRULE, OR }) => (C) => OR([
12719
+ { ALT: () => {
12720
+ const subject = SUBRULE(varOrTerm);
12721
+ const res = SUBRULE(
12722
+ allowPaths ? propertyListPathNotEmpty : propertyListNotEmpty,
12723
+ ACTION(() => C.factory.dematerialized(subject))
12724
+ );
12725
+ return ACTION(() => {
12726
+ if (res.length > 0) {
12727
+ res[0].subject = subject;
12728
+ res[0].loc = C.factory.sourceLocation(subject, res[0]);
12729
+ }
12730
+ return res;
12731
+ });
12732
+ } },
12733
+ { ALT: () => {
12734
+ const subjectNode = SUBRULE(allowPaths ? triplesNodePath : triplesNode);
12735
+ const restNode = SUBRULE(
12736
+ allowPaths ? propertyListPath : propertyList,
12737
+ ACTION(() => C.factory.graphNodeIdentifier(subjectNode))
12738
+ );
12739
+ return ACTION(() => {
12740
+ if (restNode.length === 0) {
12741
+ return [subjectNode];
12742
+ }
12743
+ restNode[0].subject = subjectNode;
12744
+ restNode[0].loc = C.factory.sourceLocation(subjectNode, restNode[0]);
12745
+ return restNode;
12746
+ });
12747
+ } }
12748
+ ])
12911
12749
  };
12912
12750
  }
12913
- function funcExpr2(func) {
12751
+ var triplesSameSubject = triplesSameSubjectImpl("triplesSameSubject", false);
12752
+ var triplesSameSubjectPath = triplesSameSubjectImpl("triplesSameSubjectPath", true);
12753
+ var triplesTemplate = {
12754
+ name: "triplesTemplate",
12755
+ impl: triplesDotSeperated(triplesSameSubject)
12756
+ };
12757
+ function propertyListImpl(name, allowPaths) {
12914
12758
  return {
12915
- name: unCapitalize(func.name),
12916
- impl: ({ ACTION, CONSUME, SUBRULE1, SUBRULE2 }) => (C) => {
12917
- const operator = CONSUME(func);
12918
- CONSUME(symbols_exports.LParen);
12919
- const arg1 = SUBRULE1(expression, void 0);
12920
- CONSUME(symbols_exports.comma);
12921
- const arg2 = SUBRULE2(expression, void 0);
12922
- const close = CONSUME(symbols_exports.RParen);
12923
- return ACTION(() => C.factory.expressionOperation(operator.image, [arg1, arg2], C.factory.sourceLocation(operator, close)));
12759
+ name,
12760
+ impl: ({ SUBRULE, OPTION }) => (_, subject) => OPTION(() => SUBRULE(allowPaths ? propertyListPathNotEmpty : propertyListNotEmpty, subject)) ?? []
12761
+ };
12762
+ }
12763
+ var propertyList = propertyListImpl("propertyList", false);
12764
+ var propertyListPath = propertyListImpl("propertyListPath", true);
12765
+ function propertyListNotEmptyImplementation(name, allowPaths) {
12766
+ return {
12767
+ name,
12768
+ impl: ({ ACTION, CONSUME, AT_LEAST_ONE, SUBRULE1, MANY2, OR1 }) => (_, subject) => {
12769
+ const result = [];
12770
+ let parsedSemi = true;
12771
+ AT_LEAST_ONE({
12772
+ GATE: () => parsedSemi,
12773
+ DEF: () => {
12774
+ parsedSemi = false;
12775
+ const predicate = allowPaths ? OR1([
12776
+ { ALT: () => SUBRULE1(verbPath) },
12777
+ { ALT: () => SUBRULE1(verbSimple) }
12778
+ ]) : SUBRULE1(verb);
12779
+ const triples = SUBRULE1(
12780
+ allowPaths ? objectListPath : objectList,
12781
+ subject,
12782
+ predicate
12783
+ );
12784
+ MANY2(() => {
12785
+ CONSUME(symbols_exports.semi);
12786
+ parsedSemi = true;
12787
+ });
12788
+ ACTION(() => {
12789
+ result.push(...triples);
12790
+ });
12791
+ }
12792
+ });
12793
+ return result;
12924
12794
  }
12925
12795
  };
12926
12796
  }
12927
- function funcExpr3(func) {
12797
+ var propertyListNotEmpty = propertyListNotEmptyImplementation("propertyListNotEmpty", false);
12798
+ var propertyListPathNotEmpty = propertyListNotEmptyImplementation("propertyListPathNotEmpty", true);
12799
+ var verbPath = {
12800
+ name: "verbPath",
12801
+ impl: ({ SUBRULE }) => () => SUBRULE(path)
12802
+ };
12803
+ var verbSimple = {
12804
+ name: "verbSimple",
12805
+ impl: ({ SUBRULE }) => () => SUBRULE(var_)
12806
+ };
12807
+ function objectListImpl(name, allowPaths) {
12928
12808
  return {
12929
- name: unCapitalize(func.name),
12930
- impl: ({ ACTION, CONSUME, CONSUME1, CONSUME2, SUBRULE1, SUBRULE2, SUBRULE3 }) => (C) => {
12931
- const operator = CONSUME(func);
12932
- CONSUME(symbols_exports.LParen);
12933
- const arg1 = SUBRULE1(expression, void 0);
12934
- CONSUME1(symbols_exports.comma);
12935
- const arg2 = SUBRULE2(expression, void 0);
12936
- CONSUME2(symbols_exports.comma);
12937
- const arg3 = SUBRULE3(expression, void 0);
12938
- const close = CONSUME(symbols_exports.RParen);
12939
- return ACTION(() => C.factory.expressionOperation(operator.image, [arg1, arg2, arg3], C.factory.sourceLocation(operator, close)));
12809
+ name,
12810
+ impl: ({ ACTION, SUBRULE, AT_LEAST_ONE_SEP }) => (_, subj, pred) => {
12811
+ const objects = [];
12812
+ AT_LEAST_ONE_SEP({
12813
+ SEP: symbols_exports.comma,
12814
+ DEF: () => {
12815
+ const objectTriple = SUBRULE(allowPaths ? objectPath : object, subj, pred);
12816
+ ACTION(() => {
12817
+ objects.push(objectTriple);
12818
+ });
12819
+ }
12820
+ });
12821
+ return objects;
12940
12822
  }
12941
12823
  };
12942
12824
  }
12943
- function funcVar1(func) {
12825
+ var objectList = objectListImpl("objectList", false);
12826
+ var objectListPath = objectListImpl("objectListPath", true);
12827
+ function objectImpl(name, allowPaths) {
12944
12828
  return {
12945
- name: unCapitalize(func.name),
12946
- impl: ({ ACTION, SUBRULE, CONSUME }) => (C) => {
12947
- const operator = CONSUME(func);
12948
- CONSUME(symbols_exports.LParen);
12949
- const arg = SUBRULE(var_, void 0);
12950
- const close = CONSUME(symbols_exports.RParen);
12951
- return ACTION(() => C.factory.expressionOperation(operator.image, [arg], C.factory.sourceLocation(operator, close)));
12829
+ name,
12830
+ impl: ({ ACTION, SUBRULE }) => (C, subject, predicate) => {
12831
+ const node = SUBRULE(allowPaths ? graphNodePath : graphNode);
12832
+ return ACTION(() => C.factory.triple(subject, predicate, node));
12952
12833
  }
12953
12834
  };
12954
12835
  }
12955
- function funcExprOrNil1(func) {
12836
+ var object = objectImpl("object", false);
12837
+ var objectPath = objectImpl("objectPath", true);
12838
+ function collectionImpl(name, allowPaths) {
12956
12839
  return {
12957
- name: unCapitalize(func.name),
12958
- impl: ({ ACTION, CONSUME, OR, SUBRULE }) => (C) => {
12959
- const operator = CONSUME(func);
12960
- return OR([
12961
- { ALT: () => {
12962
- CONSUME(symbols_exports.LParen);
12963
- const arg = SUBRULE(expression, void 0);
12964
- const close = CONSUME(symbols_exports.RParen);
12965
- return ACTION(() => C.factory.expressionOperation(operator.image, [arg], C.factory.sourceLocation(operator, close)));
12966
- } },
12967
- { ALT: () => {
12968
- const nil2 = CONSUME(terminals_exports.nil);
12969
- return ACTION(() => C.factory.expressionOperation(operator.image, [], C.factory.sourceLocation(operator, nil2)));
12970
- } }
12971
- ]);
12972
- }
12973
- };
12974
- }
12975
- function funcNil1(func) {
12976
- return {
12977
- name: unCapitalize(func.name),
12978
- impl: ({ ACTION, CONSUME }) => (C) => {
12979
- const operator = CONSUME(func);
12980
- const nil2 = CONSUME(terminals_exports.nil);
12981
- return ACTION(() => C.factory.expressionOperation(operator.image, [], C.factory.sourceLocation(operator, nil2)));
12982
- }
12983
- };
12984
- }
12985
- function funcExprList1(func) {
12986
- return {
12987
- name: unCapitalize(func.name),
12988
- impl: ({ ACTION, CONSUME, SUBRULE }) => (C) => {
12989
- const operator = CONSUME(func);
12990
- const args = SUBRULE(expressionList, void 0);
12991
- return ACTION(() => C.factory.expressionOperation(operator.image, args.val, C.factory.sourceLocation(operator, args)));
12992
- }
12993
- };
12994
- }
12995
- function funcExpr2or3(func) {
12996
- return {
12997
- name: unCapitalize(func.name),
12998
- impl: ({ ACTION, CONSUME, SUBRULE1, SUBRULE2, SUBRULE3, CONSUME1, OPTION, CONSUME2 }) => (C) => {
12999
- const operator = CONSUME(func);
13000
- CONSUME(symbols_exports.LParen);
13001
- const arg1 = SUBRULE1(expression, void 0);
13002
- CONSUME1(symbols_exports.comma);
13003
- const arg2 = SUBRULE2(expression, void 0);
13004
- const arg3 = OPTION(() => {
13005
- CONSUME2(symbols_exports.comma);
13006
- return SUBRULE3(expression, void 0);
12840
+ name,
12841
+ impl: ({ ACTION, AT_LEAST_ONE, SUBRULE, CONSUME }) => (C) => {
12842
+ const terms = [];
12843
+ const startToken = CONSUME(symbols_exports.LParen);
12844
+ AT_LEAST_ONE(() => {
12845
+ terms.push(SUBRULE(allowPaths ? graphNodePath : graphNode));
13007
12846
  });
13008
- const close = CONSUME(symbols_exports.RParen);
13009
- return ACTION(() => C.factory.expressionOperation(
13010
- operator.image,
13011
- arg3 ? [arg1, arg2, arg3] : [arg1, arg2],
13012
- C.factory.sourceLocation(operator, close)
13013
- ));
12847
+ const endToken = CONSUME(symbols_exports.RParen);
12848
+ return ACTION(() => {
12849
+ const F2 = C.factory;
12850
+ const triples = [];
12851
+ const predFirst = F2.namedNode(F2.sourceLocationNoMaterialize(), "http://www.w3.org/1999/02/22-rdf-syntax-ns#first" /* FIRST */, void 0);
12852
+ const predRest = F2.namedNode(F2.sourceLocationNoMaterialize(), "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest" /* REST */, void 0);
12853
+ const predNil = F2.namedNode(F2.sourceLocationNoMaterialize(), "http://www.w3.org/1999/02/22-rdf-syntax-ns#nil" /* NIL */, void 0);
12854
+ const listHead = F2.blankNode(void 0, F2.sourceLocationNoMaterialize());
12855
+ let iterHead = listHead;
12856
+ for (const [index, term] of terms.entries()) {
12857
+ const lastInList = index === terms.length - 1;
12858
+ const headTriple = F2.triple(
12859
+ iterHead,
12860
+ predFirst,
12861
+ term
12862
+ );
12863
+ triples.push(headTriple);
12864
+ if (lastInList) {
12865
+ const nilTriple = F2.triple(iterHead, predRest, predNil);
12866
+ triples.push(nilTriple);
12867
+ } else {
12868
+ const tail = F2.blankNode(void 0, F2.sourceLocationNoMaterialize());
12869
+ const linkTriple = F2.triple(iterHead, predRest, tail);
12870
+ triples.push(linkTriple);
12871
+ iterHead = tail;
12872
+ }
12873
+ }
12874
+ return F2.tripleCollectionList(listHead, triples, F2.sourceLocation(startToken, endToken));
12875
+ });
12876
+ },
12877
+ gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F2 }) => {
12878
+ F2.printFilter(ast, () => PRINT_WORD("("));
12879
+ for (const [idx, triple] of ast.triples.entries()) {
12880
+ if (idx % 2 === 0) {
12881
+ SUBRULE(allowPaths ? graphNodePath : graphNode, triple.object);
12882
+ }
12883
+ }
12884
+ F2.printFilter(ast, () => PRINT_WORD(")"));
13014
12885
  }
13015
12886
  };
13016
12887
  }
13017
- function funcExpr3or4(func) {
12888
+ var collection = collectionImpl("collection", false);
12889
+ var collectionPath = collectionImpl("collectionPath", true);
12890
+ function triplesNodeImpl(name, allowPaths) {
13018
12891
  return {
13019
- name: unCapitalize(func.name),
13020
- impl: ({
13021
- ACTION,
13022
- CONSUME,
13023
- SUBRULE1,
13024
- SUBRULE2,
13025
- SUBRULE3,
13026
- SUBRULE4,
13027
- CONSUME1,
13028
- OPTION,
13029
- CONSUME2,
13030
- CONSUME3
13031
- }) => (C) => {
13032
- const operator = CONSUME(func);
13033
- CONSUME(symbols_exports.LParen);
13034
- const arg1 = SUBRULE1(expression, void 0);
13035
- CONSUME1(symbols_exports.comma);
13036
- const arg2 = SUBRULE2(expression, void 0);
13037
- CONSUME2(symbols_exports.comma);
13038
- const arg3 = SUBRULE3(expression, void 0);
13039
- const arg4 = OPTION(() => {
13040
- CONSUME3(symbols_exports.comma);
13041
- return SUBRULE4(expression, void 0);
13042
- });
13043
- const close = CONSUME(symbols_exports.RParen);
13044
- return ACTION(() => C.factory.expressionOperation(
13045
- operator.image,
13046
- arg4 ? [arg1, arg2, arg3, arg4] : [arg1, arg2, arg3],
13047
- C.factory.sourceLocation(operator, close)
13048
- ));
13049
- }
12892
+ name,
12893
+ impl: ({ SUBRULE, OR }) => () => OR([
12894
+ { ALT: () => SUBRULE(allowPaths ? collectionPath : collection) },
12895
+ { ALT: () => SUBRULE(allowPaths ? blankNodePropertyListPath : blankNodePropertyList) }
12896
+ ]),
12897
+ gImpl: ({ SUBRULE }) => (ast) => ast.subType === "list" ? SUBRULE(allowPaths ? collectionPath : collection, ast) : SUBRULE(allowPaths ? blankNodePropertyListPath : blankNodePropertyList, ast)
13050
12898
  };
13051
12899
  }
13052
- function funcGroupGraphPattern(func) {
12900
+ var triplesNode = triplesNodeImpl("triplesNode", false);
12901
+ var triplesNodePath = triplesNodeImpl("triplesNodePath", true);
12902
+ function blankNodePropertyListImpl(name, allowPaths) {
12903
+ const propertyPathNotEmptyImpl = allowPaths ? propertyListPathNotEmpty : propertyListNotEmpty;
13053
12904
  return {
13054
- name: unCapitalize(func.name),
12905
+ name,
13055
12906
  impl: ({ ACTION, SUBRULE, CONSUME }) => (C) => {
13056
- const operator = CONSUME(func);
13057
- const group = SUBRULE(groupGraphPattern, void 0);
13058
- return ACTION(() => C.factory.expressionPatternOperation(
13059
- operator.image,
13060
- group,
13061
- C.factory.sourceLocation(operator, group)
12907
+ const startToken = CONSUME(symbols_exports.LSquare);
12908
+ const blankNode2 = ACTION(() => C.factory.blankNode(void 0, C.factory.sourceLocationNoMaterialize()));
12909
+ const propList = SUBRULE(propertyPathNotEmptyImpl, blankNode2);
12910
+ const endToken = CONSUME(symbols_exports.RSquare);
12911
+ return ACTION(() => C.factory.tripleCollectionBlankNodeProperties(
12912
+ blankNode2,
12913
+ propList,
12914
+ C.factory.sourceLocation(startToken, endToken)
13062
12915
  ));
12916
+ },
12917
+ gImpl: ({ SUBRULE, PRINT, PRINT_WORD, HANDLE_LOC }) => (ast, { factory: F2 }) => {
12918
+ F2.printFilter(ast, () => PRINT("["));
12919
+ for (const triple of ast.triples) {
12920
+ HANDLE_LOC(triple, () => {
12921
+ if (F2.isTerm(triple.predicate) && F2.isTermVariable(triple.predicate)) {
12922
+ SUBRULE(varOrTerm, triple.predicate);
12923
+ } else {
12924
+ SUBRULE(pathGenerator, triple.predicate, void 0);
12925
+ }
12926
+ SUBRULE(graphNodePath, triple.object);
12927
+ F2.printFilter(ast, () => PRINT_WORD(";"));
12928
+ });
12929
+ }
12930
+ F2.printFilter(ast, () => PRINT("]"));
13063
12931
  }
13064
12932
  };
13065
12933
  }
13066
- function baseAggregateFunc(func) {
12934
+ var blankNodePropertyList = blankNodePropertyListImpl("blankNodePropertyList", false);
12935
+ var blankNodePropertyListPath = blankNodePropertyListImpl("blankNodePropertyListPath", true);
12936
+ function graphNodeImpl(name, allowPaths) {
12937
+ const triplesNodeRule = allowPaths ? triplesNodePath : triplesNode;
13067
12938
  return {
13068
- name: unCapitalize(func.name),
13069
- impl: ({ ACTION, CONSUME, SUBRULE, OPTION }) => (C) => {
13070
- const operator = CONSUME(func);
13071
- CONSUME(symbols_exports.LParen);
13072
- const distinct2 = OPTION(() => CONSUME(distinct));
13073
- const expr1 = SUBRULE(expression, void 0);
13074
- const close = CONSUME(symbols_exports.RParen);
13075
- return ACTION(() => C.factory.aggregate(
13076
- operator.image,
13077
- distinct2 !== void 0,
13078
- expr1,
13079
- void 0,
13080
- C.factory.sourceLocation(operator, close)
13081
- ));
12939
+ name,
12940
+ impl: ({ SUBRULE, OR }) => (C) => OR([
12941
+ { ALT: () => SUBRULE(varOrTerm) },
12942
+ {
12943
+ GATE: () => C.parseMode.has("canCreateBlankNodes"),
12944
+ ALT: () => SUBRULE(triplesNodeRule)
12945
+ }
12946
+ ]),
12947
+ gImpl: ({ SUBRULE }) => (ast, { factory: F2 }) => {
12948
+ if (F2.isTerm(ast)) {
12949
+ SUBRULE(varOrTerm, ast);
12950
+ } else {
12951
+ SUBRULE(triplesNodeRule, ast);
12952
+ }
13082
12953
  }
13083
12954
  };
13084
12955
  }
12956
+ var graphNode = graphNodeImpl("graphNode", false);
12957
+ var graphNodePath = graphNodeImpl("graphNodePath", true);
13085
12958
 
13086
- // ../../packages/rules-sparql-1-1/lib/grammar/builtIn.ts
13087
- var builtInStr = funcExpr1(BuildinCalls_exports.str);
13088
- var builtInLang = funcExpr1(BuildinCalls_exports.lang);
13089
- var builtInLangmatches = funcExpr2(BuildinCalls_exports.langmatches);
13090
- var builtInDatatype = funcExpr1(BuildinCalls_exports.datatype);
13091
- var builtInBound = funcVar1(BuildinCalls_exports.bound);
13092
- var builtInIri = funcExpr1(BuildinCalls_exports.iri);
13093
- var builtInUri = funcExpr1(BuildinCalls_exports.uri);
13094
- var builtInBnodeSparqlJs = funcExprOrNil1(BuildinCalls_exports.bnode);
13095
- var builtInRand = funcNil1(BuildinCalls_exports.rand);
13096
- var builtInAbs = funcExpr1(BuildinCalls_exports.abs);
13097
- var builtInCeil = funcExpr1(BuildinCalls_exports.ceil);
13098
- var builtInFloor = funcExpr1(BuildinCalls_exports.floor);
13099
- var builtInRound = funcExpr1(BuildinCalls_exports.round);
13100
- var builtInConcat = funcExprList1(BuildinCalls_exports.concat);
13101
- var builtInStrlen = funcExpr1(BuildinCalls_exports.strlen);
13102
- var builtInUcase = funcExpr1(BuildinCalls_exports.ucase);
13103
- var builtInLcase = funcExpr1(BuildinCalls_exports.lcase);
13104
- var builtInEncode_for_uri = funcExpr1(BuildinCalls_exports.encode_for_uri);
13105
- var builtInContains = funcExpr2(BuildinCalls_exports.contains);
13106
- var builtInStrstarts = funcExpr2(BuildinCalls_exports.strstarts);
13107
- var builtInStrends = funcExpr2(BuildinCalls_exports.strends);
13108
- var builtInStrbefore = funcExpr2(BuildinCalls_exports.strbefore);
13109
- var builtInStrafter = funcExpr2(BuildinCalls_exports.strafter);
13110
- var builtInYear = funcExpr1(BuildinCalls_exports.year);
13111
- var builtInMonth = funcExpr1(BuildinCalls_exports.month);
13112
- var builtInDay = funcExpr1(BuildinCalls_exports.day);
13113
- var builtInHours = funcExpr1(BuildinCalls_exports.hours);
13114
- var builtInMinutes = funcExpr1(BuildinCalls_exports.minutes);
13115
- var builtInSeconds = funcExpr1(BuildinCalls_exports.seconds);
13116
- var builtInTimezone = funcExpr1(BuildinCalls_exports.timezone);
13117
- var builtInTz = funcExpr1(BuildinCalls_exports.tz);
13118
- var builtInNow = funcNil1(BuildinCalls_exports.now);
13119
- var builtInUuid = funcNil1(BuildinCalls_exports.uuid);
13120
- var builtInStruuid = funcNil1(BuildinCalls_exports.struuid);
13121
- var builtInMd5 = funcExpr1(BuildinCalls_exports.md5);
13122
- var builtInSha1 = funcExpr1(BuildinCalls_exports.sha1);
13123
- var builtInSha256 = funcExpr1(BuildinCalls_exports.sha256);
13124
- var builtInSha384 = funcExpr1(BuildinCalls_exports.sha384);
13125
- var builtInSha512 = funcExpr1(BuildinCalls_exports.sha512);
13126
- var builtInCoalesce = funcExprList1(BuildinCalls_exports.coalesce);
13127
- var builtInIf = funcExpr3(BuildinCalls_exports.if_);
13128
- var builtInStrlang = funcExpr2(BuildinCalls_exports.strlang);
13129
- var builtInStrdt = funcExpr2(BuildinCalls_exports.strdt);
13130
- var builtInSameterm = funcExpr2(BuildinCalls_exports.sameterm);
13131
- var builtInIsiri = funcExpr1(BuildinCalls_exports.isiri);
13132
- var builtInIsuri = funcExpr1(BuildinCalls_exports.isuri);
13133
- var builtInIsblank = funcExpr1(BuildinCalls_exports.isblank);
13134
- var builtInIsliteral = funcExpr1(BuildinCalls_exports.isliteral);
13135
- var builtInIsnumeric = funcExpr1(BuildinCalls_exports.isnumeric);
13136
- function builtInCallList(SUBRULE) {
13137
- return [
13138
- { ALT: () => SUBRULE(aggregate, void 0) },
13139
- { ALT: () => SUBRULE(builtInStr, void 0) },
13140
- { ALT: () => SUBRULE(builtInLang, void 0) },
13141
- { ALT: () => SUBRULE(builtInLangmatches, void 0) },
13142
- { ALT: () => SUBRULE(builtInDatatype, void 0) },
13143
- { ALT: () => SUBRULE(builtInBound, void 0) },
13144
- { ALT: () => SUBRULE(builtInIri, void 0) },
13145
- { ALT: () => SUBRULE(builtInUri, void 0) },
13146
- { ALT: () => SUBRULE(builtInBnodeSparqlJs, void 0) },
13147
- { ALT: () => SUBRULE(builtInRand, void 0) },
13148
- { ALT: () => SUBRULE(builtInAbs, void 0) },
13149
- { ALT: () => SUBRULE(builtInCeil, void 0) },
13150
- { ALT: () => SUBRULE(builtInFloor, void 0) },
13151
- { ALT: () => SUBRULE(builtInRound, void 0) },
13152
- { ALT: () => SUBRULE(builtInConcat, void 0) },
13153
- { ALT: () => SUBRULE(substringExpression, void 0) },
13154
- { ALT: () => SUBRULE(builtInStrlen, void 0) },
13155
- { ALT: () => SUBRULE(strReplaceExpression, void 0) },
13156
- { ALT: () => SUBRULE(builtInUcase, void 0) },
13157
- { ALT: () => SUBRULE(builtInLcase, void 0) },
13158
- { ALT: () => SUBRULE(builtInEncode_for_uri, void 0) },
13159
- { ALT: () => SUBRULE(builtInContains, void 0) },
13160
- { ALT: () => SUBRULE(builtInStrstarts, void 0) },
13161
- { ALT: () => SUBRULE(builtInStrends, void 0) },
13162
- { ALT: () => SUBRULE(builtInStrbefore, void 0) },
13163
- { ALT: () => SUBRULE(builtInStrafter, void 0) },
13164
- { ALT: () => SUBRULE(builtInYear, void 0) },
13165
- { ALT: () => SUBRULE(builtInMonth, void 0) },
13166
- { ALT: () => SUBRULE(builtInDay, void 0) },
13167
- { ALT: () => SUBRULE(builtInHours, void 0) },
13168
- { ALT: () => SUBRULE(builtInMinutes, void 0) },
13169
- { ALT: () => SUBRULE(builtInSeconds, void 0) },
13170
- { ALT: () => SUBRULE(builtInTimezone, void 0) },
13171
- { ALT: () => SUBRULE(builtInTz, void 0) },
13172
- { ALT: () => SUBRULE(builtInNow, void 0) },
13173
- { ALT: () => SUBRULE(builtInUuid, void 0) },
13174
- { ALT: () => SUBRULE(builtInStruuid, void 0) },
13175
- { ALT: () => SUBRULE(builtInMd5, void 0) },
13176
- { ALT: () => SUBRULE(builtInSha1, void 0) },
13177
- { ALT: () => SUBRULE(builtInSha256, void 0) },
13178
- { ALT: () => SUBRULE(builtInSha384, void 0) },
13179
- { ALT: () => SUBRULE(builtInSha512, void 0) },
13180
- { ALT: () => SUBRULE(builtInCoalesce, void 0) },
13181
- { ALT: () => SUBRULE(builtInIf, void 0) },
13182
- { ALT: () => SUBRULE(builtInStrlang, void 0) },
13183
- { ALT: () => SUBRULE(builtInStrdt, void 0) },
13184
- { ALT: () => SUBRULE(builtInSameterm, void 0) },
13185
- { ALT: () => SUBRULE(builtInIsiri, void 0) },
13186
- { ALT: () => SUBRULE(builtInIsuri, void 0) },
13187
- { ALT: () => SUBRULE(builtInIsblank, void 0) },
13188
- { ALT: () => SUBRULE(builtInIsliteral, void 0) },
13189
- { ALT: () => SUBRULE(builtInIsnumeric, void 0) },
13190
- { ALT: () => SUBRULE(regexExpression, void 0) },
13191
- { ALT: () => SUBRULE(existsFunc, void 0) },
13192
- { ALT: () => SUBRULE(notExistsFunc, void 0) }
13193
- ];
13194
- }
13195
- var builtInCall = {
13196
- name: "builtInCall",
13197
- impl: ({ OR, SUBRULE, cache }) => () => {
13198
- const cached = cache.get(builtInCall);
13199
- if (cached) {
13200
- return OR(cached);
12959
+ // ../../packages/rules-sparql-1-1/lib/grammar/whereClause.ts
12960
+ var whereClause = {
12961
+ name: "whereClause",
12962
+ impl: ({ ACTION, SUBRULE, CONSUME, OPTION }) => (C) => {
12963
+ const where2 = OPTION(() => CONSUME(where));
12964
+ const group = SUBRULE(groupGraphPattern);
12965
+ return ACTION(() => C.factory.wrap(group, C.factory.sourceLocation(where2, group)));
12966
+ },
12967
+ gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F2 }) => {
12968
+ F2.printFilter(ast, () => PRINT_WORD("WHERE"));
12969
+ SUBRULE(groupGraphPattern, ast.val);
12970
+ }
12971
+ };
12972
+ var groupGraphPattern = {
12973
+ name: "groupGraphPattern",
12974
+ impl: ({ ACTION, SUBRULE, CONSUME, OR }) => (C) => {
12975
+ const open = CONSUME(symbols_exports.LCurly);
12976
+ const patterns = OR([
12977
+ { ALT: () => [SUBRULE(subSelect)] },
12978
+ { ALT: () => SUBRULE(groupGraphPatternSub) }
12979
+ ]);
12980
+ const close = CONSUME(symbols_exports.RCurly);
12981
+ return ACTION(() => C.factory.patternGroup(patterns, C.factory.sourceLocation(open, close)));
12982
+ },
12983
+ gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F2 }) => {
12984
+ F2.printFilter(ast, () => PRINT_WORD("{"));
12985
+ for (const pattern of ast.patterns) {
12986
+ SUBRULE(generatePattern, pattern);
13201
12987
  }
13202
- const builtIns = builtInCallList(SUBRULE);
13203
- cache.set(builtInCall, builtIns);
13204
- return OR(builtIns);
12988
+ F2.printFilter(ast, () => PRINT_WORD("}"));
13205
12989
  }
13206
12990
  };
13207
- var regexExpression = funcExpr2or3(BuildinCalls_exports.regex);
13208
- var substringExpression = funcExpr2or3(BuildinCalls_exports.substr);
13209
- var strReplaceExpression = funcExpr3or4(BuildinCalls_exports.replace);
13210
- var existsFunc = funcGroupGraphPattern(BuildinCalls_exports.exists);
13211
- var notExistsFunc = funcGroupGraphPattern(BuildinCalls_exports.notexists);
13212
- var aggregateCount = {
13213
- name: unCapitalize(BuildinCalls_exports.count.name),
13214
- impl: ({ ACTION, CONSUME, SUBRULE, OR, OPTION }) => (C) => {
13215
- const operatorToken = CONSUME(BuildinCalls_exports.count);
12991
+ var generatePattern = {
12992
+ name: "generatePattern",
12993
+ gImpl: ({ SUBRULE }) => (ast, { factory: F2 }) => {
12994
+ if (ast.type === "query") {
12995
+ SUBRULE(query, F2.querySelect({
12996
+ context: [],
12997
+ datasets: F2.datasetClauses([], F2.sourceLocation()),
12998
+ where: ast.where,
12999
+ variables: ast.variables,
13000
+ solutionModifiers: ast.solutionModifiers,
13001
+ values: ast.values,
13002
+ distinct: ast.distinct,
13003
+ reduced: ast.reduced
13004
+ }, ast.loc));
13005
+ } else if (ast.subType === "group") {
13006
+ SUBRULE(groupGraphPattern, ast);
13007
+ } else if (ast.subType === "bgp") {
13008
+ SUBRULE(triplesBlock, ast);
13009
+ } else {
13010
+ SUBRULE(graphPatternNotTriples, ast);
13011
+ }
13012
+ }
13013
+ };
13014
+ var groupGraphPatternSub = {
13015
+ name: "groupGraphPatternSub",
13016
+ impl: ({ ACTION, SUBRULE, CONSUME, MANY, SUBRULE1, SUBRULE2, OPTION1, OPTION2, OPTION3 }) => () => {
13017
+ const patterns = [];
13018
+ const bgpPattern = OPTION1(() => SUBRULE1(triplesBlock));
13019
+ if (bgpPattern) {
13020
+ patterns.push(bgpPattern);
13021
+ }
13022
+ MANY(() => {
13023
+ const notTriples = SUBRULE(graphPatternNotTriples);
13024
+ patterns.push(notTriples);
13025
+ OPTION2(() => CONSUME(symbols_exports.dot));
13026
+ const moreTriples = OPTION3(() => SUBRULE2(triplesBlock));
13027
+ if (moreTriples) {
13028
+ patterns.push(moreTriples);
13029
+ }
13030
+ });
13031
+ ACTION(() => checkNote13(patterns));
13032
+ return patterns;
13033
+ }
13034
+ };
13035
+ var graphPatternNotTriples = {
13036
+ name: "graphPatternNotTriples",
13037
+ impl: ({ SUBRULE, OR }) => () => OR([
13038
+ { ALT: () => SUBRULE(groupOrUnionGraphPattern) },
13039
+ { ALT: () => SUBRULE(optionalGraphPattern) },
13040
+ { ALT: () => SUBRULE(minusGraphPattern) },
13041
+ { ALT: () => SUBRULE(graphGraphPattern) },
13042
+ { ALT: () => SUBRULE(serviceGraphPattern) },
13043
+ { ALT: () => SUBRULE(filter3) },
13044
+ { ALT: () => SUBRULE(bind2) },
13045
+ { ALT: () => SUBRULE(inlineData) }
13046
+ ]),
13047
+ gImpl: ({ SUBRULE }) => (ast) => {
13048
+ switch (ast.subType) {
13049
+ case "group":
13050
+ case "union":
13051
+ SUBRULE(groupOrUnionGraphPattern, ast);
13052
+ break;
13053
+ case "optional":
13054
+ SUBRULE(optionalGraphPattern, ast);
13055
+ break;
13056
+ case "minus":
13057
+ SUBRULE(minusGraphPattern, ast);
13058
+ break;
13059
+ case "graph":
13060
+ SUBRULE(graphGraphPattern, ast);
13061
+ break;
13062
+ case "service":
13063
+ SUBRULE(serviceGraphPattern, ast);
13064
+ break;
13065
+ case "filter":
13066
+ SUBRULE(filter3, ast);
13067
+ break;
13068
+ case "bind":
13069
+ SUBRULE(bind2, ast);
13070
+ break;
13071
+ case "values":
13072
+ SUBRULE(inlineData, ast);
13073
+ break;
13074
+ }
13075
+ }
13076
+ };
13077
+ var optionalGraphPattern = {
13078
+ name: "optionalGraphPattern",
13079
+ impl: ({ ACTION, SUBRULE, CONSUME }) => (C) => {
13080
+ const optional2 = CONSUME(optional);
13081
+ const group = SUBRULE(groupGraphPattern);
13082
+ return ACTION(() => C.factory.patternOptional(group.patterns, C.factory.sourceLocation(optional2, group)));
13083
+ },
13084
+ gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F2 }) => {
13085
+ F2.printFilter(ast, () => PRINT_WORD("OPTIONAL"));
13086
+ SUBRULE(groupGraphPattern, F2.patternGroup(ast.patterns, ast.loc));
13087
+ }
13088
+ };
13089
+ var graphGraphPattern = {
13090
+ name: "graphGraphPattern",
13091
+ impl: ({ ACTION, SUBRULE, CONSUME }) => (C) => {
13092
+ const graph2 = CONSUME(graph_exports.graph);
13093
+ const name = SUBRULE(varOrIri);
13094
+ const group = SUBRULE(groupGraphPattern);
13095
+ return ACTION(() => C.factory.patternGraph(name, group.patterns, C.factory.sourceLocation(graph2, group)));
13096
+ },
13097
+ gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F2 }) => {
13098
+ F2.printFilter(ast, () => PRINT_WORD("GRAPH"));
13099
+ SUBRULE(varOrTerm, ast.name);
13100
+ SUBRULE(groupGraphPattern, F2.patternGroup(ast.patterns, ast.loc));
13101
+ }
13102
+ };
13103
+ var serviceGraphPattern = {
13104
+ name: "serviceGraphPattern",
13105
+ impl: ({ ACTION, SUBRULE1, CONSUME, OPTION }) => (C) => {
13106
+ const service2 = CONSUME(service);
13107
+ const silent2 = OPTION(() => {
13108
+ CONSUME(silent);
13109
+ return true;
13110
+ }) ?? false;
13111
+ const name = SUBRULE1(varOrIri);
13112
+ const group = SUBRULE1(groupGraphPattern);
13113
+ return ACTION(() => C.factory.patternService(name, group.patterns, silent2, C.factory.sourceLocation(service2, group)));
13114
+ },
13115
+ gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F2 }) => {
13116
+ F2.printFilter(ast, () => {
13117
+ PRINT_WORD("SERVICE");
13118
+ if (ast.silent) {
13119
+ PRINT_WORD("SILENT");
13120
+ }
13121
+ });
13122
+ SUBRULE(varOrTerm, ast.name);
13123
+ SUBRULE(groupGraphPattern, F2.patternGroup(ast.patterns, ast.loc));
13124
+ }
13125
+ };
13126
+ var bind2 = {
13127
+ name: "bind",
13128
+ impl: ({ ACTION, SUBRULE, CONSUME }) => (C) => {
13129
+ const bind3 = CONSUME(bind);
13216
13130
  CONSUME(symbols_exports.LParen);
13217
- const distinctToken = OPTION(() => CONSUME(distinct));
13218
- const expressionVal = OR([
13219
- { ALT: () => {
13220
- const starToken = CONSUME(symbols_exports.star);
13221
- return ACTION(() => C.factory.wildcard(C.factory.sourceLocation(starToken)));
13222
- } },
13223
- { ALT: () => SUBRULE(expression, void 0) }
13224
- ]);
13225
- const closeToken = CONSUME(symbols_exports.RParen);
13226
- return ACTION(() => {
13227
- const F2 = C.factory;
13228
- if (C.factory.isWildcard(expressionVal)) {
13229
- return F2.aggregate(
13230
- operatorToken.image,
13231
- Boolean(distinctToken),
13232
- expressionVal,
13233
- void 0,
13234
- C.factory.sourceLocation(operatorToken, closeToken)
13235
- );
13131
+ const expressionVal = SUBRULE(expression);
13132
+ CONSUME(as);
13133
+ const variable = SUBRULE(var_);
13134
+ const close = CONSUME(symbols_exports.RParen);
13135
+ return ACTION(() => C.factory.patternBind(expressionVal, variable, C.factory.sourceLocation(bind3, close)));
13136
+ },
13137
+ gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F2 }) => {
13138
+ F2.printFilter(ast, () => PRINT_WORD("BIND", "("));
13139
+ SUBRULE(expression, ast.expression);
13140
+ F2.printFilter(ast, () => PRINT_WORD("AS"));
13141
+ SUBRULE(var_, ast.variable);
13142
+ F2.printFilter(ast, () => PRINT_WORD(")"));
13143
+ }
13144
+ };
13145
+ var inlineData = {
13146
+ name: "inlineData",
13147
+ impl: ({ ACTION, SUBRULE, CONSUME }) => (C) => {
13148
+ const values3 = CONSUME(values2);
13149
+ const datablock = SUBRULE(dataBlock);
13150
+ return ACTION(() => C.factory.patternValues(datablock.val, C.factory.sourceLocation(values3, datablock)));
13151
+ },
13152
+ gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F2 }) => {
13153
+ const variables = Object.keys(ast.values[0]);
13154
+ F2.printFilter(ast, () => {
13155
+ PRINT_WORD("VALUES", "(");
13156
+ for (const variable of variables) {
13157
+ PRINT_WORD(`?${variable}`);
13236
13158
  }
13237
- return F2.aggregate(
13238
- operatorToken.image,
13239
- Boolean(distinctToken),
13240
- expressionVal,
13241
- void 0,
13242
- C.factory.sourceLocation(operatorToken, closeToken)
13243
- );
13159
+ PRINT_WORD(")", "{");
13244
13160
  });
13161
+ for (const mapping of ast.values) {
13162
+ F2.printFilter(ast, () => PRINT_WORD("("));
13163
+ for (const variable of variables) {
13164
+ if (mapping[variable] === void 0) {
13165
+ F2.printFilter(ast, () => PRINT_WORD("UNDEF"));
13166
+ } else {
13167
+ SUBRULE(graphNodePath, mapping[variable]);
13168
+ }
13169
+ }
13170
+ F2.printFilter(ast, () => PRINT_WORD(")"));
13171
+ }
13172
+ F2.printFilter(ast, () => PRINT_WORD("}"));
13173
+ }
13174
+ };
13175
+ var dataBlock = {
13176
+ name: "dataBlock",
13177
+ impl: ({ SUBRULE, OR }) => () => OR([
13178
+ { ALT: () => SUBRULE(inlineDataOneVar) },
13179
+ { ALT: () => SUBRULE(inlineDataFull) }
13180
+ ])
13181
+ };
13182
+ var inlineDataOneVar = {
13183
+ name: "inlineDataOneVar",
13184
+ impl: ({ ACTION, SUBRULE, CONSUME, MANY }) => (C) => {
13185
+ const res = [];
13186
+ const varVal = SUBRULE(var_);
13187
+ CONSUME(symbols_exports.LCurly);
13188
+ MANY(() => {
13189
+ const value = SUBRULE(dataBlockValue);
13190
+ ACTION(() => {
13191
+ res.push({ [varVal.value]: value });
13192
+ });
13193
+ });
13194
+ const close = CONSUME(symbols_exports.RCurly);
13195
+ return ACTION(() => C.factory.wrap(res, C.factory.sourceLocation(varVal, close)));
13196
+ }
13197
+ };
13198
+ var inlineDataFull = {
13199
+ name: "inlineDataFull",
13200
+ impl: ({
13201
+ ACTION,
13202
+ OR,
13203
+ MANY1,
13204
+ MANY2,
13205
+ MANY3,
13206
+ MANY4,
13207
+ SUBRULE,
13208
+ CONSUME1,
13209
+ CONSUME2
13210
+ }) => (C) => {
13211
+ const res = [];
13212
+ const vars = [];
13213
+ return OR([
13214
+ { ALT: () => {
13215
+ const nil2 = CONSUME1(terminals_exports.nil);
13216
+ CONSUME1(symbols_exports.LCurly);
13217
+ MANY1(() => {
13218
+ CONSUME2(terminals_exports.nil);
13219
+ res.push({});
13220
+ });
13221
+ const close = CONSUME1(symbols_exports.RCurly);
13222
+ return ACTION(() => C.factory.wrap(res, C.factory.sourceLocation(nil2, close)));
13223
+ } },
13224
+ { ALT: () => {
13225
+ const open = CONSUME1(symbols_exports.LParen);
13226
+ MANY2(() => {
13227
+ vars.push(SUBRULE(var_));
13228
+ });
13229
+ CONSUME1(symbols_exports.RParen);
13230
+ CONSUME2(symbols_exports.LCurly);
13231
+ MANY3(() => {
13232
+ let parsedValues = 0;
13233
+ const currentRow = {};
13234
+ CONSUME2(symbols_exports.LParen);
13235
+ MANY4(() => {
13236
+ if (parsedValues >= vars.length) {
13237
+ throw new Error("Number of dataBlockValues does not match number of variables. Too much values.");
13238
+ }
13239
+ const value = SUBRULE(dataBlockValue);
13240
+ ACTION(() => {
13241
+ currentRow[vars[parsedValues].value] = value;
13242
+ parsedValues++;
13243
+ });
13244
+ });
13245
+ CONSUME2(symbols_exports.RParen);
13246
+ ACTION(() => {
13247
+ res.push(currentRow);
13248
+ if (vars.length !== parsedValues) {
13249
+ throw new Error("Number of dataBlockValues does not match number of variables. Too few values.");
13250
+ }
13251
+ });
13252
+ });
13253
+ const close = CONSUME2(symbols_exports.RCurly);
13254
+ return ACTION(() => C.factory.wrap(res, C.factory.sourceLocation(open, close)));
13255
+ } }
13256
+ ]);
13245
13257
  }
13246
13258
  };
13247
- var aggregateSum = baseAggregateFunc(BuildinCalls_exports.sum);
13248
- var aggregateMin = baseAggregateFunc(BuildinCalls_exports.min);
13249
- var aggregateMax = baseAggregateFunc(BuildinCalls_exports.max);
13250
- var aggregateAvg = baseAggregateFunc(BuildinCalls_exports.avg);
13251
- var aggregateSample = baseAggregateFunc(BuildinCalls_exports.sample);
13252
- var aggregateGroup_concat = {
13253
- name: unCapitalize(BuildinCalls_exports.groupConcat.name),
13254
- impl: ({ ACTION, CONSUME, OPTION1, SUBRULE, OPTION2 }) => (C) => {
13255
- const operatorToken = CONSUME(BuildinCalls_exports.groupConcat);
13256
- CONSUME(symbols_exports.LParen);
13257
- const distinctToken = OPTION1(() => CONSUME(distinct));
13258
- const expr = SUBRULE(expression, void 0);
13259
- const sep = OPTION2(() => {
13260
- CONSUME(symbols_exports.semi);
13261
- CONSUME(separator);
13262
- CONSUME(symbols_exports.equal);
13263
- return SUBRULE(string, void 0);
13264
- });
13265
- const closeToken = CONSUME(symbols_exports.RParen);
13266
- return ACTION(() => {
13267
- const F2 = C.factory;
13268
- return F2.aggregate(
13269
- operatorToken.image,
13270
- Boolean(distinctToken),
13271
- expr,
13272
- sep?.value ?? " ",
13273
- F2.sourceLocation(operatorToken, closeToken)
13274
- );
13275
- });
13259
+ var dataBlockValue = {
13260
+ name: "dataBlockValue",
13261
+ impl: ({ SUBRULE, CONSUME, OR }) => () => OR([
13262
+ { ALT: () => SUBRULE(iri2) },
13263
+ { ALT: () => SUBRULE(rdfLiteral) },
13264
+ { ALT: () => SUBRULE(numericLiteral) },
13265
+ { ALT: () => SUBRULE(booleanLiteral) },
13266
+ { ALT: () => {
13267
+ CONSUME(undef);
13268
+ return void 0;
13269
+ } }
13270
+ ])
13271
+ };
13272
+ var minusGraphPattern = {
13273
+ name: "minusGraphPattern",
13274
+ impl: ({ ACTION, SUBRULE, CONSUME }) => (C) => {
13275
+ const minus2 = CONSUME(minus);
13276
+ const group = SUBRULE(groupGraphPattern);
13277
+ return ACTION(() => C.factory.patternMinus(group.patterns, C.factory.sourceLocation(minus2, group)));
13278
+ },
13279
+ gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F2 }) => {
13280
+ F2.printFilter(ast, () => PRINT_WORD("MINUS"));
13281
+ SUBRULE(groupGraphPattern, F2.patternGroup(ast.patterns, ast.loc));
13276
13282
  }
13277
13283
  };
13278
- var aggregate = {
13279
- name: "aggregate",
13280
- impl: ({ ACTION, SUBRULE, OR }) => (C) => {
13281
- const wasInAggregate = ACTION(() => C.parseMode.has("inAggregate"));
13282
- ACTION(() => C.parseMode.add("inAggregate"));
13283
- const result = OR([
13284
- { ALT: () => SUBRULE(aggregateCount, void 0) },
13285
- { ALT: () => SUBRULE(aggregateSum, void 0) },
13286
- { ALT: () => SUBRULE(aggregateMin, void 0) },
13287
- { ALT: () => SUBRULE(aggregateMax, void 0) },
13288
- { ALT: () => SUBRULE(aggregateAvg, void 0) },
13289
- { ALT: () => SUBRULE(aggregateSample, void 0) },
13290
- { ALT: () => SUBRULE(aggregateGroup_concat, void 0) }
13291
- ]);
13292
- ACTION(() => !wasInAggregate && C.parseMode.delete("inAggregate"));
13293
- ACTION(() => {
13294
- if (!C.parseMode.has("canParseAggregate")) {
13295
- throw new Error("Aggregates are only allowed in SELECT, HAVING, and ORDER BY clauses.");
13296
- }
13297
- if (C.parseMode.has("inAggregate")) {
13298
- throw new Error("An aggregate function is not allowed within an aggregate function.");
13299
- }
13284
+ var groupOrUnionGraphPattern = {
13285
+ name: "groupOrUnionGraphPattern",
13286
+ impl: ({ ACTION, MANY, SUBRULE1, SUBRULE2, CONSUME }) => (C) => {
13287
+ const groups = [];
13288
+ const group = SUBRULE1(groupGraphPattern);
13289
+ groups.push(group);
13290
+ MANY(() => {
13291
+ CONSUME(union);
13292
+ const group2 = SUBRULE2(groupGraphPattern);
13293
+ groups.push(group2);
13300
13294
  });
13301
- return result;
13295
+ return ACTION(() => groups.length === 1 ? groups[0] : C.factory.patternUnion(
13296
+ groups,
13297
+ C.factory.sourceLocation(group, groups.at(-1))
13298
+ ));
13302
13299
  },
13303
13300
  gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F2 }) => {
13304
- F2.printFilter(ast, () => {
13305
- PRINT_WORD(ast.aggregation, "(");
13306
- if (ast.distinct) {
13307
- PRINT_WORD("DISTINCT");
13301
+ if (F2.isPatternUnion(ast)) {
13302
+ const [head2, ...tail] = ast.patterns;
13303
+ SUBRULE(groupGraphPattern, head2);
13304
+ for (const pattern of tail) {
13305
+ F2.printFilter(ast, () => PRINT_WORD("UNION"));
13306
+ SUBRULE(groupGraphPattern, pattern);
13308
13307
  }
13309
- });
13310
- const arg = ast.expression[0];
13311
- if (F2.isWildcard(arg)) {
13312
- F2.printFilter(ast, () => PRINT_WORD("*"));
13313
13308
  } else {
13314
- SUBRULE(expression, arg, void 0);
13315
- }
13316
- if (F2.isExpressionAggregateSeparator(ast)) {
13317
- F2.printFilter(ast, () => PRINT_WORD(";", "SEPARATOR", "=", stringEscapedLexical(ast.separator)));
13309
+ SUBRULE(groupGraphPattern, ast);
13318
13310
  }
13311
+ }
13312
+ };
13313
+ var filter3 = {
13314
+ name: "filter",
13315
+ impl: ({ ACTION, SUBRULE, CONSUME }) => (C) => {
13316
+ const filterToken = CONSUME(filter2);
13317
+ const expression2 = SUBRULE(constraint);
13318
+ return ACTION(() => C.factory.patternFilter(expression2, C.factory.sourceLocation(filterToken, expression2)));
13319
+ },
13320
+ gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F2 }) => {
13321
+ F2.printFilter(ast, () => PRINT_WORD("FILTER ("));
13322
+ SUBRULE(expression, ast.expression);
13319
13323
  F2.printFilter(ast, () => PRINT_WORD(")"));
13320
13324
  }
13321
13325
  };
13326
+ var constraint = {
13327
+ name: "constraint",
13328
+ impl: ({ SUBRULE, OR }) => () => OR([
13329
+ { ALT: () => SUBRULE(brackettedExpression) },
13330
+ { ALT: () => SUBRULE(builtInCall) },
13331
+ { ALT: () => SUBRULE(functionCall) }
13332
+ ])
13333
+ };
13334
+ var functionCall = {
13335
+ name: "functionCall",
13336
+ impl: ({ ACTION, SUBRULE }) => (C) => {
13337
+ const func = SUBRULE(iri2);
13338
+ const args = SUBRULE(argList);
13339
+ return ACTION(() => C.factory.expressionFunctionCall(
13340
+ func,
13341
+ args.val.args,
13342
+ args.val.distinct,
13343
+ C.factory.sourceLocation(func, args)
13344
+ ));
13345
+ }
13346
+ };
13322
13347
 
13323
13348
  // ../../packages/rules-sparql-1-1/lib/grammar/expression.ts
13324
13349
  var argList = {
@@ -13338,7 +13363,7 @@ var argList = {
13338
13363
  AT_LEAST_ONE_SEP({
13339
13364
  SEP: symbols_exports.comma,
13340
13365
  DEF: () => {
13341
- const arg = SUBRULE1(expression, void 0);
13366
+ const arg = SUBRULE1(expression);
13342
13367
  args.push(arg);
13343
13368
  }
13344
13369
  });
@@ -13355,11 +13380,11 @@ var argList = {
13355
13380
  });
13356
13381
  const [head2, ...tail] = ast.val.args;
13357
13382
  if (head2) {
13358
- SUBRULE(expression, head2, void 0);
13383
+ SUBRULE(expression, head2);
13359
13384
  }
13360
13385
  for (const expr of tail) {
13361
13386
  F2.printFilter(ast, () => PRINT_WORD(","));
13362
- SUBRULE(expression, expr, void 0);
13387
+ SUBRULE(expression, expr);
13363
13388
  }
13364
13389
  F2.printFilter(ast, () => PRINT_WORD(")"));
13365
13390
  }
@@ -13373,11 +13398,11 @@ var expressionList = {
13373
13398
  } },
13374
13399
  { ALT: () => {
13375
13400
  const open = CONSUME(symbols_exports.LParen);
13376
- const expr1 = SUBRULE1(expression, void 0);
13401
+ const expr1 = SUBRULE1(expression);
13377
13402
  const args = [expr1];
13378
13403
  MANY(() => {
13379
13404
  CONSUME(symbols_exports.comma);
13380
- const expr = SUBRULE2(expression, void 0);
13405
+ const expr = SUBRULE2(expression);
13381
13406
  args.push(expr);
13382
13407
  });
13383
13408
  const close = CONSUME(symbols_exports.RParen);
@@ -13389,15 +13414,15 @@ var infixOperators = /* @__PURE__ */ new Set(["in", "notin", "||", "&&", "=", "!
13389
13414
  var prefixOperator = /* @__PURE__ */ new Set(["!", "UPLUS", "UMINUS"]);
13390
13415
  var expression = {
13391
13416
  name: "expression",
13392
- impl: ({ SUBRULE }) => () => SUBRULE(conditionalOrExpression, void 0),
13417
+ impl: ({ SUBRULE }) => () => SUBRULE(conditionalOrExpression),
13393
13418
  gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F2 }) => {
13394
13419
  if (F2.isTerm(ast)) {
13395
- SUBRULE(varOrTerm, ast, void 0);
13420
+ SUBRULE(varOrTerm, ast);
13396
13421
  } else if (F2.isExpressionOperator(ast)) {
13397
13422
  if (infixOperators.has(ast.operator)) {
13398
13423
  const [left, ...right] = ast.args;
13399
13424
  F2.printFilter(ast, () => PRINT_WORD("("));
13400
- SUBRULE(expression, left, void 0);
13425
+ SUBRULE(expression, left);
13401
13426
  F2.printFilter(ast, () => {
13402
13427
  if (ast.operator === "notin") {
13403
13428
  PRINT_WORD("NOT IN");
@@ -13408,35 +13433,35 @@ var expression = {
13408
13433
  }
13409
13434
  });
13410
13435
  if (right.length === 1) {
13411
- SUBRULE(expression, right[0], void 0);
13436
+ SUBRULE(expression, right[0]);
13412
13437
  } else {
13413
- SUBRULE(argList, F2.wrap({ args: right, distinct: false }, ast.loc), void 0);
13438
+ SUBRULE(argList, F2.wrap({ args: right, distinct: false }, ast.loc));
13414
13439
  }
13415
13440
  F2.printFilter(ast, () => PRINT_WORD(")"));
13416
13441
  } else if (prefixOperator.has(ast.operator)) {
13417
13442
  const [expr] = ast.args;
13418
13443
  F2.printFilter(ast, () => PRINT_WORD(ast.operator));
13419
- SUBRULE(expression, expr, void 0);
13444
+ SUBRULE(expression, expr);
13420
13445
  } else {
13421
13446
  F2.printFilter(ast, () => PRINT_WORD(ast.operator, "("));
13422
13447
  const [head2, ...tail] = ast.args;
13423
13448
  if (head2) {
13424
- SUBRULE(expression, head2, void 0);
13449
+ SUBRULE(expression, head2);
13425
13450
  }
13426
13451
  for (const arg of tail) {
13427
13452
  F2.printFilter(ast, () => PRINT_WORD(","));
13428
- SUBRULE(expression, arg, void 0);
13453
+ SUBRULE(expression, arg);
13429
13454
  }
13430
13455
  F2.printFilter(ast, () => PRINT_WORD(")"));
13431
13456
  }
13432
13457
  } else if (F2.isExpressionPatternOperation(ast)) {
13433
13458
  const patterns = ast.args;
13434
13459
  F2.printFilter(ast, () => PRINT_WORD(ast.operator === "exists" ? "EXISTS" : "NOT EXISTS"));
13435
- SUBRULE(groupGraphPattern, patterns, void 0);
13460
+ SUBRULE(groupGraphPattern, patterns);
13436
13461
  } else if (F2.isExpressionFunctionCall(ast)) {
13437
- SUBRULE(iriOrFunction, ast, void 0);
13462
+ SUBRULE(iriOrFunction, ast);
13438
13463
  } else if (F2.isExpressionAggregate(ast)) {
13439
- SUBRULE(aggregate, ast, void 0);
13464
+ SUBRULE(aggregate, ast);
13440
13465
  }
13441
13466
  }
13442
13467
  };
@@ -13453,10 +13478,10 @@ function constructLeftDeep(startGenerator, restGenerator, ACTION, MANY) {
13453
13478
  var conditionalOrExpression = {
13454
13479
  name: "conditionalOrExpression",
13455
13480
  impl: ({ ACTION, MANY, CONSUME, SUBRULE1, SUBRULE2 }) => (C) => constructLeftDeep(
13456
- () => SUBRULE1(conditionalAndExpression, void 0),
13481
+ () => SUBRULE1(conditionalAndExpression),
13457
13482
  () => {
13458
13483
  CONSUME(symbols_exports.logicOr);
13459
- const args = SUBRULE2(conditionalAndExpression, void 0);
13484
+ const args = SUBRULE2(conditionalAndExpression);
13460
13485
  return (left) => ACTION(() => C.factory.expressionOperation("||", [left, args], C.factory.sourceLocation(left, args)));
13461
13486
  },
13462
13487
  ACTION,
@@ -13466,10 +13491,10 @@ var conditionalOrExpression = {
13466
13491
  var conditionalAndExpression = {
13467
13492
  name: "conditionalAndExpression",
13468
13493
  impl: ({ ACTION, MANY, SUBRULE1, SUBRULE2, CONSUME }) => (C) => constructLeftDeep(
13469
- () => SUBRULE1(valueLogical, void 0),
13494
+ () => SUBRULE1(valueLogical),
13470
13495
  () => {
13471
13496
  CONSUME(symbols_exports.logicAnd);
13472
- const arg = SUBRULE2(valueLogical, void 0);
13497
+ const arg = SUBRULE2(valueLogical);
13473
13498
  return (left) => ACTION(() => C.factory.expressionOperation("&&", [left, arg], C.factory.sourceLocation(left, arg)));
13474
13499
  },
13475
13500
  ACTION,
@@ -13478,12 +13503,12 @@ var conditionalAndExpression = {
13478
13503
  };
13479
13504
  var valueLogical = {
13480
13505
  name: "valueLogical",
13481
- impl: ({ SUBRULE }) => () => SUBRULE(relationalExpression, void 0)
13506
+ impl: ({ SUBRULE }) => () => SUBRULE(relationalExpression)
13482
13507
  };
13483
13508
  var relationalExpression = {
13484
13509
  name: "relationalExpression",
13485
13510
  impl: ({ ACTION, CONSUME, SUBRULE1, SUBRULE2, OPTION, OR1, OR2, OR3 }) => (C) => {
13486
- const args1 = SUBRULE1(numericExpression, void 0);
13511
+ const args1 = SUBRULE1(numericExpression);
13487
13512
  const expression2 = OPTION(() => OR1([
13488
13513
  { ALT: () => {
13489
13514
  const operator = OR2([
@@ -13494,7 +13519,7 @@ var relationalExpression = {
13494
13519
  { ALT: () => CONSUME(symbols_exports.lessThanEqual) },
13495
13520
  { ALT: () => CONSUME(symbols_exports.greaterThanEqual) }
13496
13521
  ]);
13497
- const expr = SUBRULE2(numericExpression, void 0);
13522
+ const expr = SUBRULE2(numericExpression);
13498
13523
  return ACTION(() => C.factory.expressionOperation(
13499
13524
  operator.image,
13500
13525
  [args1, expr],
@@ -13506,7 +13531,7 @@ var relationalExpression = {
13506
13531
  { ALT: () => CONSUME(in_) },
13507
13532
  { ALT: () => CONSUME(notIn) }
13508
13533
  ]);
13509
- const args = SUBRULE1(expressionList, void 0);
13534
+ const args = SUBRULE1(expressionList);
13510
13535
  return ACTION(() => C.factory.expressionOperation(
13511
13536
  operator.image,
13512
13537
  [args1, ...args.val],
@@ -13519,25 +13544,25 @@ var relationalExpression = {
13519
13544
  };
13520
13545
  var numericExpression = {
13521
13546
  name: "numericExpression",
13522
- impl: ({ SUBRULE }) => () => SUBRULE(additiveExpression, void 0)
13547
+ impl: ({ SUBRULE }) => () => SUBRULE(additiveExpression)
13523
13548
  };
13524
13549
  var additiveExpression = {
13525
13550
  name: "additiveExpression",
13526
13551
  impl: ({ ACTION, SUBRULE, CONSUME, SUBRULE1, SUBRULE2, MANY1, MANY2, OR1, OR2, OR3, OR4 }) => (C) => constructLeftDeep(
13527
- () => SUBRULE1(multiplicativeExpression, void 0),
13552
+ () => SUBRULE1(multiplicativeExpression),
13528
13553
  () => OR1([
13529
13554
  { ALT: () => {
13530
13555
  const operator = OR2([
13531
13556
  { ALT: () => CONSUME(symbols_exports.opPlus) },
13532
13557
  { ALT: () => CONSUME(symbols_exports.opMinus) }
13533
13558
  ]);
13534
- const arg = SUBRULE2(multiplicativeExpression, void 0);
13559
+ const arg = SUBRULE2(multiplicativeExpression);
13535
13560
  return ACTION(() => (left) => C.factory.expressionOperation(operator.image, [left, arg], C.factory.sourceLocation(left, arg)));
13536
13561
  } },
13537
13562
  { ALT: () => {
13538
13563
  const { operator, startInt } = OR3([
13539
13564
  { ALT: () => {
13540
- const integer2 = SUBRULE(numericLiteralPositive, void 0);
13565
+ const integer2 = SUBRULE(numericLiteralPositive);
13541
13566
  return ACTION(() => {
13542
13567
  integer2.value = integer2.value.replace(/^\+/u, "");
13543
13568
  return {
@@ -13547,7 +13572,7 @@ var additiveExpression = {
13547
13572
  });
13548
13573
  } },
13549
13574
  { ALT: () => {
13550
- const integer2 = SUBRULE(numericLiteralNegative, void 0);
13575
+ const integer2 = SUBRULE(numericLiteralNegative);
13551
13576
  return ACTION(() => {
13552
13577
  integer2.value = integer2.value.replace(/^-/u, "");
13553
13578
  return {
@@ -13564,7 +13589,7 @@ var additiveExpression = {
13564
13589
  { ALT: () => CONSUME(symbols_exports.star) },
13565
13590
  { ALT: () => CONSUME(symbols_exports.slash) }
13566
13591
  ]);
13567
- const innerExpr = SUBRULE1(unaryExpression, void 0);
13592
+ const innerExpr = SUBRULE1(unaryExpression);
13568
13593
  return ACTION(() => (leftInner) => C.factory.expressionOperation(
13569
13594
  innerOperator.image,
13570
13595
  [leftInner, innerExpr],
@@ -13588,13 +13613,13 @@ var additiveExpression = {
13588
13613
  var multiplicativeExpression = {
13589
13614
  name: "multiplicativeExpression",
13590
13615
  impl: ({ ACTION, CONSUME, MANY, SUBRULE1, SUBRULE2, OR }) => (C) => constructLeftDeep(
13591
- () => SUBRULE1(unaryExpression, void 0),
13616
+ () => SUBRULE1(unaryExpression),
13592
13617
  () => {
13593
13618
  const operator = OR([
13594
13619
  { ALT: () => CONSUME(symbols_exports.star) },
13595
13620
  { ALT: () => CONSUME(symbols_exports.slash) }
13596
13621
  ]);
13597
- const expr = SUBRULE2(unaryExpression, void 0);
13622
+ const expr = SUBRULE2(unaryExpression);
13598
13623
  return (left) => ({
13599
13624
  type: "expression",
13600
13625
  subType: "operation",
@@ -13610,14 +13635,14 @@ var multiplicativeExpression = {
13610
13635
  var unaryExpression = {
13611
13636
  name: "unaryExpression",
13612
13637
  impl: ({ ACTION, CONSUME, SUBRULE1, SUBRULE2, OR1, OR2 }) => (C) => OR1([
13613
- { ALT: () => SUBRULE1(primaryExpression, void 0) },
13638
+ { ALT: () => SUBRULE1(primaryExpression) },
13614
13639
  { ALT: () => {
13615
13640
  const operator = OR2([
13616
13641
  { ALT: () => CONSUME(symbols_exports.exclamation) },
13617
13642
  { ALT: () => CONSUME(symbols_exports.opPlus) },
13618
13643
  { ALT: () => CONSUME(symbols_exports.opMinus) }
13619
13644
  ]);
13620
- const expr = SUBRULE2(primaryExpression, void 0);
13645
+ const expr = SUBRULE2(primaryExpression);
13621
13646
  return ACTION(() => ({
13622
13647
  type: "expression",
13623
13648
  subType: "operation",
@@ -13631,20 +13656,20 @@ var unaryExpression = {
13631
13656
  var primaryExpression = {
13632
13657
  name: "primaryExpression",
13633
13658
  impl: ({ SUBRULE, OR }) => () => OR([
13634
- { ALT: () => SUBRULE(brackettedExpression, void 0) },
13635
- { ALT: () => SUBRULE(builtInCall, void 0) },
13636
- { ALT: () => SUBRULE(iriOrFunction, void 0) },
13637
- { ALT: () => SUBRULE(rdfLiteral, void 0) },
13638
- { ALT: () => SUBRULE(numericLiteral, void 0) },
13639
- { ALT: () => SUBRULE(booleanLiteral, void 0) },
13640
- { ALT: () => SUBRULE(var_, void 0) }
13659
+ { ALT: () => SUBRULE(brackettedExpression) },
13660
+ { ALT: () => SUBRULE(builtInCall) },
13661
+ { ALT: () => SUBRULE(iriOrFunction) },
13662
+ { ALT: () => SUBRULE(rdfLiteral) },
13663
+ { ALT: () => SUBRULE(numericLiteral) },
13664
+ { ALT: () => SUBRULE(booleanLiteral) },
13665
+ { ALT: () => SUBRULE(var_) }
13641
13666
  ])
13642
13667
  };
13643
13668
  var brackettedExpression = {
13644
13669
  name: "brackettedExpression",
13645
13670
  impl: ({ ACTION, SUBRULE, CONSUME }) => (C) => {
13646
13671
  const open = CONSUME(symbols_exports.LParen);
13647
- const expr = SUBRULE(expression, void 0);
13672
+ const expr = SUBRULE(expression);
13648
13673
  const close = CONSUME(symbols_exports.RParen);
13649
13674
  return ACTION(() => {
13650
13675
  expr.loc = C.factory.sourceLocation(open, close);
@@ -13655,9 +13680,9 @@ var brackettedExpression = {
13655
13680
  var iriOrFunction = {
13656
13681
  name: "iriOrFunction",
13657
13682
  impl: ({ ACTION, SUBRULE, OPTION }) => (C) => {
13658
- const iriVal = SUBRULE(iri2, void 0);
13683
+ const iriVal = SUBRULE(iri2);
13659
13684
  const functionCall2 = OPTION(() => {
13660
- const args = SUBRULE(argList, void 0);
13685
+ const args = SUBRULE(argList);
13661
13686
  return ACTION(() => {
13662
13687
  const distinct2 = args.val.distinct;
13663
13688
  if (!C.parseMode.has("canParseAggregate") && distinct2) {
@@ -13677,10 +13702,10 @@ var iriOrFunction = {
13677
13702
  },
13678
13703
  gImpl: ({ SUBRULE }) => (ast, { factory: F2 }) => {
13679
13704
  if (F2.isTermNamed(ast)) {
13680
- SUBRULE(iri2, ast, void 0);
13705
+ SUBRULE(iri2, ast);
13681
13706
  } else {
13682
- SUBRULE(iri2, ast.function, void 0);
13683
- SUBRULE(argList, F2.wrap({ args: ast.args, distinct: ast.distinct }, ast.loc), void 0);
13707
+ SUBRULE(iri2, ast.function);
13708
+ SUBRULE(argList, F2.wrap({ args: ast.args, distinct: ast.distinct }, ast.loc));
13684
13709
  }
13685
13710
  }
13686
13711
  };
@@ -13689,10 +13714,10 @@ var iriOrFunction = {
13689
13714
  var solutionModifier = {
13690
13715
  name: "solutionModifier",
13691
13716
  impl: ({ ACTION, SUBRULE, OPTION1, OPTION2, OPTION3, OPTION4 }) => () => {
13692
- const group = OPTION1(() => SUBRULE(groupClause, void 0));
13693
- const having2 = OPTION2(() => SUBRULE(havingClause, void 0));
13694
- const order2 = OPTION3(() => SUBRULE(orderClause, void 0));
13695
- const limitOffset = OPTION4(() => SUBRULE(limitOffsetClauses, void 0));
13717
+ const group = OPTION1(() => SUBRULE(groupClause));
13718
+ const having2 = OPTION2(() => SUBRULE(havingClause));
13719
+ const order2 = OPTION3(() => SUBRULE(orderClause));
13720
+ const limitOffset = OPTION4(() => SUBRULE(limitOffsetClauses));
13696
13721
  return ACTION(() => ({
13697
13722
  ...limitOffset && { limitOffset },
13698
13723
  ...group && { group },
@@ -13702,16 +13727,16 @@ var solutionModifier = {
13702
13727
  },
13703
13728
  gImpl: ({ SUBRULE }) => (ast) => {
13704
13729
  if (ast.group) {
13705
- SUBRULE(groupClause, ast.group, void 0);
13730
+ SUBRULE(groupClause, ast.group);
13706
13731
  }
13707
13732
  if (ast.having) {
13708
- SUBRULE(havingClause, ast.having, void 0);
13733
+ SUBRULE(havingClause, ast.having);
13709
13734
  }
13710
13735
  if (ast.order) {
13711
- SUBRULE(orderClause, ast.order, void 0);
13736
+ SUBRULE(orderClause, ast.order);
13712
13737
  }
13713
13738
  if (ast.limitOffset) {
13714
- SUBRULE(limitOffsetClauses, ast.limitOffset, void 0);
13739
+ SUBRULE(limitOffsetClauses, ast.limitOffset);
13715
13740
  }
13716
13741
  }
13717
13742
  };
@@ -13722,7 +13747,7 @@ var groupClause = {
13722
13747
  const start = CONSUME(groupByGroup);
13723
13748
  CONSUME(by);
13724
13749
  AT_LEAST_ONE(() => {
13725
- groupings.push(SUBRULE1(groupCondition, void 0));
13750
+ groupings.push(SUBRULE1(groupCondition));
13726
13751
  });
13727
13752
  return ACTION(() => ({
13728
13753
  type: "solutionModifier",
@@ -13735,12 +13760,12 @@ var groupClause = {
13735
13760
  F2.printFilter(ast, () => PRINT_WORDS("GROUP", "BY"));
13736
13761
  for (const grouping of ast.groupings) {
13737
13762
  if (F2.isExpression(grouping)) {
13738
- SUBRULE(expression, grouping, void 0);
13763
+ SUBRULE(expression, grouping);
13739
13764
  } else {
13740
13765
  F2.printFilter(ast, () => PRINT_WORDS("("));
13741
- SUBRULE(expression, grouping.value, void 0);
13766
+ SUBRULE(expression, grouping.value);
13742
13767
  F2.printFilter(ast, () => PRINT_WORDS("AS"));
13743
- SUBRULE(var_, grouping.variable, void 0);
13768
+ SUBRULE(var_, grouping.variable);
13744
13769
  F2.printFilter(ast, () => PRINT_WORDS(")"));
13745
13770
  }
13746
13771
  }
@@ -13749,16 +13774,16 @@ var groupClause = {
13749
13774
  var groupCondition = {
13750
13775
  name: "groupCondition",
13751
13776
  impl: ({ ACTION, SUBRULE, CONSUME, SUBRULE1, SUBRULE2, OPTION, OR }) => (C) => OR([
13752
- { ALT: () => SUBRULE(builtInCall, void 0) },
13753
- { ALT: () => SUBRULE(functionCall, void 0) },
13754
- { ALT: () => SUBRULE2(var_, void 0) },
13777
+ { ALT: () => SUBRULE(builtInCall) },
13778
+ { ALT: () => SUBRULE(functionCall) },
13779
+ { ALT: () => SUBRULE2(var_) },
13755
13780
  {
13756
13781
  ALT: () => {
13757
13782
  const open = CONSUME(symbols_exports.LParen);
13758
- const expressionValue = SUBRULE(expression, void 0);
13783
+ const expressionValue = SUBRULE(expression);
13759
13784
  const variable = OPTION(() => {
13760
13785
  CONSUME(as);
13761
- return SUBRULE1(var_, void 0);
13786
+ return SUBRULE1(var_);
13762
13787
  });
13763
13788
  const close = CONSUME(symbols_exports.RParen);
13764
13789
  return ACTION(() => {
@@ -13782,7 +13807,7 @@ var havingClause = {
13782
13807
  const expressions = [];
13783
13808
  const couldParseAgg = ACTION(() => C.parseMode.has("canParseAggregate") || !C.parseMode.add("canParseAggregate"));
13784
13809
  AT_LEAST_ONE(() => {
13785
- expressions.push(SUBRULE(havingCondition, void 0));
13810
+ expressions.push(SUBRULE(havingCondition));
13786
13811
  });
13787
13812
  ACTION(() => !couldParseAgg && C.parseMode.delete("canParseAggregate"));
13788
13813
  return ACTION(() => C.factory.solutionModifierHaving(expressions, C.factory.sourceLocation(having2, expressions.at(-1))));
@@ -13790,13 +13815,13 @@ var havingClause = {
13790
13815
  gImpl: ({ PRINT_WORD, SUBRULE }) => (ast, { factory: F2 }) => {
13791
13816
  F2.printFilter(ast, () => PRINT_WORD("HAVING"));
13792
13817
  for (const having2 of ast.having) {
13793
- SUBRULE(expression, having2, void 0);
13818
+ SUBRULE(expression, having2);
13794
13819
  }
13795
13820
  }
13796
13821
  };
13797
13822
  var havingCondition = {
13798
13823
  name: "havingCondition",
13799
- impl: ({ SUBRULE }) => () => SUBRULE(constraint, void 0)
13824
+ impl: ({ SUBRULE }) => () => SUBRULE(constraint)
13800
13825
  };
13801
13826
  var orderClause = {
13802
13827
  name: "orderClause",
@@ -13806,7 +13831,7 @@ var orderClause = {
13806
13831
  const orderings = [];
13807
13832
  const couldParseAgg = ACTION(() => C.parseMode.has("canParseAggregate") || !C.parseMode.add("canParseAggregate"));
13808
13833
  AT_LEAST_ONE(() => {
13809
- orderings.push(SUBRULE1(orderCondition, void 0));
13834
+ orderings.push(SUBRULE1(orderCondition));
13810
13835
  });
13811
13836
  ACTION(() => !couldParseAgg && C.parseMode.delete("canParseAggregate"));
13812
13837
  return ACTION(() => C.factory.solutionModifierOrder(orderings, C.factory.sourceLocation(order2, orderings.at(-1))));
@@ -13820,7 +13845,7 @@ var orderClause = {
13820
13845
  F2.printFilter(ast, () => PRINT_WORDS("ASC"));
13821
13846
  }
13822
13847
  F2.printFilter(ast, () => PRINT_WORDS("("));
13823
- SUBRULE(expression, ordering.expression, void 0);
13848
+ SUBRULE(expression, ordering.expression);
13824
13849
  F2.printFilter(ast, () => PRINT_WORDS(")"));
13825
13850
  }
13826
13851
  }
@@ -13839,7 +13864,7 @@ var orderCondition = {
13839
13864
  return [true, token];
13840
13865
  } }
13841
13866
  ]);
13842
- const expr = SUBRULE(brackettedExpression, void 0);
13867
+ const expr = SUBRULE(brackettedExpression);
13843
13868
  return ACTION(() => ({
13844
13869
  expression: expr,
13845
13870
  descending: descending[0],
@@ -13847,11 +13872,11 @@ var orderCondition = {
13847
13872
  }));
13848
13873
  } },
13849
13874
  { ALT: () => {
13850
- const expr = SUBRULE(constraint, void 0);
13875
+ const expr = SUBRULE(constraint);
13851
13876
  return ACTION(() => ({ expression: expr, descending: false, loc: expr.loc }));
13852
13877
  } },
13853
13878
  { ALT: () => {
13854
- const expr = SUBRULE(var_, void 0);
13879
+ const expr = SUBRULE(var_);
13855
13880
  return ACTION(() => ({ expression: expr, descending: false, loc: expr.loc }));
13856
13881
  } }
13857
13882
  ])
@@ -13860,8 +13885,8 @@ var limitOffsetClauses = {
13860
13885
  name: "limitOffsetClauses",
13861
13886
  impl: ({ ACTION, SUBRULE1, SUBRULE2, OPTION1, OPTION2, OR }) => (C) => OR([
13862
13887
  { ALT: () => {
13863
- const limit2 = SUBRULE1(limitClause, void 0);
13864
- const offset2 = OPTION1(() => SUBRULE1(offsetClause, void 0));
13888
+ const limit2 = SUBRULE1(limitClause);
13889
+ const offset2 = OPTION1(() => SUBRULE1(offsetClause));
13865
13890
  return ACTION(() => C.factory.solutionModifierLimitOffset(
13866
13891
  limit2.val,
13867
13892
  offset2?.val,
@@ -13869,8 +13894,8 @@ var limitOffsetClauses = {
13869
13894
  ));
13870
13895
  } },
13871
13896
  { ALT: () => {
13872
- const offset2 = SUBRULE2(offsetClause, void 0);
13873
- const limit2 = OPTION2(() => SUBRULE2(limitClause, void 0));
13897
+ const offset2 = SUBRULE2(offsetClause);
13898
+ const limit2 = OPTION2(() => SUBRULE2(limitClause));
13874
13899
  return ACTION(() => C.factory.solutionModifierLimitOffset(
13875
13900
  limit2?.val,
13876
13901
  offset2.val,
@@ -13908,22 +13933,22 @@ var offsetClause = {
13908
13933
  }
13909
13934
  };
13910
13935
 
13911
- // ../../packages/rules-sparql-1-1/lib/grammar/queryUnit/queryUnit.ts
13936
+ // ../../packages/rules-sparql-1-1/lib/grammar/queryUnit.ts
13912
13937
  var queryUnit = {
13913
13938
  name: "queryUnit",
13914
- impl: ({ SUBRULE }) => () => SUBRULE(query, void 0)
13939
+ impl: ({ SUBRULE }) => () => SUBRULE(query)
13915
13940
  };
13916
13941
  var query = {
13917
13942
  name: "query",
13918
13943
  impl: ({ ACTION, SUBRULE, OR }) => (C) => {
13919
- const prologueValues = SUBRULE(prologue, void 0);
13944
+ const prologueValues = SUBRULE(prologue);
13920
13945
  const subType = OR([
13921
- { ALT: () => SUBRULE(selectQuery, void 0) },
13922
- { ALT: () => SUBRULE(constructQuery, void 0) },
13923
- { ALT: () => SUBRULE(describeQuery, void 0) },
13924
- { ALT: () => SUBRULE(askQuery, void 0) }
13946
+ { ALT: () => SUBRULE(selectQuery) },
13947
+ { ALT: () => SUBRULE(constructQuery) },
13948
+ { ALT: () => SUBRULE(describeQuery) },
13949
+ { ALT: () => SUBRULE(askQuery) }
13925
13950
  ]);
13926
- const values3 = SUBRULE(valuesClause, void 0);
13951
+ const values3 = SUBRULE(valuesClause);
13927
13952
  return ACTION(() => ({
13928
13953
  context: prologueValues,
13929
13954
  ...subType,
@@ -13937,28 +13962,28 @@ var query = {
13937
13962
  }));
13938
13963
  },
13939
13964
  gImpl: ({ SUBRULE }) => (ast, { factory: F2 }) => {
13940
- SUBRULE(prologue, ast.context, void 0);
13965
+ SUBRULE(prologue, ast.context);
13941
13966
  if (F2.isQuerySelect(ast)) {
13942
- SUBRULE(selectQuery, ast, void 0);
13967
+ SUBRULE(selectQuery, ast);
13943
13968
  } else if (F2.isQueryConstruct(ast)) {
13944
- SUBRULE(constructQuery, ast, void 0);
13969
+ SUBRULE(constructQuery, ast);
13945
13970
  } else if (F2.isQueryDescribe(ast)) {
13946
- SUBRULE(describeQuery, ast, void 0);
13971
+ SUBRULE(describeQuery, ast);
13947
13972
  } else if (F2.isQueryAsk(ast)) {
13948
- SUBRULE(askQuery, ast, void 0);
13973
+ SUBRULE(askQuery, ast);
13949
13974
  }
13950
13975
  if (ast.values) {
13951
- SUBRULE(inlineData, ast.values, void 0);
13976
+ SUBRULE(inlineData, ast.values);
13952
13977
  }
13953
13978
  }
13954
13979
  };
13955
13980
  var selectQuery = {
13956
13981
  name: "selectQuery",
13957
13982
  impl: ({ ACTION, SUBRULE }) => (C) => {
13958
- const selectVal = SUBRULE(selectClause, void 0);
13959
- const from2 = SUBRULE(datasetClauseStar, void 0);
13960
- const where2 = SUBRULE(whereClause, void 0);
13961
- const modifiers = SUBRULE(solutionModifier, void 0);
13983
+ const selectVal = SUBRULE(selectClause);
13984
+ const from2 = SUBRULE(datasetClauseStar);
13985
+ const where2 = SUBRULE(whereClause);
13986
+ const modifiers = SUBRULE(solutionModifier);
13962
13987
  return ACTION(() => {
13963
13988
  const ret = {
13964
13989
  subType: "select",
@@ -13984,19 +14009,19 @@ var selectQuery = {
13984
14009
  variables: ast.variables,
13985
14010
  distinct: ast.distinct,
13986
14011
  reduced: ast.reduced
13987
- }, F2.sourceLocation(...ast.variables)), void 0);
13988
- SUBRULE(datasetClauseStar, ast.datasets, void 0);
13989
- SUBRULE(whereClause, F2.wrap(ast.where, ast.where.loc), void 0);
13990
- SUBRULE(solutionModifier, ast.solutionModifiers, void 0);
14012
+ }, F2.sourceLocation(...ast.variables)));
14013
+ SUBRULE(datasetClauseStar, ast.datasets);
14014
+ SUBRULE(whereClause, F2.wrap(ast.where, ast.where.loc));
14015
+ SUBRULE(solutionModifier, ast.solutionModifiers);
13991
14016
  }
13992
14017
  };
13993
14018
  var subSelect = {
13994
14019
  name: "subSelect",
13995
14020
  impl: ({ ACTION, SUBRULE }) => (C) => {
13996
- const selectVal = SUBRULE(selectClause, void 0);
13997
- const where2 = SUBRULE(whereClause, void 0);
13998
- const modifiers = SUBRULE(solutionModifier, void 0);
13999
- const values3 = SUBRULE(valuesClause, void 0);
14021
+ const selectVal = SUBRULE(selectClause);
14022
+ const where2 = SUBRULE(whereClause);
14023
+ const modifiers = SUBRULE(solutionModifier);
14024
+ const values3 = SUBRULE(valuesClause);
14000
14025
  return ACTION(() => C.factory.querySelect({
14001
14026
  where: where2.val,
14002
14027
  datasets: C.factory.datasetClauses([], C.factory.sourceLocation()),
@@ -14061,7 +14086,7 @@ var selectClause = {
14061
14086
  const variables = [];
14062
14087
  AT_LEAST_ONE(() => OR3([
14063
14088
  { ALT: () => {
14064
- const raw = SUBRULE1(var_, void 0);
14089
+ const raw = SUBRULE1(var_);
14065
14090
  ACTION(() => {
14066
14091
  if (usedVars.some((v) => v.value === raw.value)) {
14067
14092
  throw new Error(`Variable ${raw.value} used more than once in SELECT clause`);
@@ -14073,9 +14098,9 @@ var selectClause = {
14073
14098
  } },
14074
14099
  { ALT: () => {
14075
14100
  const open = CONSUME(symbols_exports.LParen);
14076
- const expr = SUBRULE1(expression, void 0);
14101
+ const expr = SUBRULE1(expression);
14077
14102
  CONSUME(as);
14078
- const variable = SUBRULE2(var_, void 0);
14103
+ const variable = SUBRULE2(var_);
14079
14104
  const close = CONSUME(symbols_exports.RParen);
14080
14105
  ACTION(() => {
14081
14106
  last2 = close;
@@ -14106,12 +14131,12 @@ var selectClause = {
14106
14131
  if (F2.isWildcard(variable)) {
14107
14132
  F2.printFilter(ast, () => PRINT_WORD("*"));
14108
14133
  } else if (F2.isTerm(variable)) {
14109
- SUBRULE(var_, variable, void 0);
14134
+ SUBRULE(var_, variable);
14110
14135
  } else {
14111
14136
  F2.printFilter(ast, () => PRINT_WORD("("));
14112
- SUBRULE(expression, variable.expression, void 0);
14137
+ SUBRULE(expression, variable.expression);
14113
14138
  F2.printFilter(ast, () => PRINT_WORD("AS"));
14114
- SUBRULE(var_, variable.variable, void 0);
14139
+ SUBRULE(var_, variable.variable);
14115
14140
  F2.printFilter(ast, () => PRINT_WORD(")"));
14116
14141
  }
14117
14142
  }
@@ -14123,10 +14148,10 @@ var constructQuery = {
14123
14148
  const construct2 = CONSUME(construct);
14124
14149
  return OR([
14125
14150
  { ALT: () => {
14126
- const template = SUBRULE1(constructTemplate, void 0);
14127
- const from2 = SUBRULE1(datasetClauseStar, void 0);
14128
- const where2 = SUBRULE1(whereClause, void 0);
14129
- const modifiers = SUBRULE1(solutionModifier, void 0);
14151
+ const template = SUBRULE1(constructTemplate);
14152
+ const from2 = SUBRULE1(datasetClauseStar);
14153
+ const where2 = SUBRULE1(whereClause);
14154
+ const modifiers = SUBRULE1(solutionModifier);
14130
14155
  return ACTION(() => ({
14131
14156
  subType: "construct",
14132
14157
  template: template.val,
@@ -14144,10 +14169,10 @@ var constructQuery = {
14144
14169
  }));
14145
14170
  } },
14146
14171
  { ALT: () => {
14147
- const from2 = SUBRULE2(datasetClauseStar, void 0);
14172
+ const from2 = SUBRULE2(datasetClauseStar);
14148
14173
  CONSUME(where);
14149
- const template = SUBRULE2(constructTemplate, void 0);
14150
- const modifiers = SUBRULE2(solutionModifier, void 0);
14174
+ const template = SUBRULE2(constructTemplate);
14175
+ const modifiers = SUBRULE2(solutionModifier);
14151
14176
  return ACTION(() => ({
14152
14177
  subType: "construct",
14153
14178
  template: template.val,
@@ -14170,16 +14195,16 @@ var constructQuery = {
14170
14195
  F2.printFilter(ast, () => PRINT_WORD("CONSTRUCT"));
14171
14196
  if (!F2.isSourceLocationNoMaterialize(ast.where.loc)) {
14172
14197
  F2.printFilter(ast, () => PRINT_WORD("{"));
14173
- SUBRULE(triplesBlock, ast.template, void 0);
14198
+ SUBRULE(triplesBlock, ast.template);
14174
14199
  F2.printFilter(ast, () => PRINT_WORD("}"));
14175
14200
  }
14176
- SUBRULE(datasetClauseStar, ast.datasets, void 0);
14201
+ SUBRULE(datasetClauseStar, ast.datasets);
14177
14202
  if (F2.isSourceLocationNoMaterialize(ast.where.loc)) {
14178
- SUBRULE(whereClause, F2.wrap(F2.patternGroup([ast.template], ast.template.loc), ast.template.loc), void 0);
14203
+ SUBRULE(whereClause, F2.wrap(F2.patternGroup([ast.template], ast.template.loc), ast.template.loc));
14179
14204
  } else {
14180
- SUBRULE(whereClause, F2.wrap(ast.where, ast.where.loc), void 0);
14205
+ SUBRULE(whereClause, F2.wrap(ast.where, ast.where.loc));
14181
14206
  }
14182
- SUBRULE(solutionModifier, ast.solutionModifiers, void 0);
14207
+ SUBRULE(solutionModifier, ast.solutionModifiers);
14183
14208
  }
14184
14209
  };
14185
14210
  var describeQuery = {
@@ -14190,7 +14215,7 @@ var describeQuery = {
14190
14215
  { ALT: () => {
14191
14216
  const variables2 = [];
14192
14217
  AT_LEAST_ONE(() => {
14193
- variables2.push(SUBRULE1(varOrIri, void 0));
14218
+ variables2.push(SUBRULE1(varOrIri));
14194
14219
  });
14195
14220
  return variables2;
14196
14221
  } },
@@ -14199,9 +14224,9 @@ var describeQuery = {
14199
14224
  return [ACTION(() => C.factory.wildcard(C.factory.sourceLocation(star2)))];
14200
14225
  } }
14201
14226
  ]);
14202
- const from2 = SUBRULE1(datasetClauseStar, void 0);
14203
- const where2 = OPTION(() => SUBRULE1(whereClause, void 0));
14204
- const modifiers = SUBRULE1(solutionModifier, void 0);
14227
+ const from2 = SUBRULE1(datasetClauseStar);
14228
+ const where2 = OPTION(() => SUBRULE1(whereClause));
14229
+ const modifiers = SUBRULE1(solutionModifier);
14205
14230
  return ACTION(() => ({
14206
14231
  subType: "describe",
14207
14232
  variables,
@@ -14226,23 +14251,23 @@ var describeQuery = {
14226
14251
  F2.printFilter(ast, () => PRINT_WORD("*"));
14227
14252
  } else {
14228
14253
  for (const variable of ast.variables) {
14229
- SUBRULE(varOrTerm, variable, void 0);
14254
+ SUBRULE(varOrTerm, variable);
14230
14255
  }
14231
14256
  }
14232
- SUBRULE(datasetClauseStar, ast.datasets, void 0);
14257
+ SUBRULE(datasetClauseStar, ast.datasets);
14233
14258
  if (ast.where) {
14234
- SUBRULE(whereClause, F2.wrap(ast.where, ast.loc), void 0);
14259
+ SUBRULE(whereClause, F2.wrap(ast.where, ast.loc));
14235
14260
  }
14236
- SUBRULE(solutionModifier, ast.solutionModifiers, void 0);
14261
+ SUBRULE(solutionModifier, ast.solutionModifiers);
14237
14262
  }
14238
14263
  };
14239
14264
  var askQuery = {
14240
14265
  name: "askQuery",
14241
14266
  impl: ({ ACTION, SUBRULE, CONSUME }) => (C) => {
14242
14267
  const ask2 = CONSUME(ask);
14243
- const from2 = SUBRULE(datasetClauseStar, void 0);
14244
- const where2 = SUBRULE(whereClause, void 0);
14245
- const modifiers = SUBRULE(solutionModifier, void 0);
14268
+ const from2 = SUBRULE(datasetClauseStar);
14269
+ const where2 = SUBRULE(whereClause);
14270
+ const modifiers = SUBRULE(solutionModifier);
14246
14271
  return ACTION(() => ({
14247
14272
  subType: "ask",
14248
14273
  datasets: from2,
@@ -14261,20 +14286,20 @@ var askQuery = {
14261
14286
  },
14262
14287
  gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F2 }) => {
14263
14288
  F2.printFilter(ast, () => PRINT_WORD("ASK"));
14264
- SUBRULE(datasetClauseStar, ast.datasets, void 0);
14265
- SUBRULE(whereClause, F2.wrap(ast.where, ast.loc), void 0);
14266
- SUBRULE(solutionModifier, ast.solutionModifiers, void 0);
14289
+ SUBRULE(datasetClauseStar, ast.datasets);
14290
+ SUBRULE(whereClause, F2.wrap(ast.where, ast.loc));
14291
+ SUBRULE(solutionModifier, ast.solutionModifiers);
14267
14292
  }
14268
14293
  };
14269
14294
  var valuesClause = {
14270
14295
  name: "valuesClause",
14271
- impl: ({ OPTION, SUBRULE }) => () => OPTION(() => SUBRULE(inlineData, void 0))
14296
+ impl: ({ OPTION, SUBRULE }) => () => OPTION(() => SUBRULE(inlineData))
14272
14297
  };
14273
14298
  var constructTemplate = {
14274
14299
  name: "constructTemplate",
14275
14300
  impl: ({ ACTION, SUBRULE1, CONSUME, OPTION }) => (C) => {
14276
14301
  const open = CONSUME(symbols_exports.LCurly);
14277
- const triples = OPTION(() => SUBRULE1(constructTriples, void 0));
14302
+ const triples = OPTION(() => SUBRULE1(constructTriples));
14278
14303
  const close = CONSUME(symbols_exports.RCurly);
14279
14304
  return ACTION(() => C.factory.wrap(
14280
14305
  triples ?? C.factory.patternBgp([], C.factory.sourceLocation()),
@@ -14287,27 +14312,27 @@ var constructTriples = {
14287
14312
  impl: triplesTemplate.impl
14288
14313
  };
14289
14314
 
14290
- // ../../packages/rules-sparql-1-1/lib/grammar/updateUnit/updateUnit.ts
14315
+ // ../../packages/rules-sparql-1-1/lib/grammar/updateUnit.ts
14291
14316
  var updateUnit = {
14292
14317
  name: "updateUnit",
14293
- impl: ({ SUBRULE }) => () => SUBRULE(update, void 0)
14318
+ impl: ({ SUBRULE }) => () => SUBRULE(update)
14294
14319
  };
14295
14320
  var update = {
14296
14321
  name: "update",
14297
14322
  impl: ({ ACTION, SUBRULE, SUBRULE1, SUBRULE2, CONSUME, OPTION1, MANY }) => (C) => {
14298
14323
  const updates = [];
14299
- const prologueValues = SUBRULE1(prologue, void 0);
14324
+ const prologueValues = SUBRULE1(prologue);
14300
14325
  updates.push({ context: prologueValues });
14301
14326
  let parsedSemi = true;
14302
14327
  MANY({
14303
14328
  GATE: () => parsedSemi,
14304
14329
  DEF: () => {
14305
14330
  parsedSemi = false;
14306
- updates.at(-1).operation = SUBRULE(update1, void 0);
14331
+ updates.at(-1).operation = SUBRULE(update1);
14307
14332
  OPTION1(() => {
14308
14333
  CONSUME(symbols_exports.semi);
14309
14334
  parsedSemi = true;
14310
- const innerPrologue = SUBRULE2(prologue, void 0);
14335
+ const innerPrologue = SUBRULE2(prologue);
14311
14336
  updates.push({ context: innerPrologue });
14312
14337
  });
14313
14338
  }
@@ -14329,9 +14354,9 @@ var update = {
14329
14354
  },
14330
14355
  gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F2 }) => {
14331
14356
  for (const update2 of ast.updates) {
14332
- SUBRULE(prologue, update2.context, void 0);
14357
+ SUBRULE(prologue, update2.context);
14333
14358
  if (update2.operation) {
14334
- SUBRULE(update1, update2.operation, void 0);
14359
+ SUBRULE(update1, update2.operation);
14335
14360
  F2.printFilter(ast, () => PRINT_WORD(" ;\n"));
14336
14361
  }
14337
14362
  }
@@ -14340,52 +14365,52 @@ var update = {
14340
14365
  var update1 = {
14341
14366
  name: "update1",
14342
14367
  impl: ({ SUBRULE, OR }) => () => OR([
14343
- { ALT: () => SUBRULE(load2, void 0) },
14344
- { ALT: () => SUBRULE(clear2, void 0) },
14345
- { ALT: () => SUBRULE(drop3, void 0) },
14346
- { ALT: () => SUBRULE(add2, void 0) },
14347
- { ALT: () => SUBRULE(move2, void 0) },
14348
- { ALT: () => SUBRULE(copy2, void 0) },
14349
- { ALT: () => SUBRULE(create2, void 0) },
14350
- { ALT: () => SUBRULE(insertData, void 0) },
14351
- { ALT: () => SUBRULE(deleteData, void 0) },
14352
- { ALT: () => SUBRULE(deleteWhere, void 0) },
14353
- { ALT: () => SUBRULE(modify, void 0) }
14368
+ { ALT: () => SUBRULE(load2) },
14369
+ { ALT: () => SUBRULE(clear2) },
14370
+ { ALT: () => SUBRULE(drop3) },
14371
+ { ALT: () => SUBRULE(add2) },
14372
+ { ALT: () => SUBRULE(move2) },
14373
+ { ALT: () => SUBRULE(copy2) },
14374
+ { ALT: () => SUBRULE(create2) },
14375
+ { ALT: () => SUBRULE(insertData) },
14376
+ { ALT: () => SUBRULE(deleteData) },
14377
+ { ALT: () => SUBRULE(deleteWhere) },
14378
+ { ALT: () => SUBRULE(modify) }
14354
14379
  ]),
14355
14380
  gImpl: ({ SUBRULE }) => (ast) => {
14356
14381
  switch (ast.subType) {
14357
14382
  case "load":
14358
- SUBRULE(load2, ast, void 0);
14383
+ SUBRULE(load2, ast);
14359
14384
  break;
14360
14385
  case "clear":
14361
- SUBRULE(clear2, ast, void 0);
14386
+ SUBRULE(clear2, ast);
14362
14387
  break;
14363
14388
  case "drop":
14364
- SUBRULE(drop3, ast, void 0);
14389
+ SUBRULE(drop3, ast);
14365
14390
  break;
14366
14391
  case "add":
14367
- SUBRULE(add2, ast, void 0);
14392
+ SUBRULE(add2, ast);
14368
14393
  break;
14369
14394
  case "move":
14370
- SUBRULE(move2, ast, void 0);
14395
+ SUBRULE(move2, ast);
14371
14396
  break;
14372
14397
  case "copy":
14373
- SUBRULE(copy2, ast, void 0);
14398
+ SUBRULE(copy2, ast);
14374
14399
  break;
14375
14400
  case "create":
14376
- SUBRULE(create2, ast, void 0);
14401
+ SUBRULE(create2, ast);
14377
14402
  break;
14378
14403
  case "insertdata":
14379
- SUBRULE(insertData, ast, void 0);
14404
+ SUBRULE(insertData, ast);
14380
14405
  break;
14381
14406
  case "deletedata":
14382
- SUBRULE(deleteData, ast, void 0);
14407
+ SUBRULE(deleteData, ast);
14383
14408
  break;
14384
14409
  case "deletewhere":
14385
- SUBRULE(deleteWhere, ast, void 0);
14410
+ SUBRULE(deleteWhere, ast);
14386
14411
  break;
14387
14412
  case "modify":
14388
- SUBRULE(modify, ast, void 0);
14413
+ SUBRULE(modify, ast);
14389
14414
  break;
14390
14415
  }
14391
14416
  }
@@ -14395,10 +14420,10 @@ var load2 = {
14395
14420
  impl: ({ ACTION, SUBRULE1, CONSUME, OPTION1, OPTION2 }) => (C) => {
14396
14421
  const loadToken = CONSUME(load);
14397
14422
  const silent2 = OPTION1(() => CONSUME(silent));
14398
- const source = SUBRULE1(iri2, void 0);
14423
+ const source = SUBRULE1(iri2);
14399
14424
  const destination = OPTION2(() => {
14400
14425
  CONSUME(loadInto);
14401
- return SUBRULE1(graphRef, void 0);
14426
+ return SUBRULE1(graphRef);
14402
14427
  });
14403
14428
  return ACTION(() => C.factory.updateOperationLoad(
14404
14429
  C.factory.sourceLocation(loadToken, source, destination),
@@ -14414,10 +14439,10 @@ var load2 = {
14414
14439
  PRINT_WORD("SILENT");
14415
14440
  }
14416
14441
  });
14417
- SUBRULE(iri2, ast.source, void 0);
14442
+ SUBRULE(iri2, ast.source);
14418
14443
  if (ast.destination) {
14419
14444
  F2.printFilter(ast, () => PRINT_WORD("INTO"));
14420
- SUBRULE(graphRefAll, ast.destination, void 0);
14445
+ SUBRULE(graphRefAll, ast.destination);
14421
14446
  }
14422
14447
  }
14423
14448
  };
@@ -14427,7 +14452,7 @@ function clearOrDrop(operation) {
14427
14452
  impl: ({ ACTION, SUBRULE1, CONSUME, OPTION }) => (C) => {
14428
14453
  const opToken = CONSUME(operation);
14429
14454
  const silent2 = OPTION(() => CONSUME(silent));
14430
- const destination = SUBRULE1(graphRefAll, void 0);
14455
+ const destination = SUBRULE1(graphRefAll);
14431
14456
  return ACTION(() => C.factory.updateOperationClearDrop(
14432
14457
  unCapitalize(operation.name),
14433
14458
  Boolean(silent2),
@@ -14442,7 +14467,7 @@ function clearOrDrop(operation) {
14442
14467
  PRINT_WORD("SILENT");
14443
14468
  }
14444
14469
  });
14445
- SUBRULE(graphRefAll, ast.destination, void 0);
14470
+ SUBRULE(graphRefAll, ast.destination);
14446
14471
  }
14447
14472
  };
14448
14473
  }
@@ -14453,7 +14478,7 @@ var create2 = {
14453
14478
  impl: ({ ACTION, SUBRULE1, CONSUME, OPTION }) => (C) => {
14454
14479
  const createToken3 = CONSUME(create);
14455
14480
  const silent2 = OPTION(() => CONSUME(silent));
14456
- const destination = SUBRULE1(graphRef, void 0);
14481
+ const destination = SUBRULE1(graphRef);
14457
14482
  return ACTION(() => C.factory.updateOperationCreate(
14458
14483
  destination,
14459
14484
  Boolean(silent2),
@@ -14467,7 +14492,7 @@ var create2 = {
14467
14492
  PRINT_WORD("SILENT");
14468
14493
  }
14469
14494
  });
14470
- SUBRULE(graphRefAll, ast.destination, void 0);
14495
+ SUBRULE(graphRefAll, ast.destination);
14471
14496
  }
14472
14497
  };
14473
14498
  function copyMoveAddOperation(operation) {
@@ -14476,9 +14501,9 @@ function copyMoveAddOperation(operation) {
14476
14501
  impl: ({ ACTION, CONSUME, SUBRULE1, SUBRULE2, OPTION }) => (C) => {
14477
14502
  const op = CONSUME(operation);
14478
14503
  const silent2 = OPTION(() => CONSUME(silent));
14479
- const source = SUBRULE1(graphOrDefault, void 0);
14504
+ const source = SUBRULE1(graphOrDefault);
14480
14505
  CONSUME(to);
14481
- const destination = SUBRULE2(graphOrDefault, void 0);
14506
+ const destination = SUBRULE2(graphOrDefault);
14482
14507
  return ACTION(() => C.factory.updateOperationAddMoveCopy(
14483
14508
  unCapitalize(operation.name),
14484
14509
  source,
@@ -14494,9 +14519,9 @@ function copyMoveAddOperation(operation) {
14494
14519
  PRINT_WORD("SILENT");
14495
14520
  }
14496
14521
  });
14497
- SUBRULE(graphRefAll, ast.source, void 0);
14522
+ SUBRULE(graphRefAll, ast.source);
14498
14523
  F2.printFilter(ast, () => PRINT_WORD("TO"));
14499
- SUBRULE(graphRefAll, ast.destination, void 0);
14524
+ SUBRULE(graphRefAll, ast.destination);
14500
14525
  }
14501
14526
  };
14502
14527
  }
@@ -14507,7 +14532,7 @@ var quadPattern = {
14507
14532
  name: "quadPattern",
14508
14533
  impl: ({ ACTION, SUBRULE1, CONSUME }) => (C) => {
14509
14534
  const open = CONSUME(symbols_exports.LCurly);
14510
- const val = SUBRULE1(quads, void 0);
14535
+ const val = SUBRULE1(quads);
14511
14536
  const close = CONSUME(symbols_exports.RCurly);
14512
14537
  return ACTION(() => C.factory.wrap(val.val, C.factory.sourceLocation(open, close)));
14513
14538
  }
@@ -14517,7 +14542,7 @@ var quadData = {
14517
14542
  impl: ({ ACTION, SUBRULE1, CONSUME }) => (C) => {
14518
14543
  const open = CONSUME(symbols_exports.LCurly);
14519
14544
  const couldParseVars = ACTION(() => C.parseMode.delete("canParseVars"));
14520
- const val = SUBRULE1(quads, void 0);
14545
+ const val = SUBRULE1(quads);
14521
14546
  ACTION(() => couldParseVars && C.parseMode.add("canParseVars"));
14522
14547
  const close = CONSUME(symbols_exports.RCurly);
14523
14548
  return ACTION(() => C.factory.wrap(val.val, C.factory.sourceLocation(open, close)));
@@ -14533,7 +14558,7 @@ function insertDeleteDelWhere(name, subType, cons1, cons2, dataRule) {
14533
14558
  if (name !== "insertData") {
14534
14559
  couldCreateBlankNodes = ACTION(() => C.parseMode.delete("canCreateBlankNodes"));
14535
14560
  }
14536
- const data = SUBRULE1(dataRule, void 0);
14561
+ const data = SUBRULE1(dataRule);
14537
14562
  if (name !== "insertData") {
14538
14563
  ACTION(() => couldCreateBlankNodes && C.parseMode.add("canCreateBlankNodes"));
14539
14564
  }
@@ -14544,7 +14569,7 @@ function insertDeleteDelWhere(name, subType, cons1, cons2, dataRule) {
14544
14569
  subType === "insertdata" ? "INSERT DATA" : subType === "deletedata" ? "DELETE DATA" : "DELETE WHERE",
14545
14570
  "{"
14546
14571
  ));
14547
- SUBRULE(quads, F2.wrap(ast.data, ast.loc), void 0);
14572
+ SUBRULE(quads, F2.wrap(ast.data, ast.loc));
14548
14573
  F2.printFilter(ast, () => PRINT_WORD("}"));
14549
14574
  }
14550
14575
  };
@@ -14557,23 +14582,23 @@ var modify = {
14557
14582
  impl: ({ ACTION, CONSUME, SUBRULE1, SUBRULE2, OPTION1, OPTION2, OR }) => (C) => {
14558
14583
  const graph2 = OPTION1(() => {
14559
14584
  const withToken = CONSUME(modifyWith);
14560
- const graph3 = SUBRULE1(iri2, void 0);
14585
+ const graph3 = SUBRULE1(iri2);
14561
14586
  return { withToken, graph: graph3 };
14562
14587
  });
14563
14588
  const { insert, del } = OR([
14564
14589
  { ALT: () => {
14565
- const del2 = SUBRULE1(deleteClause2, void 0);
14566
- const insert2 = OPTION2(() => SUBRULE1(insertClause2, void 0));
14590
+ const del2 = SUBRULE1(deleteClause2);
14591
+ const insert2 = OPTION2(() => SUBRULE1(insertClause2));
14567
14592
  return { del: del2, insert: insert2 };
14568
14593
  } },
14569
14594
  { ALT: () => {
14570
- const insert2 = SUBRULE2(insertClause2, void 0);
14595
+ const insert2 = SUBRULE2(insertClause2);
14571
14596
  return { insert: insert2, del: void 0 };
14572
14597
  } }
14573
14598
  ]);
14574
- const using = SUBRULE1(usingClauseStar, void 0);
14599
+ const using = SUBRULE1(usingClauseStar);
14575
14600
  CONSUME(where);
14576
- const where2 = SUBRULE1(groupGraphPattern, void 0);
14601
+ const where2 = SUBRULE1(groupGraphPattern);
14577
14602
  return ACTION(() => C.factory.updateOperationModify(
14578
14603
  C.factory.sourceLocation(graph2?.withToken, del, insert, where2),
14579
14604
  insert?.val ?? [],
@@ -14586,21 +14611,21 @@ var modify = {
14586
14611
  gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F2 }) => {
14587
14612
  if (ast.graph) {
14588
14613
  F2.printFilter(ast, () => PRINT_WORD("WITH"));
14589
- SUBRULE(iri2, ast.graph, void 0);
14614
+ SUBRULE(iri2, ast.graph);
14590
14615
  }
14591
14616
  if (ast.delete.length > 0) {
14592
14617
  F2.printFilter(ast, () => PRINT_WORD("DELETE", "{"));
14593
- SUBRULE(quads, F2.wrap(ast.delete, ast.loc), void 0);
14618
+ SUBRULE(quads, F2.wrap(ast.delete, ast.loc));
14594
14619
  F2.printFilter(ast, () => PRINT_WORD("}"));
14595
14620
  }
14596
14621
  if (ast.insert.length > 0) {
14597
14622
  F2.printFilter(ast, () => PRINT_WORD("INSERT", "{"));
14598
- SUBRULE(quads, F2.wrap(ast.insert, ast.loc), void 0);
14623
+ SUBRULE(quads, F2.wrap(ast.insert, ast.loc));
14599
14624
  F2.printFilter(ast, () => PRINT_WORD("}"));
14600
14625
  }
14601
- SUBRULE(usingClauseStar, ast.from, void 0);
14626
+ SUBRULE(usingClauseStar, ast.from);
14602
14627
  F2.printFilter(ast, () => PRINT_WORD("WHERE"));
14603
- SUBRULE(groupGraphPattern, ast.where, void 0);
14628
+ SUBRULE(groupGraphPattern, ast.where);
14604
14629
  }
14605
14630
  };
14606
14631
  var deleteClause2 = {
@@ -14608,7 +14633,7 @@ var deleteClause2 = {
14608
14633
  impl: ({ ACTION, SUBRULE, CONSUME }) => (C) => {
14609
14634
  const delToken = CONSUME(deleteClause);
14610
14635
  const couldCreateBlankNodes = ACTION(() => C.parseMode.delete("canCreateBlankNodes"));
14611
- const del = SUBRULE(quadPattern, void 0);
14636
+ const del = SUBRULE(quadPattern);
14612
14637
  ACTION(() => couldCreateBlankNodes && C.parseMode.add("canCreateBlankNodes"));
14613
14638
  return ACTION(() => C.factory.wrap(del.val, C.factory.sourceLocation(delToken, del)));
14614
14639
  }
@@ -14617,7 +14642,7 @@ var insertClause2 = {
14617
14642
  name: "insertClause",
14618
14643
  impl: ({ ACTION, SUBRULE, CONSUME }) => (C) => {
14619
14644
  const insertToken = CONSUME(insertClause);
14620
- const insert = SUBRULE(quadPattern, void 0);
14645
+ const insert = SUBRULE(quadPattern);
14621
14646
  return ACTION(() => C.factory.wrap(insert.val, C.factory.sourceLocation(insertToken, insert)));
14622
14647
  }
14623
14648
  };
@@ -14630,7 +14655,7 @@ var graphOrDefault = {
14630
14655
  } },
14631
14656
  { ALT: () => {
14632
14657
  const graph2 = OPTION(() => CONSUME(graph_exports.graph));
14633
- const name = SUBRULE1(iri2, void 0);
14658
+ const name = SUBRULE1(iri2);
14634
14659
  return ACTION(() => C.factory.graphRefSpecific(name, C.factory.sourceLocation(graph2, name)));
14635
14660
  } }
14636
14661
  ])
@@ -14639,18 +14664,18 @@ var graphRef = {
14639
14664
  name: "graphRef",
14640
14665
  impl: ({ ACTION, SUBRULE, CONSUME }) => (C) => {
14641
14666
  const graph2 = CONSUME(graph_exports.graph);
14642
- const val = SUBRULE(iri2, void 0);
14667
+ const val = SUBRULE(iri2);
14643
14668
  return ACTION(() => C.factory.graphRefSpecific(val, C.factory.sourceLocation(graph2, val)));
14644
14669
  },
14645
14670
  gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F2 }) => {
14646
14671
  F2.printFilter(ast, () => PRINT_WORD("GRAPH"));
14647
- SUBRULE(iri2, ast.graph, void 0);
14672
+ SUBRULE(iri2, ast.graph);
14648
14673
  }
14649
14674
  };
14650
14675
  var graphRefAll = {
14651
14676
  name: "graphRefAll",
14652
14677
  impl: ({ ACTION, SUBRULE, CONSUME, OR }) => (C) => OR([
14653
- { ALT: () => SUBRULE(graphRef, void 0) },
14678
+ { ALT: () => SUBRULE(graphRef) },
14654
14679
  { ALT: () => {
14655
14680
  const def = CONSUME(graph_exports.default_);
14656
14681
  return ACTION(() => C.factory.graphRefDefault(C.factory.sourceLocation(def)));
@@ -14666,7 +14691,7 @@ var graphRefAll = {
14666
14691
  ]),
14667
14692
  gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F2 }) => {
14668
14693
  if (F2.isGraphRefSpecific(ast)) {
14669
- SUBRULE(graphRef, ast, void 0);
14694
+ SUBRULE(graphRef, ast);
14670
14695
  } else if (F2.isGraphRefDefault(ast)) {
14671
14696
  F2.printFilter(ast, () => PRINT_WORD("DEFAULT"));
14672
14697
  } else if (F2.isGraphRefNamed(ast)) {
@@ -14682,12 +14707,12 @@ var quads = {
14682
14707
  const quads2 = [];
14683
14708
  let last2;
14684
14709
  OPTION1(() => {
14685
- const triples = SUBRULE1(triplesTemplate, void 0);
14710
+ const triples = SUBRULE1(triplesTemplate);
14686
14711
  last2 = triples;
14687
14712
  ACTION(() => quads2.push(triples));
14688
14713
  });
14689
14714
  MANY(() => {
14690
- const notTriples = SUBRULE(quadsNotTriples, void 0);
14715
+ const notTriples = SUBRULE(quadsNotTriples);
14691
14716
  last2 = notTriples;
14692
14717
  quads2.push(notTriples);
14693
14718
  OPTION2(() => {
@@ -14696,7 +14721,7 @@ var quads = {
14696
14721
  return dotToken;
14697
14722
  });
14698
14723
  OPTION3(() => {
14699
- const triples = SUBRULE2(triplesTemplate, void 0);
14724
+ const triples = SUBRULE2(triplesTemplate);
14700
14725
  last2 = triples;
14701
14726
  ACTION(() => quads2.push(triples));
14702
14727
  });
@@ -14706,9 +14731,9 @@ var quads = {
14706
14731
  gImpl: ({ SUBRULE }) => (ast, { factory: F2 }) => {
14707
14732
  for (const quad of ast.val) {
14708
14733
  if (F2.isPattern(quad)) {
14709
- SUBRULE(triplesBlock, quad, void 0);
14734
+ SUBRULE(triplesBlock, quad);
14710
14735
  } else {
14711
- SUBRULE(quadsNotTriples, quad, void 0);
14736
+ SUBRULE(quadsNotTriples, quad);
14712
14737
  }
14713
14738
  }
14714
14739
  }
@@ -14717,9 +14742,9 @@ var quadsNotTriples = {
14717
14742
  name: "quadsNotTriples",
14718
14743
  impl: ({ ACTION, SUBRULE1, CONSUME, OPTION }) => (C) => {
14719
14744
  const graph2 = CONSUME(graph_exports.graph);
14720
- const name = SUBRULE1(varOrIri, void 0);
14745
+ const name = SUBRULE1(varOrIri);
14721
14746
  CONSUME(symbols_exports.LCurly);
14722
- const triples = OPTION(() => SUBRULE1(triplesTemplate, void 0));
14747
+ const triples = OPTION(() => SUBRULE1(triplesTemplate));
14723
14748
  const close = CONSUME(symbols_exports.RCurly);
14724
14749
  return ACTION(() => C.factory.graphQuads(
14725
14750
  name,
@@ -14729,14 +14754,76 @@ var quadsNotTriples = {
14729
14754
  },
14730
14755
  gImpl: ({ SUBRULE, PRINT_WORD }) => (ast, { factory: F2 }) => {
14731
14756
  F2.printFilter(ast, () => PRINT_WORD("GRAPH"));
14732
- SUBRULE(varOrTerm, ast.graph, void 0);
14757
+ SUBRULE(varOrTerm, ast.graph);
14733
14758
  F2.printFilter(ast, () => PRINT_WORD("{"));
14734
- SUBRULE(triplesBlock, ast.triples, void 0);
14759
+ SUBRULE(triplesBlock, ast.triples);
14735
14760
  F2.printFilter(ast, () => PRINT_WORD("}"));
14736
14761
  }
14737
14762
  };
14738
14763
 
14739
- // ../../packages/rules-sparql-1-1/lib/SparqlParser.ts
14764
+ // ../../packages/rules-sparql-1-1/lib/grammar/index.ts
14765
+ var queryOrUpdate = {
14766
+ name: "queryOrUpdate",
14767
+ impl: ({ ACTION, SUBRULE, OR1, OR2, MANY, OPTION1, CONSUME, SUBRULE2 }) => (C) => {
14768
+ const prologueValues = SUBRULE(prologue);
14769
+ return OR1([
14770
+ { ALT: () => {
14771
+ const subType = OR2([
14772
+ { ALT: () => SUBRULE(selectQuery) },
14773
+ { ALT: () => SUBRULE(constructQuery) },
14774
+ { ALT: () => SUBRULE(describeQuery) },
14775
+ { ALT: () => SUBRULE(askQuery) }
14776
+ ]);
14777
+ const values3 = SUBRULE(valuesClause);
14778
+ return ACTION(() => ({
14779
+ context: prologueValues,
14780
+ ...subType,
14781
+ type: "query",
14782
+ ...values3 && { values: values3 },
14783
+ loc: C.factory.sourceLocation(
14784
+ prologueValues.at(0),
14785
+ subType,
14786
+ values3
14787
+ )
14788
+ }));
14789
+ } },
14790
+ { ALT: () => {
14791
+ const updates = [];
14792
+ updates.push({ context: prologueValues });
14793
+ let parsedSemi = true;
14794
+ MANY({
14795
+ GATE: () => parsedSemi,
14796
+ DEF: () => {
14797
+ parsedSemi = false;
14798
+ updates.at(-1).operation = SUBRULE(update1);
14799
+ OPTION1(() => {
14800
+ CONSUME(symbols_exports.semi);
14801
+ parsedSemi = true;
14802
+ const innerPrologue = SUBRULE2(prologue);
14803
+ updates.push({ context: innerPrologue });
14804
+ });
14805
+ }
14806
+ });
14807
+ return ACTION(() => {
14808
+ const update2 = {
14809
+ type: "update",
14810
+ updates,
14811
+ loc: C.factory.sourceLocation(
14812
+ ...updates[0].context,
14813
+ updates[0].operation,
14814
+ ...updates.at(-1).context,
14815
+ updates.at(-1)?.operation
14816
+ )
14817
+ };
14818
+ updateNoReuseBlankNodeLabels(update2);
14819
+ return update2;
14820
+ });
14821
+ } }
14822
+ ]);
14823
+ }
14824
+ };
14825
+
14826
+ // ../../packages/rules-sparql-1-1/lib/MinimalSparqlParser.ts
14740
14827
  function completeParseContext(context) {
14741
14828
  return {
14742
14829
  factory: context.factory ?? new Factory(),
@@ -14748,16 +14835,16 @@ function completeParseContext(context) {
14748
14835
  skipValidation: context.skipValidation ?? false
14749
14836
  };
14750
14837
  }
14751
- var SparqlParser = class {
14838
+ var MinimalSparqlParser = class {
14752
14839
  constructor(parser) {
14753
14840
  this.parser = parser;
14754
- this.F = new Factory();
14755
14841
  }
14842
+ F = new Factory();
14756
14843
  parse(query2, context = {}) {
14757
- return this.parser.queryOrUpdate(query2, completeParseContext(context), void 0);
14844
+ return this.parser.queryOrUpdate(query2, completeParseContext(context));
14758
14845
  }
14759
14846
  parsePath(query2, context = {}) {
14760
- const result = this.parser.path(query2, completeParseContext(context), void 0);
14847
+ const result = this.parser.path(query2, completeParseContext(context));
14761
14848
  if (this.F.isPathPure(result)) {
14762
14849
  return {
14763
14850
  ...result,
@@ -14768,29 +14855,6 @@ var SparqlParser = class {
14768
14855
  }
14769
14856
  };
14770
14857
 
14771
- // ../../packages/rules-sparql-1-1/lib/utils.ts
14772
- function sparqlCodepointEscape(input) {
14773
- const sanitizedInput = input.replaceAll(
14774
- /\\u([0-9a-fA-F]{4})|\\U([0-9a-fA-F]{8})/gu,
14775
- (_, unicode4, unicode8) => {
14776
- if (unicode4) {
14777
- const charCode2 = Number.parseInt(unicode4, 16);
14778
- return String.fromCodePoint(charCode2);
14779
- }
14780
- const charCode = Number.parseInt(unicode8, 16);
14781
- if (charCode < 65535) {
14782
- return String.fromCodePoint(charCode);
14783
- }
14784
- const substractedCharCode = charCode - 65536;
14785
- return String.fromCodePoint(55296 + (substractedCharCode >> 10), 56320 + (substractedCharCode & 1023));
14786
- }
14787
- );
14788
- if (/[\uD800-\uDBFF](?:[^\uDC00-\uDFFF]|$)/u.test(sanitizedInput)) {
14789
- throw new Error(`Invalid unicode codepoint of surrogate pair without corresponding codepoint`);
14790
- }
14791
- return sanitizedInput;
14792
- }
14793
-
14794
14858
  // ../parser-sparql-1-1/lib/expressionParser.ts
14795
14859
  var rulesNoBuiltIn = [
14796
14860
  grammar_exports.expression,
@@ -14914,7 +14978,7 @@ var rules = [
14914
14978
  grammar_exports.numericLiteralPositive,
14915
14979
  grammar_exports.numericLiteralNegative
14916
14980
  ];
14917
- var objectListBuilder = ParserBuilder.create(rules);
14981
+ var objectListParserBuilder = ParserBuilder.create(rules);
14918
14982
 
14919
14983
  // ../parser-sparql-1-1/lib/triplesBlockParser.ts
14920
14984
  var triplesBlockParserBuilder = ParserBuilder.create([
@@ -14928,7 +14992,7 @@ var triplesBlockParserBuilder = ParserBuilder.create([
14928
14992
  grammar_exports.verbPath,
14929
14993
  grammar_exports.verbSimple,
14930
14994
  grammar_exports.objectListPath
14931
- ]).merge(objectListBuilder, []).addMany(
14995
+ ]).merge(objectListParserBuilder, []).addMany(
14932
14996
  grammar_exports.path,
14933
14997
  grammar_exports.pathAlternative,
14934
14998
  grammar_exports.pathSequence,
@@ -15037,16 +15101,16 @@ var queryUnitParserBuilder = ParserBuilder.create(rules4).merge(subSelectParserB
15037
15101
  var update1Patch = {
15038
15102
  name: "update1",
15039
15103
  impl: ({ SUBRULE, OR }) => () => OR([
15040
- { ALT: () => SUBRULE(grammar_exports.load, void 0) },
15041
- { ALT: () => SUBRULE(grammar_exports.clear, void 0) },
15042
- { ALT: () => SUBRULE(grammar_exports.drop, void 0) },
15043
- { ALT: () => SUBRULE(grammar_exports.add, void 0) },
15044
- { ALT: () => SUBRULE(grammar_exports.move, void 0) },
15045
- { ALT: () => SUBRULE(grammar_exports.copy, void 0) },
15046
- { ALT: () => SUBRULE(grammar_exports.create, void 0) },
15047
- { ALT: () => SUBRULE(grammar_exports.insertData, void 0) },
15048
- { ALT: () => SUBRULE(grammar_exports.deleteData, void 0) },
15049
- { ALT: () => SUBRULE(grammar_exports.deleteWhere, void 0) }
15104
+ { ALT: () => SUBRULE(grammar_exports.load) },
15105
+ { ALT: () => SUBRULE(grammar_exports.clear) },
15106
+ { ALT: () => SUBRULE(grammar_exports.drop) },
15107
+ { ALT: () => SUBRULE(grammar_exports.add) },
15108
+ { ALT: () => SUBRULE(grammar_exports.move) },
15109
+ { ALT: () => SUBRULE(grammar_exports.copy) },
15110
+ { ALT: () => SUBRULE(grammar_exports.create) },
15111
+ { ALT: () => SUBRULE(grammar_exports.insertData) },
15112
+ { ALT: () => SUBRULE(grammar_exports.deleteData) },
15113
+ { ALT: () => SUBRULE(grammar_exports.deleteWhere) }
15050
15114
  ]),
15051
15115
  gImpl: grammar_exports.update1.gImpl
15052
15116
  };
@@ -15088,76 +15152,16 @@ var updateParserBuilder = ParserBuilder.create(updateNoModifyParserBuilder).patc
15088
15152
  grammar_exports.sourceSelector,
15089
15153
  grammar_exports.usingClauseStar,
15090
15154
  grammar_exports.groupGraphPattern
15091
- ).merge(objectListBuilder, []).merge(subSelectParserBuilder, []);
15155
+ ).merge(objectListParserBuilder, []).merge(subSelectParserBuilder, []);
15092
15156
 
15093
15157
  // ../parser-sparql-1-1/lib/Parser.ts
15094
- var queryOrUpdate = {
15095
- name: "queryOrUpdate",
15096
- impl: ({ ACTION, SUBRULE, OR1, OR2, MANY, OPTION1, CONSUME, SUBRULE2 }) => (C) => {
15097
- const prologueValues = SUBRULE(grammar_exports.prologue, void 0);
15098
- return OR1([
15099
- { ALT: () => {
15100
- const subType = OR2([
15101
- { ALT: () => SUBRULE(grammar_exports.selectQuery, void 0) },
15102
- { ALT: () => SUBRULE(grammar_exports.constructQuery, void 0) },
15103
- { ALT: () => SUBRULE(grammar_exports.describeQuery, void 0) },
15104
- { ALT: () => SUBRULE(grammar_exports.askQuery, void 0) }
15105
- ]);
15106
- const values3 = SUBRULE(grammar_exports.valuesClause, void 0);
15107
- return ACTION(() => ({
15108
- context: prologueValues,
15109
- ...subType,
15110
- type: "query",
15111
- ...values3 && { values: values3 },
15112
- loc: C.factory.sourceLocation(
15113
- prologueValues.at(0),
15114
- subType,
15115
- values3
15116
- )
15117
- }));
15118
- } },
15119
- { ALT: () => {
15120
- const updates = [];
15121
- updates.push({ context: prologueValues });
15122
- let parsedSemi = true;
15123
- MANY({
15124
- GATE: () => parsedSemi,
15125
- DEF: () => {
15126
- parsedSemi = false;
15127
- updates.at(-1).operation = SUBRULE(grammar_exports.update1, void 0);
15128
- OPTION1(() => {
15129
- CONSUME(lexer_exports.symbols.semi);
15130
- parsedSemi = true;
15131
- const innerPrologue = SUBRULE2(grammar_exports.prologue, void 0);
15132
- updates.push({ context: innerPrologue });
15133
- });
15134
- }
15135
- });
15136
- return ACTION(() => {
15137
- const update2 = {
15138
- type: "update",
15139
- updates,
15140
- loc: C.factory.sourceLocation(
15141
- ...updates[0].context,
15142
- updates[0].operation,
15143
- ...updates.at(-1).context,
15144
- updates.at(-1)?.operation
15145
- )
15146
- };
15147
- updateNoReuseBlankNodeLabels(update2);
15148
- return update2;
15149
- });
15150
- } }
15151
- ]);
15152
- }
15153
- };
15154
- var sparql11ParserBuilder = ParserBuilder.create(queryUnitParserBuilder).merge(updateParserBuilder, []).addRule(queryOrUpdate);
15158
+ var sparql11ParserBuilder = ParserBuilder.create(queryUnitParserBuilder).merge(updateParserBuilder, []).addRule(grammar_exports.queryOrUpdate);
15155
15159
 
15156
15160
  // ../../packages/rules-sparql-1-1-adjust/lib/grammar.ts
15157
15161
  var grammar_exports2 = {};
15158
15162
  __export(grammar_exports2, {
15159
15163
  builtInAdjust: () => builtInAdjust,
15160
- existingBuildInCall: () => existingBuildInCall
15164
+ builtInPatch: () => builtInPatch2
15161
15165
  });
15162
15166
 
15163
15167
  // ../../packages/rules-sparql-1-1-adjust/lib/lexer.ts
@@ -15169,25 +15173,21 @@ var BuiltInAdjust = createToken2({ name: "BuiltInAdjust", pattern: "ADJUST" });
15169
15173
 
15170
15174
  // ../../packages/rules-sparql-1-1-adjust/lib/grammar.ts
15171
15175
  var builtInAdjust = funcExpr2(BuiltInAdjust);
15172
- var existingBuildInCall = {
15173
- name: "existingBuildInCall",
15174
- impl: grammar_exports.builtInCall.impl
15175
- };
15176
-
15177
- // lib/Parser.ts
15178
15176
  var builtInPatch2 = {
15179
- name: "builtInCall",
15180
- impl: ({ SUBRULE, OR }) => () => OR([
15181
- { ALT: () => SUBRULE(grammar_exports2.builtInAdjust, void 0) },
15182
- { ALT: () => SUBRULE(grammar_exports2.existingBuildInCall, void 0) }
15177
+ name: grammar_exports.builtInCall.name,
15178
+ impl: ($) => (C) => $.OR2([
15179
+ { ALT: () => $.SUBRULE(builtInAdjust) },
15180
+ { ALT: () => grammar_exports.builtInCall.impl($)(C) }
15183
15181
  ])
15184
15182
  };
15185
- var adjustBuilder = ParserBuilder.create(sparql11ParserBuilder).addRule(grammar_exports2.builtInAdjust).addRule(grammar_exports2.existingBuildInCall).patchRule(builtInPatch2);
15186
- var lexerBuilder = LexerBuilder.create(lexer_exports.sparql11Tokens).addBefore(lexer_exports.a, lexer_exports2.BuiltInAdjust);
15187
- var Parser2 = class extends SparqlParser {
15183
+
15184
+ // lib/Parser.ts
15185
+ var adjustParserBuilder = ParserBuilder.create(sparql11ParserBuilder).typePatch().addRule(grammar_exports2.builtInAdjust).patchRule(grammar_exports2.builtInPatch);
15186
+ var adjustLexerBuilder = LexerBuilder.create(lexer_exports.sparql11LexerBuilder).addBefore(lexer_exports.a, lexer_exports2.BuiltInAdjust);
15187
+ var Parser2 = class extends MinimalSparqlParser {
15188
15188
  constructor() {
15189
- const parser = adjustBuilder.build({
15190
- tokenVocabulary: lexerBuilder.tokenVocabulary,
15189
+ const parser = adjustParserBuilder.build({
15190
+ tokenVocabulary: adjustLexerBuilder.tokenVocabulary,
15191
15191
  queryPreProcessor: sparqlCodepointEscape
15192
15192
  });
15193
15193
  super(parser);