@traqula/rules-sparql-1-1 0.0.23 → 0.0.25

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.
Files changed (116) hide show
  1. package/README.md +2 -0
  2. package/dist/cjs/lib/MinimalSparqlParser.js +66 -58
  3. package/dist/cjs/lib/MinimalSparqlParser.js.map +1 -0
  4. package/dist/cjs/lib/Sparql11types.js +2 -15
  5. package/dist/cjs/lib/Sparql11types.js.map +1 -0
  6. package/dist/cjs/lib/astFactory.js +110 -119
  7. package/dist/cjs/lib/astFactory.js.map +1 -0
  8. package/dist/cjs/lib/expressionHelpers.js +181 -191
  9. package/dist/cjs/lib/expressionHelpers.js.map +1 -0
  10. package/dist/cjs/lib/factoryMixins/ContextFactory.js +30 -52
  11. package/dist/cjs/lib/factoryMixins/ContextFactory.js.map +1 -0
  12. package/dist/cjs/lib/factoryMixins/ExpressionFactory.js +83 -102
  13. package/dist/cjs/lib/factoryMixins/ExpressionFactory.js.map +1 -0
  14. package/dist/cjs/lib/factoryMixins/GraphRefFactory.js +51 -73
  15. package/dist/cjs/lib/factoryMixins/GraphRefFactory.js.map +1 -0
  16. package/dist/cjs/lib/factoryMixins/PathFactory.js +68 -87
  17. package/dist/cjs/lib/factoryMixins/PathFactory.js.map +1 -0
  18. package/dist/cjs/lib/factoryMixins/Patternfactory.js +98 -120
  19. package/dist/cjs/lib/factoryMixins/Patternfactory.js.map +1 -0
  20. package/dist/cjs/lib/factoryMixins/QueryFactory.js +43 -65
  21. package/dist/cjs/lib/factoryMixins/QueryFactory.js.map +1 -0
  22. package/dist/cjs/lib/factoryMixins/SolutionModifiersFactory.js +55 -77
  23. package/dist/cjs/lib/factoryMixins/SolutionModifiersFactory.js.map +1 -0
  24. package/dist/cjs/lib/factoryMixins/TermFactory.js +81 -102
  25. package/dist/cjs/lib/factoryMixins/TermFactory.js.map +1 -0
  26. package/dist/cjs/lib/factoryMixins/UpdateOperationFactory.js +126 -147
  27. package/dist/cjs/lib/factoryMixins/UpdateOperationFactory.js.map +1 -0
  28. package/dist/cjs/lib/factoryMixins/mixins.js +21 -38
  29. package/dist/cjs/lib/factoryMixins/mixins.js.map +1 -0
  30. package/dist/cjs/lib/grammar/builtIn.js +277 -377
  31. package/dist/cjs/lib/grammar/builtIn.js.map +1 -0
  32. package/dist/cjs/lib/grammar/dataSetClause.js +110 -109
  33. package/dist/cjs/lib/grammar/dataSetClause.js.map +1 -0
  34. package/dist/cjs/lib/grammar/expression.js +387 -358
  35. package/dist/cjs/lib/grammar/expression.js.map +1 -0
  36. package/dist/cjs/lib/grammar/general.js +173 -158
  37. package/dist/cjs/lib/grammar/general.js.map +1 -0
  38. package/dist/cjs/lib/grammar/index.js +94 -111
  39. package/dist/cjs/lib/grammar/index.js.map +1 -0
  40. package/dist/cjs/lib/grammar/literals.js +292 -266
  41. package/dist/cjs/lib/grammar/literals.js.map +1 -0
  42. package/dist/cjs/lib/grammar/propertyPaths.js +206 -193
  43. package/dist/cjs/lib/grammar/propertyPaths.js.map +1 -0
  44. package/dist/cjs/lib/grammar/queryUnit.js +395 -372
  45. package/dist/cjs/lib/grammar/queryUnit.js.map +1 -0
  46. package/dist/cjs/lib/grammar/solutionModifier.js +281 -265
  47. package/dist/cjs/lib/grammar/solutionModifier.js.map +1 -0
  48. package/dist/cjs/lib/grammar/tripleBlock.js +396 -355
  49. package/dist/cjs/lib/grammar/tripleBlock.js.map +1 -0
  50. package/dist/cjs/lib/grammar/updateUnit.js +551 -519
  51. package/dist/cjs/lib/grammar/updateUnit.js.map +1 -0
  52. package/dist/cjs/lib/grammar/whereClause.js +486 -459
  53. package/dist/cjs/lib/grammar/whereClause.js.map +1 -0
  54. package/dist/cjs/lib/index.js +47 -54
  55. package/dist/cjs/lib/index.js.map +1 -0
  56. package/dist/cjs/lib/lexer/BuiltInCalls.js +188 -333
  57. package/dist/cjs/lib/lexer/BuiltInCalls.js.map +1 -0
  58. package/dist/cjs/lib/lexer/graph.js +10 -40
  59. package/dist/cjs/lib/lexer/graph.js.map +1 -0
  60. package/dist/cjs/lib/lexer/index.js +43 -48
  61. package/dist/cjs/lib/lexer/index.js.map +1 -0
  62. package/dist/cjs/lib/lexer/lexer.js +84 -195
  63. package/dist/cjs/lib/lexer/lexer.js.map +1 -0
  64. package/dist/cjs/lib/lexer/lexerPatterns.js +40 -132
  65. package/dist/cjs/lib/lexer/lexerPatterns.js.map +1 -0
  66. package/dist/cjs/lib/lexer/symbols.js +31 -106
  67. package/dist/cjs/lib/lexer/symbols.js.map +1 -0
  68. package/dist/cjs/lib/lexer/terminals.js +100 -102
  69. package/dist/cjs/lib/lexer/terminals.js.map +1 -0
  70. package/dist/cjs/lib/sparql11HelperTypes.js +2 -15
  71. package/dist/cjs/lib/sparql11HelperTypes.js.map +1 -0
  72. package/dist/cjs/lib/utils.js +40 -58
  73. package/dist/cjs/lib/utils.js.map +1 -0
  74. package/dist/cjs/lib/validation/validators.js +217 -196
  75. package/dist/cjs/lib/validation/validators.js.map +1 -0
  76. package/dist/esm/lib/MinimalSparqlParser.d.ts +26 -8
  77. package/dist/esm/lib/MinimalSparqlParser.js +40 -11
  78. package/dist/esm/lib/MinimalSparqlParser.js.map +1 -1
  79. package/dist/esm/lib/astFactory.d.ts +66 -45
  80. package/dist/esm/lib/astFactory.js +3 -0
  81. package/dist/esm/lib/astFactory.js.map +1 -1
  82. package/dist/esm/lib/factoryMixins/ContextFactory.d.ts +7 -5
  83. package/dist/esm/lib/factoryMixins/ExpressionFactory.d.ts +7 -5
  84. package/dist/esm/lib/factoryMixins/GraphRefFactory.d.ts +7 -5
  85. package/dist/esm/lib/factoryMixins/PathFactory.d.ts +7 -5
  86. package/dist/esm/lib/factoryMixins/Patternfactory.d.ts +7 -5
  87. package/dist/esm/lib/factoryMixins/QueryFactory.d.ts +7 -5
  88. package/dist/esm/lib/factoryMixins/SolutionModifiersFactory.d.ts +7 -5
  89. package/dist/esm/lib/factoryMixins/TermFactory.d.ts +7 -5
  90. package/dist/esm/lib/factoryMixins/UpdateOperationFactory.d.ts +7 -5
  91. package/dist/esm/lib/grammar/index.js +1 -1
  92. package/dist/esm/lib/grammar/index.js.map +1 -1
  93. package/dist/esm/lib/grammar/literals.js +23 -13
  94. package/dist/esm/lib/grammar/literals.js.map +1 -1
  95. package/dist/esm/lib/grammar/propertyPaths.d.ts +2 -2
  96. package/dist/esm/lib/grammar/tripleBlock.d.ts +4 -4
  97. package/dist/esm/lib/grammar/tripleBlock.js +18 -12
  98. package/dist/esm/lib/grammar/tripleBlock.js.map +1 -1
  99. package/dist/esm/lib/grammar/updateUnit.js +2 -2
  100. package/dist/esm/lib/grammar/updateUnit.js.map +1 -1
  101. package/dist/esm/lib/lexer/BuiltInCalls.d.ts +1 -1
  102. package/dist/esm/lib/lexer/graph.d.ts +1 -1
  103. package/dist/esm/lib/lexer/lexer.d.ts +2 -2
  104. package/dist/esm/lib/lexer/lexerPatterns.d.ts +1 -1
  105. package/dist/esm/lib/lexer/lexerPatterns.js +1 -1
  106. package/dist/esm/lib/lexer/lexerPatterns.js.map +1 -1
  107. package/dist/esm/lib/lexer/symbols.d.ts +1 -1
  108. package/dist/esm/lib/lexer/terminals.d.ts +2 -2
  109. package/dist/esm/lib/lexer/terminals.js +3 -3
  110. package/dist/esm/lib/lexer/terminals.js.map +1 -1
  111. package/dist/esm/lib/sparql11HelperTypes.d.ts +1 -1
  112. package/dist/esm/lib/sparql11HelperTypes.js.map +1 -1
  113. package/dist/esm/lib/validation/validators.d.ts +2 -2
  114. package/dist/esm/lib/validation/validators.js +61 -51
  115. package/dist/esm/lib/validation/validators.js.map +1 -1
  116. package/package.json +10 -10
@@ -1,21 +1,39 @@
1
+ import type { Localized } from '@traqula/core';
2
+ import { TransformerObject } from '@traqula/core';
1
3
  import type { SparqlContext, SparqlGeneratorContext } from './sparql11HelperTypes.js';
2
4
  import type { Path, TermIri } from './Sparql11types.js';
3
5
  interface Parser<ParseRet> {
4
6
  queryOrUpdate: (input: string, context: SparqlContext) => ParseRet;
5
7
  path: (input: string, context: SparqlContext) => TermIri | Path;
6
8
  }
7
- export declare function completeParseContext(context: Partial<SparqlContext & SparqlGeneratorContext & {
8
- origSource: string;
9
+ export declare function completeParseContext(context: Partial<SparqlContext>): SparqlContext;
10
+ export declare function completeGeneratorContext(context: Partial<SparqlGeneratorContext & {
9
11
  offset?: number;
10
- }>): SparqlContext & SparqlGeneratorContext & {
11
- origSource: string;
12
+ }>): SparqlGeneratorContext & {
12
13
  offset?: number;
13
14
  };
14
- export declare class MinimalSparqlParser<ParseRet> {
15
- private readonly parser;
16
- constructor(parser: Parser<ParseRet>);
17
- private readonly F;
15
+ export declare function copyParseContext<T extends Partial<SparqlContext & SparqlGeneratorContext & {
16
+ origSource: string;
17
+ offset?: number;
18
+ }>>(context: T): T;
19
+ export declare class MinimalSparqlParser<ParseRet extends Localized> {
20
+ protected readonly parser: Parser<ParseRet>;
21
+ protected readonly defaultContext: SparqlContext;
22
+ protected readonly coreTransformer: TransformerObject;
23
+ constructor(parser: Parser<ParseRet>, defaultContext?: Partial<SparqlContext>);
24
+ /**
25
+ * Parse a query string starting from the
26
+ * [QueryUnit](https://www.w3.org/TR/sparql11-query/#rQueryUnit)
27
+ * or [QueryUpdate](https://www.w3.org/TR/sparql11-query/#rUpdateUnit) rules.
28
+ * @param query
29
+ * @param context
30
+ */
18
31
  parse(query: string, context?: Partial<SparqlContext>): ParseRet;
32
+ /**
33
+ * Parse a query string starting from the [Path](https://www.w3.org/TR/sparql11-query/#rPath) grammar rule.
34
+ * @param query
35
+ * @param context
36
+ */
19
37
  parsePath(query: string, context?: Partial<SparqlContext>): (Path & {
20
38
  prefixes: object;
21
39
  }) | TermIri;
@@ -1,36 +1,65 @@
1
- import { traqulaIndentation } from '@traqula/core';
1
+ import { TransformerObject, traqulaIndentation } from '@traqula/core';
2
2
  import { AstFactory } from './astFactory.js';
3
3
  export function completeParseContext(context) {
4
4
  return {
5
- astFactory: context.astFactory ?? new AstFactory(),
5
+ astFactory: context.astFactory ?? new AstFactory({ tracksSourceLocation: false }),
6
6
  baseIRI: context.baseIRI,
7
7
  prefixes: { ...context.prefixes },
8
- origSource: context.origSource ?? '',
9
- offset: context.offset,
10
8
  parseMode: context.parseMode ? new Set(context.parseMode) : new Set(['canParseVars', 'canCreateBlankNodes']),
11
9
  skipValidation: context.skipValidation ?? false,
10
+ };
11
+ }
12
+ export function completeGeneratorContext(context) {
13
+ return {
14
+ astFactory: context.astFactory ?? new AstFactory(),
15
+ origSource: context.origSource ?? '',
16
+ offset: context.offset,
12
17
  [traqulaIndentation]: context[traqulaIndentation] ?? 0,
13
18
  indentInc: context.indentInc ?? 2,
14
19
  };
15
20
  }
21
+ export function copyParseContext(context) {
22
+ return {
23
+ ...context,
24
+ prefixes: { ...context.prefixes },
25
+ parseMode: new Set(context.parseMode),
26
+ };
27
+ }
16
28
  export class MinimalSparqlParser {
17
29
  parser;
18
- constructor(parser) {
30
+ defaultContext;
31
+ coreTransformer = new TransformerObject();
32
+ constructor(parser, defaultContext = {}) {
19
33
  this.parser = parser;
34
+ this.defaultContext = completeParseContext(defaultContext);
20
35
  }
21
- F = new AstFactory();
36
+ /**
37
+ * Parse a query string starting from the
38
+ * [QueryUnit](https://www.w3.org/TR/sparql11-query/#rQueryUnit)
39
+ * or [QueryUpdate](https://www.w3.org/TR/sparql11-query/#rUpdateUnit) rules.
40
+ * @param query
41
+ * @param context
42
+ */
22
43
  parse(query, context = {}) {
23
- return this.parser.queryOrUpdate(query, completeParseContext(context));
44
+ const ast = this.parser.queryOrUpdate(query, copyParseContext({ ...this.defaultContext, ...context }));
45
+ ast.loc = this.defaultContext.astFactory.sourceLocationInlinedSource(query, ast.loc, 0, Number.MAX_SAFE_INTEGER);
46
+ return ast;
24
47
  }
48
+ /**
49
+ * Parse a query string starting from the [Path](https://www.w3.org/TR/sparql11-query/#rPath) grammar rule.
50
+ * @param query
51
+ * @param context
52
+ */
25
53
  parsePath(query, context = {}) {
26
- const result = this.parser.path(query, completeParseContext(context));
27
- if (this.F.isPathPure(result)) {
54
+ const ast = this.parser.path(query, copyParseContext({ ...this.defaultContext, ...context }));
55
+ ast.loc = this.defaultContext.astFactory.sourceLocationInlinedSource(query, ast.loc, 0, Number.MAX_SAFE_INTEGER);
56
+ if (this.defaultContext.astFactory.isPathPure(ast)) {
28
57
  return {
29
- ...result,
58
+ ...ast,
30
59
  prefixes: {},
31
60
  };
32
61
  }
33
- return result;
62
+ return ast;
34
63
  }
35
64
  }
36
65
  //# sourceMappingURL=MinimalSparqlParser.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"MinimalSparqlParser.js","sourceRoot":"","sources":["../../../lib/MinimalSparqlParser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAS7C,MAAM,UAAU,oBAAoB,CAClC,OAAkG;IAElG,OAAO;QACL,UAAU,EAAE,OAAO,CAAC,UAAU,IAAI,IAAI,UAAU,EAAE;QAClD,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,QAAQ,EAAE,EAAE,GAAG,OAAO,CAAC,QAAQ,EAAE;QACjC,UAAU,EAAE,OAAO,CAAC,UAAU,IAAI,EAAE;QACpC,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,SAAS,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAE,cAAc,EAAE,qBAAqB,CAAE,CAAC;QAC9G,cAAc,EAAE,OAAO,CAAC,cAAc,IAAI,KAAK;QAC/C,CAAC,kBAAkB,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC,IAAI,CAAC;QACtD,SAAS,EAAE,OAAO,CAAC,SAAS,IAAI,CAAC;KAClC,CAAC;AACJ,CAAC;AAED,MAAM,OAAO,mBAAmB;IACM;IAApC,YAAoC,MAAwB;QAAxB,WAAM,GAAN,MAAM,CAAkB;IAAG,CAAC;IAC/C,CAAC,GAAG,IAAI,UAAU,EAAE,CAAC;IAE/B,KAAK,CAAC,KAAa,EAAE,UAAkC,EAAE;QAC9D,OAAO,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC,CAAC;IACzE,CAAC;IAEM,SAAS,CAAC,KAAa,EAAE,UAAkC,EAAE;QAElE,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC,CAAC;QACtE,IAAI,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;YAC9B,OAAO;gBACL,GAAG,MAAM;gBACT,QAAQ,EAAE,EAAE;aACb,CAAC;QACJ,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;CACF","sourcesContent":["import { traqulaIndentation } from '@traqula/core';\nimport { AstFactory } from './astFactory.js';\nimport type { SparqlContext, SparqlGeneratorContext } from './sparql11HelperTypes.js';\nimport type { Path, TermIri } from './Sparql11types.js';\n\ninterface Parser<ParseRet> {\n queryOrUpdate: (input: string, context: SparqlContext) => ParseRet;\n path: (input: string, context: SparqlContext) => TermIri | Path;\n}\n\nexport function completeParseContext(\n context: Partial<SparqlContext & SparqlGeneratorContext & { origSource: string; offset?: number }>,\n): SparqlContext & SparqlGeneratorContext & { origSource: string; offset?: number } {\n return {\n astFactory: context.astFactory ?? new AstFactory(),\n baseIRI: context.baseIRI,\n prefixes: { ...context.prefixes },\n origSource: context.origSource ?? '',\n offset: context.offset,\n parseMode: context.parseMode ? new Set(context.parseMode) : new Set([ 'canParseVars', 'canCreateBlankNodes' ]),\n skipValidation: context.skipValidation ?? false,\n [traqulaIndentation]: context[traqulaIndentation] ?? 0,\n indentInc: context.indentInc ?? 2,\n };\n}\n\nexport class MinimalSparqlParser<ParseRet> {\n public constructor(private readonly parser: Parser<ParseRet>) {}\n private readonly F = new AstFactory();\n\n public parse(query: string, context: Partial<SparqlContext> = {}): ParseRet {\n return this.parser.queryOrUpdate(query, completeParseContext(context));\n }\n\n public parsePath(query: string, context: Partial<SparqlContext> = {}):\n (Path & { prefixes: object }) | TermIri {\n const result = this.parser.path(query, completeParseContext(context));\n if (this.F.isPathPure(result)) {\n return {\n ...result,\n prefixes: {},\n };\n }\n return result;\n }\n}\n"]}
1
+ {"version":3,"file":"MinimalSparqlParser.js","sourceRoot":"","sources":["../../../lib/MinimalSparqlParser.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAS7C,MAAM,UAAU,oBAAoB,CAClC,OAA+B;IAE/B,OAAO;QACL,UAAU,EAAE,OAAO,CAAC,UAAU,IAAI,IAAI,UAAU,CAAC,EAAE,oBAAoB,EAAE,KAAK,EAAE,CAAC;QACjF,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,QAAQ,EAAE,EAAE,GAAG,OAAO,CAAC,QAAQ,EAAE;QACjC,SAAS,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAE,cAAc,EAAE,qBAAqB,CAAE,CAAC;QAC9G,cAAc,EAAE,OAAO,CAAC,cAAc,IAAI,KAAK;KAChD,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,wBAAwB,CACtC,OAA8D;IAE9D,OAAO;QACL,UAAU,EAAE,OAAO,CAAC,UAAU,IAAI,IAAI,UAAU,EAAE;QAClD,UAAU,EAAE,OAAO,CAAC,UAAU,IAAI,EAAE;QACpC,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,CAAC,kBAAkB,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC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,CAAC,2BAA2B,CAAC,KAAK,EAAE,GAAG,CAAC,GAAG,EAAE,CAAC,EAAE,MAAM,CAAC,gBAAgB,CAAC,CAAC;QACjH,IAAI,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;YACnD,OAAO;gBACL,GAAG,GAAG;gBACN,QAAQ,EAAE,EAAE;aACb,CAAC;QACJ,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC;CACF","sourcesContent":["import type { Localized } from '@traqula/core';\nimport { TransformerObject, traqulaIndentation } from '@traqula/core';\nimport { AstFactory } from './astFactory.js';\nimport type { SparqlContext, SparqlGeneratorContext } from './sparql11HelperTypes.js';\nimport type { Path, TermIri } from './Sparql11types.js';\n\ninterface Parser<ParseRet> {\n queryOrUpdate: (input: string, context: SparqlContext) => ParseRet;\n path: (input: string, context: SparqlContext) => TermIri | Path;\n}\n\nexport function completeParseContext(\n context: Partial<SparqlContext>,\n): SparqlContext {\n return {\n astFactory: context.astFactory ?? new AstFactory({ tracksSourceLocation: false }),\n baseIRI: context.baseIRI,\n prefixes: { ...context.prefixes },\n parseMode: context.parseMode ? new Set(context.parseMode) : new Set([ 'canParseVars', 'canCreateBlankNodes' ]),\n skipValidation: context.skipValidation ?? false,\n };\n}\n\nexport function completeGeneratorContext(\n context: Partial<SparqlGeneratorContext & { offset?: number }>,\n): SparqlGeneratorContext & { offset?: number } {\n return {\n astFactory: context.astFactory ?? new AstFactory(),\n origSource: context.origSource ?? '',\n offset: context.offset,\n [traqulaIndentation]: context[traqulaIndentation] ?? 0,\n indentInc: context.indentInc ?? 2,\n };\n}\n\nexport function copyParseContext<T extends\nPartial<SparqlContext & SparqlGeneratorContext & { origSource: string; offset?: number }>>(\n context: T,\n): T {\n return {\n ...context,\n prefixes: { ...context.prefixes },\n parseMode: new Set(context.parseMode),\n };\n}\n\nexport class MinimalSparqlParser<ParseRet extends Localized> {\n protected readonly defaultContext: SparqlContext;\n protected readonly coreTransformer = new TransformerObject();\n\n public constructor(protected readonly parser: Parser<ParseRet>, defaultContext: Partial<SparqlContext> = {}) {\n this.defaultContext = completeParseContext(defaultContext);\n }\n\n /**\n * Parse a query string starting from the\n * [QueryUnit](https://www.w3.org/TR/sparql11-query/#rQueryUnit)\n * or [QueryUpdate](https://www.w3.org/TR/sparql11-query/#rUpdateUnit) rules.\n * @param query\n * @param context\n */\n public parse(query: string, context: Partial<SparqlContext> = {}): ParseRet {\n const ast = this.parser.queryOrUpdate(query, copyParseContext({ ...this.defaultContext, ...context }));\n ast.loc = this.defaultContext.astFactory.sourceLocationInlinedSource(query, ast.loc, 0, Number.MAX_SAFE_INTEGER);\n return ast;\n }\n\n /**\n * Parse a query string starting from the [Path](https://www.w3.org/TR/sparql11-query/#rPath) grammar rule.\n * @param query\n * @param context\n */\n public parsePath(query: string, context: Partial<SparqlContext> = {}):\n (Path & { prefixes: object }) | TermIri {\n const ast = this.parser.path(query, copyParseContext({ ...this.defaultContext, ...context }));\n ast.loc = this.defaultContext.astFactory.sourceLocationInlinedSource(query, ast.loc, 0, Number.MAX_SAFE_INTEGER);\n if (this.defaultContext.astFactory.isPathPure(ast)) {\n return {\n ...ast,\n prefixes: {},\n };\n }\n return ast;\n }\n}\n"]}
@@ -37,27 +37,29 @@ declare const AstFactory_base: {
37
37
  isUpdateOperationDeleteWhere(obj: object): obj is SubTyped<"updateOperation", "deletewhere">;
38
38
  updateOperationModify(loc: SourceLocation, insert: import("./Sparql11types.js").Quads[] | undefined, del: import("./Sparql11types.js").Quads[] | undefined, where: import("./Sparql11types.js").PatternGroup, from: DatasetClauses, graph?: TermIri | undefined): import("./Sparql11types.js").UpdateOperationModify;
39
39
  isUpdateOperationModify(obj: object): obj is SubTyped<"updateOperation", "modify">;
40
+ tracksSourceLocation: boolean;
40
41
  wrap<T>(val: T, loc: SourceLocation): import("@traqula/core").Wrap<T>;
41
42
  isLocalized(obj: unknown): obj is import("@traqula/core").Localized;
42
43
  sourceLocation(...elements: (undefined | import("chevrotain").IToken | import("@traqula/core").Localized)[]): SourceLocation;
43
- sourceLocationNoMaterialize(): import("@traqula/core").SourceLocationNoMaterialize;
44
- dematerialized<T extends import("@traqula/core").Node>(arg: T): T & {
45
- loc: import("@traqula/core").SourceLocationNoMaterialize;
46
- };
44
+ sourceLocationNoMaterialize(): SourceLocation;
45
+ dematerialized<T extends import("@traqula/core").Node>(arg: T): T;
47
46
  safeObjectTransform(value: unknown, mapper: (some: object) => any): any;
48
47
  forcedAutoGenTree<T extends object>(obj: T): T;
49
48
  forceMaterialized<T extends import("@traqula/core").Node>(arg: T): T;
50
49
  isSourceLocation(loc: object): loc is SourceLocation;
51
50
  sourceLocationSource(start: number, end: number): import("@traqula/core").SourceLocationSource;
51
+ sourceLocationInlinedSource(newSource: string, subLoc: SourceLocation, start: number, end: number, startOnNew?: number, endOnNew?: number): SourceLocation;
52
+ isSourceLocationInlinedSource(loc: object): loc is import("@traqula/core").SourceLocationInlinedSource;
52
53
  gen(): import("@traqula/core").SourceLocationNodeAutoGenerate;
53
54
  isSourceLocationSource(loc: object): loc is import("@traqula/core").SourceLocationSource;
55
+ sourceLocationStringReplace(newSource: string, start: number, end: number): SourceLocation;
54
56
  isSourceLocationStringReplace(loc: object): loc is import("@traqula/core").SourceLocationStringReplace;
55
57
  sourceLocationNodeReplaceUnsafe(loc: SourceLocation): import("@traqula/core").SourceLocationNodeReplace;
56
58
  sourceLocationNodeReplace(location: import("@traqula/core").SourceLocationSource): import("@traqula/core").SourceLocationNodeReplace;
57
59
  sourceLocationNodeReplace(start: number, end: number): import("@traqula/core").SourceLocationNodeReplace;
58
60
  isSourceLocationNodeReplace(loc: object): loc is import("@traqula/core").SourceLocationNodeReplace;
59
61
  isSourceLocationNodeAutoGenerate(loc: object): loc is import("@traqula/core").SourceLocationNodeAutoGenerate;
60
- nodeShouldPrint(node: import("@traqula/core").Localized): boolean;
62
+ isPrintingLoc(loc: SourceLocation): boolean;
61
63
  printFilter(node: import("@traqula/core").Localized, callback: () => void): void;
62
64
  isSourceLocationNoMaterialize(loc: object): loc is import("@traqula/core").SourceLocationNoMaterialize;
63
65
  isOfType<Type extends string>(obj: object, type: Type): obj is Typed<Type>;
@@ -92,27 +94,29 @@ declare const AstFactory_base: {
92
94
  isTermNamedPrefixed(obj: object): obj is SubTyped<"term", "namedNode"> & {
93
95
  prefix: string;
94
96
  };
97
+ tracksSourceLocation: boolean;
95
98
  wrap<T>(val: T, loc: SourceLocation): import("@traqula/core").Wrap<T>;
96
99
  isLocalized(obj: unknown): obj is import("@traqula/core").Localized;
97
100
  sourceLocation(...elements: (undefined | import("chevrotain").IToken | import("@traqula/core").Localized)[]): SourceLocation;
98
- sourceLocationNoMaterialize(): import("@traqula/core").SourceLocationNoMaterialize;
99
- dematerialized<T extends import("@traqula/core").Node>(arg: T): T & {
100
- loc: import("@traqula/core").SourceLocationNoMaterialize;
101
- };
101
+ sourceLocationNoMaterialize(): SourceLocation;
102
+ dematerialized<T extends import("@traqula/core").Node>(arg: T): T;
102
103
  safeObjectTransform(value: unknown, mapper: (some: object) => any): any;
103
104
  forcedAutoGenTree<T extends object>(obj: T): T;
104
105
  forceMaterialized<T extends import("@traqula/core").Node>(arg: T): T;
105
106
  isSourceLocation(loc: object): loc is SourceLocation;
106
107
  sourceLocationSource(start: number, end: number): import("@traqula/core").SourceLocationSource;
108
+ sourceLocationInlinedSource(newSource: string, subLoc: SourceLocation, start: number, end: number, startOnNew?: number, endOnNew?: number): SourceLocation;
109
+ isSourceLocationInlinedSource(loc: object): loc is import("@traqula/core").SourceLocationInlinedSource;
107
110
  gen(): import("@traqula/core").SourceLocationNodeAutoGenerate;
108
111
  isSourceLocationSource(loc: object): loc is import("@traqula/core").SourceLocationSource;
112
+ sourceLocationStringReplace(newSource: string, start: number, end: number): SourceLocation;
109
113
  isSourceLocationStringReplace(loc: object): loc is import("@traqula/core").SourceLocationStringReplace;
110
114
  sourceLocationNodeReplaceUnsafe(loc: SourceLocation): import("@traqula/core").SourceLocationNodeReplace;
111
115
  sourceLocationNodeReplace(location: import("@traqula/core").SourceLocationSource): import("@traqula/core").SourceLocationNodeReplace;
112
116
  sourceLocationNodeReplace(start: number, end: number): import("@traqula/core").SourceLocationNodeReplace;
113
117
  isSourceLocationNodeReplace(loc: object): loc is import("@traqula/core").SourceLocationNodeReplace;
114
118
  isSourceLocationNodeAutoGenerate(loc: object): loc is import("@traqula/core").SourceLocationNodeAutoGenerate;
115
- nodeShouldPrint(node: import("@traqula/core").Localized): boolean;
119
+ isPrintingLoc(loc: SourceLocation): boolean;
116
120
  printFilter(node: import("@traqula/core").Localized, callback: () => void): void;
117
121
  isSourceLocationNoMaterialize(loc: object): loc is import("@traqula/core").SourceLocationNoMaterialize;
118
122
  isOfType<Type extends string>(obj: object, type: Type): obj is Typed<Type>;
@@ -129,27 +133,29 @@ declare const AstFactory_base: {
129
133
  isSolutionModifierLimitOffset(obj: object): obj is SubTyped<"solutionModifier", "limitOffset">;
130
134
  solutionModifierGroup(groupings: (import("./Sparql11types.js").Expression | import("./Sparql11types.js").SolutionModifierGroupBind)[], loc: SourceLocation): import("./Sparql11types.js").SolutionModifierGroup;
131
135
  isSolutionModifierGroup(obj: object): obj is SubTyped<"solutionModifier", "group">;
136
+ tracksSourceLocation: boolean;
132
137
  wrap<T>(val: T, loc: SourceLocation): import("@traqula/core").Wrap<T>;
133
138
  isLocalized(obj: unknown): obj is import("@traqula/core").Localized;
134
139
  sourceLocation(...elements: (undefined | import("chevrotain").IToken | import("@traqula/core").Localized)[]): SourceLocation;
135
- sourceLocationNoMaterialize(): import("@traqula/core").SourceLocationNoMaterialize;
136
- dematerialized<T extends import("@traqula/core").Node>(arg: T): T & {
137
- loc: import("@traqula/core").SourceLocationNoMaterialize;
138
- };
140
+ sourceLocationNoMaterialize(): SourceLocation;
141
+ dematerialized<T extends import("@traqula/core").Node>(arg: T): T;
139
142
  safeObjectTransform(value: unknown, mapper: (some: object) => any): any;
140
143
  forcedAutoGenTree<T extends object>(obj: T): T;
141
144
  forceMaterialized<T extends import("@traqula/core").Node>(arg: T): T;
142
145
  isSourceLocation(loc: object): loc is SourceLocation;
143
146
  sourceLocationSource(start: number, end: number): import("@traqula/core").SourceLocationSource;
147
+ sourceLocationInlinedSource(newSource: string, subLoc: SourceLocation, start: number, end: number, startOnNew?: number, endOnNew?: number): SourceLocation;
148
+ isSourceLocationInlinedSource(loc: object): loc is import("@traqula/core").SourceLocationInlinedSource;
144
149
  gen(): import("@traqula/core").SourceLocationNodeAutoGenerate;
145
150
  isSourceLocationSource(loc: object): loc is import("@traqula/core").SourceLocationSource;
151
+ sourceLocationStringReplace(newSource: string, start: number, end: number): SourceLocation;
146
152
  isSourceLocationStringReplace(loc: object): loc is import("@traqula/core").SourceLocationStringReplace;
147
153
  sourceLocationNodeReplaceUnsafe(loc: SourceLocation): import("@traqula/core").SourceLocationNodeReplace;
148
154
  sourceLocationNodeReplace(location: import("@traqula/core").SourceLocationSource): import("@traqula/core").SourceLocationNodeReplace;
149
155
  sourceLocationNodeReplace(start: number, end: number): import("@traqula/core").SourceLocationNodeReplace;
150
156
  isSourceLocationNodeReplace(loc: object): loc is import("@traqula/core").SourceLocationNodeReplace;
151
157
  isSourceLocationNodeAutoGenerate(loc: object): loc is import("@traqula/core").SourceLocationNodeAutoGenerate;
152
- nodeShouldPrint(node: import("@traqula/core").Localized): boolean;
158
+ isPrintingLoc(loc: SourceLocation): boolean;
153
159
  printFilter(node: import("@traqula/core").Localized, callback: () => void): void;
154
160
  isSourceLocationNoMaterialize(loc: object): loc is import("@traqula/core").SourceLocationNoMaterialize;
155
161
  isOfType<Type extends string>(obj: object, type: Type): obj is Typed<Type>;
@@ -164,27 +170,29 @@ declare const AstFactory_base: {
164
170
  isQueryDescribe(obj: object): obj is SubTyped<"query", "describe">;
165
171
  isQueryAsk(obj: object): obj is SubTyped<"query", "ask">;
166
172
  querySelect(arg: Omit<import("./Sparql11types.js").QuerySelect, "type" | "subType" | "loc">, loc: SourceLocation): import("./Sparql11types.js").QuerySelect;
173
+ tracksSourceLocation: boolean;
167
174
  wrap<T>(val: T, loc: SourceLocation): import("@traqula/core").Wrap<T>;
168
175
  isLocalized(obj: unknown): obj is import("@traqula/core").Localized;
169
176
  sourceLocation(...elements: (undefined | import("chevrotain").IToken | import("@traqula/core").Localized)[]): SourceLocation;
170
- sourceLocationNoMaterialize(): import("@traqula/core").SourceLocationNoMaterialize;
171
- dematerialized<T extends import("@traqula/core").Node>(arg: T): T & {
172
- loc: import("@traqula/core").SourceLocationNoMaterialize;
173
- };
177
+ sourceLocationNoMaterialize(): SourceLocation;
178
+ dematerialized<T extends import("@traqula/core").Node>(arg: T): T;
174
179
  safeObjectTransform(value: unknown, mapper: (some: object) => any): any;
175
180
  forcedAutoGenTree<T extends object>(obj: T): T;
176
181
  forceMaterialized<T extends import("@traqula/core").Node>(arg: T): T;
177
182
  isSourceLocation(loc: object): loc is SourceLocation;
178
183
  sourceLocationSource(start: number, end: number): import("@traqula/core").SourceLocationSource;
184
+ sourceLocationInlinedSource(newSource: string, subLoc: SourceLocation, start: number, end: number, startOnNew?: number, endOnNew?: number): SourceLocation;
185
+ isSourceLocationInlinedSource(loc: object): loc is import("@traqula/core").SourceLocationInlinedSource;
179
186
  gen(): import("@traqula/core").SourceLocationNodeAutoGenerate;
180
187
  isSourceLocationSource(loc: object): loc is import("@traqula/core").SourceLocationSource;
188
+ sourceLocationStringReplace(newSource: string, start: number, end: number): SourceLocation;
181
189
  isSourceLocationStringReplace(loc: object): loc is import("@traqula/core").SourceLocationStringReplace;
182
190
  sourceLocationNodeReplaceUnsafe(loc: SourceLocation): import("@traqula/core").SourceLocationNodeReplace;
183
191
  sourceLocationNodeReplace(location: import("@traqula/core").SourceLocationSource): import("@traqula/core").SourceLocationNodeReplace;
184
192
  sourceLocationNodeReplace(start: number, end: number): import("@traqula/core").SourceLocationNodeReplace;
185
193
  isSourceLocationNodeReplace(loc: object): loc is import("@traqula/core").SourceLocationNodeReplace;
186
194
  isSourceLocationNodeAutoGenerate(loc: object): loc is import("@traqula/core").SourceLocationNodeAutoGenerate;
187
- nodeShouldPrint(node: import("@traqula/core").Localized): boolean;
195
+ isPrintingLoc(loc: SourceLocation): boolean;
188
196
  printFilter(node: import("@traqula/core").Localized, callback: () => void): void;
189
197
  isSourceLocationNoMaterialize(loc: object): loc is import("@traqula/core").SourceLocationNoMaterialize;
190
198
  isOfType<Type extends string>(obj: object, type: Type): obj is Typed<Type>;
@@ -213,27 +221,29 @@ declare const AstFactory_base: {
213
221
  isPatternMinus(obj: object): obj is SubTyped<"pattern", "minus">;
214
222
  patternService(name: TermIri | TermVariable, patterns: import("./Sparql11types.js").Pattern[], silent: boolean, loc: SourceLocation): import("./Sparql11types.js").PatternService;
215
223
  isPatternService(obj: object): obj is SubTyped<"pattern", "service">;
224
+ tracksSourceLocation: boolean;
216
225
  wrap<T>(val: T, loc: SourceLocation): import("@traqula/core").Wrap<T>;
217
226
  isLocalized(obj: unknown): obj is import("@traqula/core").Localized;
218
227
  sourceLocation(...elements: (undefined | import("chevrotain").IToken | import("@traqula/core").Localized)[]): SourceLocation;
219
- sourceLocationNoMaterialize(): import("@traqula/core").SourceLocationNoMaterialize;
220
- dematerialized<T extends import("@traqula/core").Node>(arg: T): T & {
221
- loc: import("@traqula/core").SourceLocationNoMaterialize;
222
- };
228
+ sourceLocationNoMaterialize(): SourceLocation;
229
+ dematerialized<T extends import("@traqula/core").Node>(arg: T): T;
223
230
  safeObjectTransform(value: unknown, mapper: (some: object) => any): any;
224
231
  forcedAutoGenTree<T extends object>(obj: T): T;
225
232
  forceMaterialized<T extends import("@traqula/core").Node>(arg: T): T;
226
233
  isSourceLocation(loc: object): loc is SourceLocation;
227
234
  sourceLocationSource(start: number, end: number): import("@traqula/core").SourceLocationSource;
235
+ sourceLocationInlinedSource(newSource: string, subLoc: SourceLocation, start: number, end: number, startOnNew?: number, endOnNew?: number): SourceLocation;
236
+ isSourceLocationInlinedSource(loc: object): loc is import("@traqula/core").SourceLocationInlinedSource;
228
237
  gen(): import("@traqula/core").SourceLocationNodeAutoGenerate;
229
238
  isSourceLocationSource(loc: object): loc is import("@traqula/core").SourceLocationSource;
239
+ sourceLocationStringReplace(newSource: string, start: number, end: number): SourceLocation;
230
240
  isSourceLocationStringReplace(loc: object): loc is import("@traqula/core").SourceLocationStringReplace;
231
241
  sourceLocationNodeReplaceUnsafe(loc: SourceLocation): import("@traqula/core").SourceLocationNodeReplace;
232
242
  sourceLocationNodeReplace(location: import("@traqula/core").SourceLocationSource): import("@traqula/core").SourceLocationNodeReplace;
233
243
  sourceLocationNodeReplace(start: number, end: number): import("@traqula/core").SourceLocationNodeReplace;
234
244
  isSourceLocationNodeReplace(loc: object): loc is import("@traqula/core").SourceLocationNodeReplace;
235
245
  isSourceLocationNodeAutoGenerate(loc: object): loc is import("@traqula/core").SourceLocationNodeAutoGenerate;
236
- nodeShouldPrint(node: import("@traqula/core").Localized): boolean;
246
+ isPrintingLoc(loc: SourceLocation): boolean;
237
247
  printFilter(node: import("@traqula/core").Localized, callback: () => void): void;
238
248
  isSourceLocationNoMaterialize(loc: object): loc is import("@traqula/core").SourceLocationNoMaterialize;
239
249
  isOfType<Type extends string>(obj: object, type: Type): obj is Typed<Type>;
@@ -259,27 +269,29 @@ declare const AstFactory_base: {
259
269
  items: [SubTyped<"term", "namedNode">];
260
270
  }))[];
261
271
  };
272
+ tracksSourceLocation: boolean;
262
273
  wrap<T>(val: T, loc: SourceLocation): import("@traqula/core").Wrap<T>;
263
274
  isLocalized(obj: unknown): obj is import("@traqula/core").Localized;
264
275
  sourceLocation(...elements: (undefined | import("chevrotain").IToken | import("@traqula/core").Localized)[]): SourceLocation;
265
- sourceLocationNoMaterialize(): import("@traqula/core").SourceLocationNoMaterialize;
266
- dematerialized<T extends import("@traqula/core").Node>(arg: T): T & {
267
- loc: import("@traqula/core").SourceLocationNoMaterialize;
268
- };
276
+ sourceLocationNoMaterialize(): SourceLocation;
277
+ dematerialized<T extends import("@traqula/core").Node>(arg: T): T;
269
278
  safeObjectTransform(value: unknown, mapper: (some: object) => any): any;
270
279
  forcedAutoGenTree<T extends object>(obj: T): T;
271
280
  forceMaterialized<T extends import("@traqula/core").Node>(arg: T): T;
272
281
  isSourceLocation(loc: object): loc is SourceLocation;
273
282
  sourceLocationSource(start: number, end: number): import("@traqula/core").SourceLocationSource;
283
+ sourceLocationInlinedSource(newSource: string, subLoc: SourceLocation, start: number, end: number, startOnNew?: number, endOnNew?: number): SourceLocation;
284
+ isSourceLocationInlinedSource(loc: object): loc is import("@traqula/core").SourceLocationInlinedSource;
274
285
  gen(): import("@traqula/core").SourceLocationNodeAutoGenerate;
275
286
  isSourceLocationSource(loc: object): loc is import("@traqula/core").SourceLocationSource;
287
+ sourceLocationStringReplace(newSource: string, start: number, end: number): SourceLocation;
276
288
  isSourceLocationStringReplace(loc: object): loc is import("@traqula/core").SourceLocationStringReplace;
277
289
  sourceLocationNodeReplaceUnsafe(loc: SourceLocation): import("@traqula/core").SourceLocationNodeReplace;
278
290
  sourceLocationNodeReplace(location: import("@traqula/core").SourceLocationSource): import("@traqula/core").SourceLocationNodeReplace;
279
291
  sourceLocationNodeReplace(start: number, end: number): import("@traqula/core").SourceLocationNodeReplace;
280
292
  isSourceLocationNodeReplace(loc: object): loc is import("@traqula/core").SourceLocationNodeReplace;
281
293
  isSourceLocationNodeAutoGenerate(loc: object): loc is import("@traqula/core").SourceLocationNodeAutoGenerate;
282
- nodeShouldPrint(node: import("@traqula/core").Localized): boolean;
294
+ isPrintingLoc(loc: SourceLocation): boolean;
283
295
  printFilter(node: import("@traqula/core").Localized, callback: () => void): void;
284
296
  isSourceLocationNoMaterialize(loc: object): loc is import("@traqula/core").SourceLocationNoMaterialize;
285
297
  isOfType<Type extends string>(obj: object, type: Type): obj is Typed<Type>;
@@ -296,27 +308,29 @@ declare const AstFactory_base: {
296
308
  isGraphRefAll(graphRef: object): graphRef is SubTyped<"graphRef", "all">;
297
309
  graphRefSpecific(graph: TermIri, loc: SourceLocation): import("./Sparql11types.js").GraphRefSpecific;
298
310
  isGraphRefSpecific(graphRef: object): graphRef is SubTyped<"graphRef", "specific">;
311
+ tracksSourceLocation: boolean;
299
312
  wrap<T>(val: T, loc: SourceLocation): import("@traqula/core").Wrap<T>;
300
313
  isLocalized(obj: unknown): obj is import("@traqula/core").Localized;
301
314
  sourceLocation(...elements: (undefined | import("chevrotain").IToken | import("@traqula/core").Localized)[]): SourceLocation;
302
- sourceLocationNoMaterialize(): import("@traqula/core").SourceLocationNoMaterialize;
303
- dematerialized<T extends import("@traqula/core").Node>(arg: T): T & {
304
- loc: import("@traqula/core").SourceLocationNoMaterialize;
305
- };
315
+ sourceLocationNoMaterialize(): SourceLocation;
316
+ dematerialized<T extends import("@traqula/core").Node>(arg: T): T;
306
317
  safeObjectTransform(value: unknown, mapper: (some: object) => any): any;
307
318
  forcedAutoGenTree<T extends object>(obj: T): T;
308
319
  forceMaterialized<T extends import("@traqula/core").Node>(arg: T): T;
309
320
  isSourceLocation(loc: object): loc is SourceLocation;
310
321
  sourceLocationSource(start: number, end: number): import("@traqula/core").SourceLocationSource;
322
+ sourceLocationInlinedSource(newSource: string, subLoc: SourceLocation, start: number, end: number, startOnNew?: number, endOnNew?: number): SourceLocation;
323
+ isSourceLocationInlinedSource(loc: object): loc is import("@traqula/core").SourceLocationInlinedSource;
311
324
  gen(): import("@traqula/core").SourceLocationNodeAutoGenerate;
312
325
  isSourceLocationSource(loc: object): loc is import("@traqula/core").SourceLocationSource;
326
+ sourceLocationStringReplace(newSource: string, start: number, end: number): SourceLocation;
313
327
  isSourceLocationStringReplace(loc: object): loc is import("@traqula/core").SourceLocationStringReplace;
314
328
  sourceLocationNodeReplaceUnsafe(loc: SourceLocation): import("@traqula/core").SourceLocationNodeReplace;
315
329
  sourceLocationNodeReplace(location: import("@traqula/core").SourceLocationSource): import("@traqula/core").SourceLocationNodeReplace;
316
330
  sourceLocationNodeReplace(start: number, end: number): import("@traqula/core").SourceLocationNodeReplace;
317
331
  isSourceLocationNodeReplace(loc: object): loc is import("@traqula/core").SourceLocationNodeReplace;
318
332
  isSourceLocationNodeAutoGenerate(loc: object): loc is import("@traqula/core").SourceLocationNodeAutoGenerate;
319
- nodeShouldPrint(node: import("@traqula/core").Localized): boolean;
333
+ isPrintingLoc(loc: SourceLocation): boolean;
320
334
  printFilter(node: import("@traqula/core").Localized, callback: () => void): void;
321
335
  isSourceLocationNoMaterialize(loc: object): loc is import("@traqula/core").SourceLocationNoMaterialize;
322
336
  isOfType<Type extends string>(obj: object, type: Type): obj is Typed<Type>;
@@ -365,27 +379,29 @@ declare const AstFactory_base: {
365
379
  isExpressionAggregateDefault(obj: object): obj is SubTyped<"expression", "aggregate"> & {
366
380
  expression: [import("./Sparql11types.js").Expression];
367
381
  };
382
+ tracksSourceLocation: boolean;
368
383
  wrap<T>(val: T, loc: SourceLocation): import("@traqula/core").Wrap<T>;
369
384
  isLocalized(obj: unknown): obj is import("@traqula/core").Localized;
370
385
  sourceLocation(...elements: (undefined | import("chevrotain").IToken | import("@traqula/core").Localized)[]): SourceLocation;
371
- sourceLocationNoMaterialize(): import("@traqula/core").SourceLocationNoMaterialize;
372
- dematerialized<T extends import("@traqula/core").Node>(arg: T): T & {
373
- loc: import("@traqula/core").SourceLocationNoMaterialize;
374
- };
386
+ sourceLocationNoMaterialize(): SourceLocation;
387
+ dematerialized<T extends import("@traqula/core").Node>(arg: T): T;
375
388
  safeObjectTransform(value: unknown, mapper: (some: object) => any): any;
376
389
  forcedAutoGenTree<T extends object>(obj: T): T;
377
390
  forceMaterialized<T extends import("@traqula/core").Node>(arg: T): T;
378
391
  isSourceLocation(loc: object): loc is SourceLocation;
379
392
  sourceLocationSource(start: number, end: number): import("@traqula/core").SourceLocationSource;
393
+ sourceLocationInlinedSource(newSource: string, subLoc: SourceLocation, start: number, end: number, startOnNew?: number, endOnNew?: number): SourceLocation;
394
+ isSourceLocationInlinedSource(loc: object): loc is import("@traqula/core").SourceLocationInlinedSource;
380
395
  gen(): import("@traqula/core").SourceLocationNodeAutoGenerate;
381
396
  isSourceLocationSource(loc: object): loc is import("@traqula/core").SourceLocationSource;
397
+ sourceLocationStringReplace(newSource: string, start: number, end: number): SourceLocation;
382
398
  isSourceLocationStringReplace(loc: object): loc is import("@traqula/core").SourceLocationStringReplace;
383
399
  sourceLocationNodeReplaceUnsafe(loc: SourceLocation): import("@traqula/core").SourceLocationNodeReplace;
384
400
  sourceLocationNodeReplace(location: import("@traqula/core").SourceLocationSource): import("@traqula/core").SourceLocationNodeReplace;
385
401
  sourceLocationNodeReplace(start: number, end: number): import("@traqula/core").SourceLocationNodeReplace;
386
402
  isSourceLocationNodeReplace(loc: object): loc is import("@traqula/core").SourceLocationNodeReplace;
387
403
  isSourceLocationNodeAutoGenerate(loc: object): loc is import("@traqula/core").SourceLocationNodeAutoGenerate;
388
- nodeShouldPrint(node: import("@traqula/core").Localized): boolean;
404
+ isPrintingLoc(loc: SourceLocation): boolean;
389
405
  printFilter(node: import("@traqula/core").Localized, callback: () => void): void;
390
406
  isSourceLocationNoMaterialize(loc: object): loc is import("@traqula/core").SourceLocationNoMaterialize;
391
407
  isOfType<Type extends string>(obj: object, type: Type): obj is Typed<Type>;
@@ -397,33 +413,38 @@ declare const AstFactory_base: {
397
413
  isContextDefinitionPrefix(contextDef: object): contextDef is SubTyped<"contextDef", "prefix">;
398
414
  contextDefinitionBase(loc: SourceLocation, value: import("./Sparql11types.js").TermIriFull): import("./Sparql11types.js").ContextDefinitionBase;
399
415
  isContextDefinitionBase(contextDef: object): contextDef is SubTyped<"contextDef", "base">;
416
+ tracksSourceLocation: boolean;
400
417
  wrap<T>(val: T, loc: SourceLocation): import("@traqula/core").Wrap<T>;
401
418
  isLocalized(obj: unknown): obj is import("@traqula/core").Localized;
402
419
  sourceLocation(...elements: (undefined | import("chevrotain").IToken | import("@traqula/core").Localized)[]): SourceLocation;
403
- sourceLocationNoMaterialize(): import("@traqula/core").SourceLocationNoMaterialize;
404
- dematerialized<T extends import("@traqula/core").Node>(arg: T): T & {
405
- loc: import("@traqula/core").SourceLocationNoMaterialize;
406
- };
420
+ sourceLocationNoMaterialize(): SourceLocation;
421
+ dematerialized<T extends import("@traqula/core").Node>(arg: T): T;
407
422
  safeObjectTransform(value: unknown, mapper: (some: object) => any): any;
408
423
  forcedAutoGenTree<T extends object>(obj: T): T;
409
424
  forceMaterialized<T extends import("@traqula/core").Node>(arg: T): T;
410
425
  isSourceLocation(loc: object): loc is SourceLocation;
411
426
  sourceLocationSource(start: number, end: number): import("@traqula/core").SourceLocationSource;
427
+ sourceLocationInlinedSource(newSource: string, subLoc: SourceLocation, start: number, end: number, startOnNew?: number, endOnNew?: number): SourceLocation;
428
+ isSourceLocationInlinedSource(loc: object): loc is import("@traqula/core").SourceLocationInlinedSource;
412
429
  gen(): import("@traqula/core").SourceLocationNodeAutoGenerate;
413
430
  isSourceLocationSource(loc: object): loc is import("@traqula/core").SourceLocationSource;
431
+ sourceLocationStringReplace(newSource: string, start: number, end: number): SourceLocation;
414
432
  isSourceLocationStringReplace(loc: object): loc is import("@traqula/core").SourceLocationStringReplace;
415
433
  sourceLocationNodeReplaceUnsafe(loc: SourceLocation): import("@traqula/core").SourceLocationNodeReplace;
416
434
  sourceLocationNodeReplace(location: import("@traqula/core").SourceLocationSource): import("@traqula/core").SourceLocationNodeReplace;
417
435
  sourceLocationNodeReplace(start: number, end: number): import("@traqula/core").SourceLocationNodeReplace;
418
436
  isSourceLocationNodeReplace(loc: object): loc is import("@traqula/core").SourceLocationNodeReplace;
419
437
  isSourceLocationNodeAutoGenerate(loc: object): loc is import("@traqula/core").SourceLocationNodeAutoGenerate;
420
- nodeShouldPrint(node: import("@traqula/core").Localized): boolean;
438
+ isPrintingLoc(loc: SourceLocation): boolean;
421
439
  printFilter(node: import("@traqula/core").Localized, callback: () => void): void;
422
440
  isSourceLocationNoMaterialize(loc: object): loc is import("@traqula/core").SourceLocationNoMaterialize;
423
441
  isOfType<Type extends string>(obj: object, type: Type): obj is Typed<Type>;
424
442
  isOfSubType<Type extends string, SubType extends string>(obj: object, type: Type, subType: SubType): obj is SubTyped<Type, SubType>;
425
443
  };
426
444
  } & typeof AstCoreFactory;
445
+ /**
446
+ * A factory that helps you create, and check types for AST nodes for SPARQL 1.1
447
+ */
427
448
  export declare class AstFactory extends AstFactory_base {
428
449
  alwaysSparql11(obj: object): obj is Sparql11Nodes;
429
450
  isPath(obj: object): obj is SubTyped<'term', 'namedNode'> | Typed<'path'>;
@@ -9,6 +9,9 @@ import { QueryFactoryMixin } from './factoryMixins/QueryFactory.js';
9
9
  import { SolutionModifiersFactoryMixin } from './factoryMixins/SolutionModifiersFactory.js';
10
10
  import { TermFactoryMixin } from './factoryMixins/TermFactory.js';
11
11
  import { UpdateOperationFactoryMixin } from './factoryMixins/UpdateOperationFactory.js';
12
+ /**
13
+ * A factory that helps you create, and check types for AST nodes for SPARQL 1.1
14
+ */
12
15
  export class AstFactory extends asArg(AstCoreFactory)
13
16
  .call(ContextFactoryMixin)
14
17
  .call(ExpressionFactoryMixin)
@@ -1 +1 @@
1
- {"version":3,"file":"astFactory.js","sourceRoot":"","sources":["../../../lib/astFactory.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AAC9E,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,6BAA6B,EAAE,MAAM,6CAA6C,CAAC;AAC5F,OAAO,EAAE,gBAAgB,EA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AAkB,EAAE,MAAM,CAAC,CAAC;IAC3D,CAAC;IAEM,UAAU,CAAC,KAA6B,EAAE,OAAmB,EAAE,GAAmB;QACvF,OAAO;YACL,IAAI,EAAE,OAAO;YACb,KAAK;YACL,OAAO;YACP,GAAG;SACJ,CAAC;IACJ,CAAC;IAEM,YAAY,CAAC,GAAW;QAC7B,OAAO,KAAK,CAAC,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IACtC,CAAC;IAEM,QAAQ,CAAC,GAAW;QACzB,OAAO,KAAK,CAAC,QAAQ,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;IACvC,CAAC;CACF","sourcesContent":["import type { SourceLocation, SubTyped, Typed } from '@traqula/core';\nimport { AstCoreFactory } from '@traqula/core';\nimport { ContextFactoryMixin } from './factoryMixins/ContextFactory.js';\nimport { ExpressionFactoryMixin } from './factoryMixins/ExpressionFactory.js';\nimport { GraphRefFactoryMixin } from './factoryMixins/GraphRefFactory.js';\nimport { asArg } from './factoryMixins/mixins.js';\nimport { PathFactoryMixin } from './factoryMixins/PathFactory.js';\nimport { PatternFactoryMixin } from './factoryMixins/Patternfactory.js';\nimport { QueryFactoryMixin } from './factoryMixins/QueryFactory.js';\nimport { SolutionModifiersFactoryMixin } from './factoryMixins/SolutionModifiersFactory.js';\nimport { TermFactoryMixin } from './factoryMixins/TermFactory.js';\nimport { UpdateOperationFactoryMixin } from './factoryMixins/UpdateOperationFactory.js';\nimport type {\n DatasetClauses,\n GraphNode,\n GraphQuads,\n PatternBgp,\n Sparql11Nodes,\n Term,\n TermBlank,\n TermIri,\n TermVariable,\n TripleCollectionBlankNodeProperties,\n TripleCollectionList,\n TripleNesting,\n Update,\n Wildcard,\n} from './Sparql11types.js';\n\nexport class AstFactory extends asArg(AstCoreFactory)\n .call(ContextFactoryMixin)\n .call(ExpressionFactoryMixin)\n .call(GraphRefFactoryMixin)\n .call(PathFactoryMixin)\n .call(PatternFactoryMixin)\n .call(QueryFactoryMixin)\n .call(SolutionModifiersFactoryMixin)\n .call(TermFactoryMixin)\n .call(UpdateOperationFactoryMixin)\n .returns() {\n public alwaysSparql11(obj: object): obj is Sparql11Nodes {\n return true;\n }\n\n public isPath(obj: object): obj is SubTyped<'term', 'namedNode'> | Typed<'path'> {\n return this.isPathPure(obj) || this.isTermNamed(obj);\n }\n\n public isExpression(obj: object):\n obj is SubTyped<'term', 'namedNode' | 'variable' | 'literal'> | Typed<'expression'> {\n return this.isExpressionPure(obj) || this.isTermNamed(obj) || this.isTermVariable(obj) || this.isTermLiteral(obj);\n }\n\n public graphNodeIdentifier(graphNode: GraphNode): Term {\n return graphNode.type === 'tripleCollection' ? graphNode.identifier : graphNode;\n }\n\n public triple(\n subject: TripleNesting['subject'],\n predicate: TripleNesting['predicate'],\n object: TripleNesting['object'],\n loc?: SourceLocation,\n ): TripleNesting {\n return {\n type: 'triple',\n subject,\n predicate,\n object,\n loc: loc ?? this.sourceLocation(subject, predicate, object),\n };\n }\n\n public isTriple(obj: object): obj is Typed<'triple'> {\n return this.isOfType(obj, 'triple');\n }\n\n public datasetClauses(clauses: DatasetClauses['clauses'], loc: SourceLocation): DatasetClauses {\n return {\n type: 'datasetClauses',\n clauses,\n loc,\n };\n }\n\n public isDatasetClauses(obj: object): obj is Typed<'datasetClauses'> {\n return this.isOfType(obj, 'datasetClauses');\n }\n\n public wildcard(loc: SourceLocation): Wildcard {\n return { type: 'wildcard', loc };\n }\n\n public isWildcard(obj: object): obj is Typed<'wildcard'> {\n return this.isOfType(obj, 'wildcard');\n }\n\n public isTripleCollection(obj: object): obj is Typed<'tripleCollection'> {\n return this.isOfType(obj, 'tripleCollection');\n }\n\n public tripleCollectionBlankNodeProperties(\n identifier: TermBlank,\n triples: TripleNesting[],\n loc: SourceLocation,\n ): TripleCollectionBlankNodeProperties {\n return {\n type: 'tripleCollection',\n subType: 'blankNodeProperties',\n identifier,\n triples,\n loc,\n };\n }\n\n public isTripleCollectionBlankNodeProperties(obj: object):\n obj is SubTyped<'tripleCollection', 'blankNodeProperties'> {\n return this.isOfSubType(obj, 'tripleCollection', 'blankNodeProperties');\n }\n\n public tripleCollectionList(\n identifier: TermBlank,\n triples: TripleNesting[],\n loc: SourceLocation,\n ): TripleCollectionList {\n return {\n type: 'tripleCollection',\n subType: 'list',\n identifier,\n triples,\n loc,\n };\n }\n\n public isTripleCollectionList(obj: object):\n obj is SubTyped<'tripleCollection', 'list'> {\n return this.isOfSubType(obj, 'tripleCollection', 'list');\n }\n\n public graphQuads(graph: TermIri | TermVariable, triples: PatternBgp, loc: SourceLocation): GraphQuads {\n return {\n type: 'graph',\n graph,\n triples,\n loc,\n };\n }\n\n public isGraphQuads(obj: object): obj is GraphQuads {\n return super.isOfType(obj, 'graph');\n }\n\n public isUpdate(obj: object): obj is Update {\n return super.isOfType(obj, 'update');\n }\n}\n"]}
1
+ {"version":3,"file":"astFactory.js","sourceRoot":"","sources":["../../../lib/astFactory.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AAC9E,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,6BAA6B,EAAE,MAAM,6CAA6C,CAAC;AAC5F,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,2BAA2B,EAAE,MAAM,2CAA2C,CAAC;AAkBxF;;GAEG;AACH,MAAM,OAAO,UAAW,SAAQ,KAAK,CAAC,cA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AAO;YACb,KAAK;YACL,OAAO;YACP,GAAG;SACJ,CAAC;IACJ,CAAC;IAEM,YAAY,CAAC,GAAW;QAC7B,OAAO,KAAK,CAAC,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IACtC,CAAC;IAEM,QAAQ,CAAC,GAAW;QACzB,OAAO,KAAK,CAAC,QAAQ,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;IACvC,CAAC;CACF","sourcesContent":["import type { SourceLocation, SubTyped, Typed } from '@traqula/core';\nimport { AstCoreFactory } from '@traqula/core';\nimport { ContextFactoryMixin } from './factoryMixins/ContextFactory.js';\nimport { ExpressionFactoryMixin } from './factoryMixins/ExpressionFactory.js';\nimport { GraphRefFactoryMixin } from './factoryMixins/GraphRefFactory.js';\nimport { asArg } from './factoryMixins/mixins.js';\nimport { PathFactoryMixin } from './factoryMixins/PathFactory.js';\nimport { PatternFactoryMixin } from './factoryMixins/Patternfactory.js';\nimport { QueryFactoryMixin } from './factoryMixins/QueryFactory.js';\nimport { SolutionModifiersFactoryMixin } from './factoryMixins/SolutionModifiersFactory.js';\nimport { TermFactoryMixin } from './factoryMixins/TermFactory.js';\nimport { UpdateOperationFactoryMixin } from './factoryMixins/UpdateOperationFactory.js';\nimport type {\n DatasetClauses,\n GraphNode,\n GraphQuads,\n PatternBgp,\n Sparql11Nodes,\n Term,\n TermBlank,\n TermIri,\n TermVariable,\n TripleCollectionBlankNodeProperties,\n TripleCollectionList,\n TripleNesting,\n Update,\n Wildcard,\n} from './Sparql11types.js';\n\n/**\n * A factory that helps you create, and check types for AST nodes for SPARQL 1.1\n */\nexport class AstFactory extends asArg(AstCoreFactory)\n .call(ContextFactoryMixin)\n .call(ExpressionFactoryMixin)\n .call(GraphRefFactoryMixin)\n .call(PathFactoryMixin)\n .call(PatternFactoryMixin)\n .call(QueryFactoryMixin)\n .call(SolutionModifiersFactoryMixin)\n .call(TermFactoryMixin)\n .call(UpdateOperationFactoryMixin)\n .returns() {\n public alwaysSparql11(obj: object): obj is Sparql11Nodes {\n return true;\n }\n\n public isPath(obj: object): obj is SubTyped<'term', 'namedNode'> | Typed<'path'> {\n return this.isPathPure(obj) || this.isTermNamed(obj);\n }\n\n public isExpression(obj: object):\n obj is SubTyped<'term', 'namedNode' | 'variable' | 'literal'> | Typed<'expression'> {\n return this.isExpressionPure(obj) || this.isTermNamed(obj) || this.isTermVariable(obj) || this.isTermLiteral(obj);\n }\n\n public graphNodeIdentifier(graphNode: GraphNode): Term {\n return graphNode.type === 'tripleCollection' ? graphNode.identifier : graphNode;\n }\n\n public triple(\n subject: TripleNesting['subject'],\n predicate: TripleNesting['predicate'],\n object: TripleNesting['object'],\n loc?: SourceLocation,\n ): TripleNesting {\n return {\n type: 'triple',\n subject,\n predicate,\n object,\n loc: loc ?? this.sourceLocation(subject, predicate, object),\n };\n }\n\n public isTriple(obj: object): obj is Typed<'triple'> {\n return this.isOfType(obj, 'triple');\n }\n\n public datasetClauses(clauses: DatasetClauses['clauses'], loc: SourceLocation): DatasetClauses {\n return {\n type: 'datasetClauses',\n clauses,\n loc,\n };\n }\n\n public isDatasetClauses(obj: object): obj is Typed<'datasetClauses'> {\n return this.isOfType(obj, 'datasetClauses');\n }\n\n public wildcard(loc: SourceLocation): Wildcard {\n return { type: 'wildcard', loc };\n }\n\n public isWildcard(obj: object): obj is Typed<'wildcard'> {\n return this.isOfType(obj, 'wildcard');\n }\n\n public isTripleCollection(obj: object): obj is Typed<'tripleCollection'> {\n return this.isOfType(obj, 'tripleCollection');\n }\n\n public tripleCollectionBlankNodeProperties(\n identifier: TermBlank,\n triples: TripleNesting[],\n loc: SourceLocation,\n ): TripleCollectionBlankNodeProperties {\n return {\n type: 'tripleCollection',\n subType: 'blankNodeProperties',\n identifier,\n triples,\n loc,\n };\n }\n\n public isTripleCollectionBlankNodeProperties(obj: object):\n obj is SubTyped<'tripleCollection', 'blankNodeProperties'> {\n return this.isOfSubType(obj, 'tripleCollection', 'blankNodeProperties');\n }\n\n public tripleCollectionList(\n identifier: TermBlank,\n triples: TripleNesting[],\n loc: SourceLocation,\n ): TripleCollectionList {\n return {\n type: 'tripleCollection',\n subType: 'list',\n identifier,\n triples,\n loc,\n };\n }\n\n public isTripleCollectionList(obj: object):\n obj is SubTyped<'tripleCollection', 'list'> {\n return this.isOfSubType(obj, 'tripleCollection', 'list');\n }\n\n public graphQuads(graph: TermIri | TermVariable, triples: PatternBgp, loc: SourceLocation): GraphQuads {\n return {\n type: 'graph',\n graph,\n triples,\n loc,\n };\n }\n\n public isGraphQuads(obj: object): obj is GraphQuads {\n return super.isOfType(obj, 'graph');\n }\n\n public isUpdate(obj: object): obj is Update {\n return super.isOfType(obj, 'update');\n }\n}\n"]}
@@ -8,27 +8,29 @@ export declare function ContextFactoryMixin<TBase extends Constructor<AstCoreFac
8
8
  isContextDefinitionPrefix(contextDef: object): contextDef is SubTyped<NodeType, "prefix">;
9
9
  contextDefinitionBase(loc: SourceLocation, value: TermIriFull): ContextDefinitionBase;
10
10
  isContextDefinitionBase(contextDef: object): contextDef is SubTyped<NodeType, "base">;
11
+ tracksSourceLocation: boolean;
11
12
  wrap<T>(val: T, loc: SourceLocation): import("@traqula/core").Wrap<T>;
12
13
  isLocalized(obj: unknown): obj is import("@traqula/core").Localized;
13
14
  sourceLocation(...elements: (undefined | import("chevrotain").IToken | import("@traqula/core").Localized)[]): SourceLocation;
14
- sourceLocationNoMaterialize(): import("@traqula/core").SourceLocationNoMaterialize;
15
- dematerialized<T extends import("@traqula/core").Node>(arg: T): T & {
16
- loc: import("@traqula/core").SourceLocationNoMaterialize;
17
- };
15
+ sourceLocationNoMaterialize(): SourceLocation;
16
+ dematerialized<T extends import("@traqula/core").Node>(arg: T): T;
18
17
  safeObjectTransform(value: unknown, mapper: (some: object) => any): any;
19
18
  forcedAutoGenTree<T extends object>(obj: T): T;
20
19
  forceMaterialized<T extends import("@traqula/core").Node>(arg: T): T;
21
20
  isSourceLocation(loc: object): loc is SourceLocation;
22
21
  sourceLocationSource(start: number, end: number): import("@traqula/core").SourceLocationSource;
22
+ sourceLocationInlinedSource(newSource: string, subLoc: SourceLocation, start: number, end: number, startOnNew?: number, endOnNew?: number): SourceLocation;
23
+ isSourceLocationInlinedSource(loc: object): loc is import("@traqula/core").SourceLocationInlinedSource;
23
24
  gen(): import("@traqula/core").SourceLocationNodeAutoGenerate;
24
25
  isSourceLocationSource(loc: object): loc is import("@traqula/core").SourceLocationSource;
26
+ sourceLocationStringReplace(newSource: string, start: number, end: number): SourceLocation;
25
27
  isSourceLocationStringReplace(loc: object): loc is import("@traqula/core").SourceLocationStringReplace;
26
28
  sourceLocationNodeReplaceUnsafe(loc: SourceLocation): import("@traqula/core").SourceLocationNodeReplace;
27
29
  sourceLocationNodeReplace(location: import("@traqula/core").SourceLocationSource): import("@traqula/core").SourceLocationNodeReplace;
28
30
  sourceLocationNodeReplace(start: number, end: number): import("@traqula/core").SourceLocationNodeReplace;
29
31
  isSourceLocationNodeReplace(loc: object): loc is import("@traqula/core").SourceLocationNodeReplace;
30
32
  isSourceLocationNodeAutoGenerate(loc: object): loc is import("@traqula/core").SourceLocationNodeAutoGenerate;
31
- nodeShouldPrint(node: import("@traqula/core").Localized): boolean;
33
+ isPrintingLoc(loc: SourceLocation): boolean;
32
34
  printFilter(node: import("@traqula/core").Localized, callback: () => void): void;
33
35
  isSourceLocationNoMaterialize(loc: object): loc is import("@traqula/core").SourceLocationNoMaterialize;
34
36
  isOfType<Type extends string>(obj: object, type: Type): obj is import("@traqula/core").Typed<Type>;
@@ -30,27 +30,29 @@ export declare function ExpressionFactoryMixin<TBase extends Constructor<AstCore
30
30
  isExpressionAggregateDefault(obj: object): obj is SubTyped<NodeType, "aggregate"> & {
31
31
  expression: [Expression];
32
32
  };
33
+ tracksSourceLocation: boolean;
33
34
  wrap<T>(val: T, loc: SourceLocation): import("@traqula/core").Wrap<T>;
34
35
  isLocalized(obj: unknown): obj is import("@traqula/core").Localized;
35
36
  sourceLocation(...elements: (undefined | import("chevrotain").IToken | import("@traqula/core").Localized)[]): SourceLocation;
36
- sourceLocationNoMaterialize(): import("@traqula/core").SourceLocationNoMaterialize;
37
- dematerialized<T extends import("@traqula/core").Node>(arg: T): T & {
38
- loc: import("@traqula/core").SourceLocationNoMaterialize;
39
- };
37
+ sourceLocationNoMaterialize(): SourceLocation;
38
+ dematerialized<T extends import("@traqula/core").Node>(arg: T): T;
40
39
  safeObjectTransform(value: unknown, mapper: (some: object) => any): any;
41
40
  forcedAutoGenTree<T extends object>(obj: T): T;
42
41
  forceMaterialized<T extends import("@traqula/core").Node>(arg: T): T;
43
42
  isSourceLocation(loc: object): loc is SourceLocation;
44
43
  sourceLocationSource(start: number, end: number): import("@traqula/core").SourceLocationSource;
44
+ sourceLocationInlinedSource(newSource: string, subLoc: SourceLocation, start: number, end: number, startOnNew?: number, endOnNew?: number): SourceLocation;
45
+ isSourceLocationInlinedSource(loc: object): loc is import("@traqula/core").SourceLocationInlinedSource;
45
46
  gen(): import("@traqula/core").SourceLocationNodeAutoGenerate;
46
47
  isSourceLocationSource(loc: object): loc is import("@traqula/core").SourceLocationSource;
48
+ sourceLocationStringReplace(newSource: string, start: number, end: number): SourceLocation;
47
49
  isSourceLocationStringReplace(loc: object): loc is import("@traqula/core").SourceLocationStringReplace;
48
50
  sourceLocationNodeReplaceUnsafe(loc: SourceLocation): import("@traqula/core").SourceLocationNodeReplace;
49
51
  sourceLocationNodeReplace(location: import("@traqula/core").SourceLocationSource): import("@traqula/core").SourceLocationNodeReplace;
50
52
  sourceLocationNodeReplace(start: number, end: number): import("@traqula/core").SourceLocationNodeReplace;
51
53
  isSourceLocationNodeReplace(loc: object): loc is import("@traqula/core").SourceLocationNodeReplace;
52
54
  isSourceLocationNodeAutoGenerate(loc: object): loc is import("@traqula/core").SourceLocationNodeAutoGenerate;
53
- nodeShouldPrint(node: import("@traqula/core").Localized): boolean;
55
+ isPrintingLoc(loc: SourceLocation): boolean;
54
56
  printFilter(node: import("@traqula/core").Localized, callback: () => void): void;
55
57
  isSourceLocationNoMaterialize(loc: object): loc is import("@traqula/core").SourceLocationNoMaterialize;
56
58
  isOfType<Type extends string>(obj: object, type: Type): obj is Typed<Type>;