@jondotsoy/don 0.0.4 → 0.0.6

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 (99) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +0 -75
  3. package/lib/esm/don.d.ts +10 -0
  4. package/lib/esm/don.d.ts.map +1 -0
  5. package/lib/esm/don.js +27 -0
  6. package/lib/esm/don.js.map +1 -0
  7. package/lib/esm/index.d.ts +2 -2
  8. package/lib/esm/index.d.ts.map +1 -1
  9. package/lib/esm/index.js +2 -2
  10. package/lib/esm/index.js.map +1 -1
  11. package/lib/esm/v1/compiler/directive-node.d.ts +26 -0
  12. package/lib/esm/v1/compiler/directive-node.d.ts.map +1 -0
  13. package/lib/esm/v1/compiler/directive-node.js +48 -0
  14. package/lib/esm/v1/compiler/directive-node.js.map +1 -0
  15. package/lib/esm/v1/compiler/lexema-encode.d.ts +15 -0
  16. package/lib/esm/v1/compiler/lexema-encode.d.ts.map +1 -0
  17. package/lib/esm/v1/compiler/lexema-encode.js +22 -0
  18. package/lib/esm/v1/compiler/lexema-encode.js.map +1 -0
  19. package/lib/esm/v1/compiler/lexema.d.ts +10 -0
  20. package/lib/esm/v1/compiler/lexema.d.ts.map +1 -0
  21. package/lib/esm/v1/compiler/lexema.js +26 -0
  22. package/lib/esm/v1/compiler/lexema.js.map +1 -0
  23. package/lib/esm/v1/compiler/part-set-encode.d.ts +6 -0
  24. package/lib/esm/v1/compiler/part-set-encode.d.ts.map +1 -0
  25. package/lib/esm/v1/compiler/part-set-encode.js +15 -0
  26. package/lib/esm/v1/compiler/part-set-encode.js.map +1 -0
  27. package/lib/esm/v1/compiler/part-set.d.ts +6 -0
  28. package/lib/esm/v1/compiler/part-set.d.ts.map +1 -0
  29. package/lib/esm/v1/compiler/part-set.js +7 -0
  30. package/lib/esm/v1/compiler/part-set.js.map +1 -0
  31. package/lib/esm/v1/compiler/part.d.ts +31 -0
  32. package/lib/esm/v1/compiler/part.d.ts.map +1 -0
  33. package/lib/esm/v1/compiler/part.js +109 -0
  34. package/lib/esm/v1/compiler/part.js.map +1 -0
  35. package/lib/esm/v1/compiler/partial-span.d.ts +6 -0
  36. package/lib/esm/v1/compiler/partial-span.d.ts.map +1 -0
  37. package/lib/esm/v1/compiler/partial-span.js +9 -0
  38. package/lib/esm/v1/compiler/partial-span.js.map +1 -0
  39. package/lib/esm/v1/compiler/span.d.ts +9 -0
  40. package/lib/esm/v1/compiler/span.d.ts.map +1 -0
  41. package/lib/esm/v1/compiler/span.js +13 -0
  42. package/lib/esm/v1/compiler/span.js.map +1 -0
  43. package/lib/esm/v1/compiler/syntax-encode.d.ts +9 -0
  44. package/lib/esm/v1/compiler/syntax-encode.d.ts.map +1 -0
  45. package/lib/esm/v1/compiler/syntax-encode.js +160 -0
  46. package/lib/esm/v1/compiler/syntax-encode.js.map +1 -0
  47. package/lib/esm/v1/compiler/token.d.ts +59 -0
  48. package/lib/esm/v1/compiler/token.d.ts.map +1 -0
  49. package/lib/esm/v1/compiler/token.js +320 -0
  50. package/lib/esm/v1/compiler/token.js.map +1 -0
  51. package/lib/esm/v1/types/location.d.ts +6 -0
  52. package/lib/esm/v1/types/location.d.ts.map +1 -0
  53. package/lib/esm/v1/types/location.js +2 -0
  54. package/lib/esm/v1/types/location.js.map +1 -0
  55. package/lib/esm/v1/types/u8.d.ts +2 -0
  56. package/lib/esm/v1/types/u8.d.ts.map +1 -0
  57. package/lib/esm/v1/types/u8.js +2 -0
  58. package/lib/esm/v1/types/u8.js.map +1 -0
  59. package/lib/esm/v1/utils/build-logger.d.ts +11 -0
  60. package/lib/esm/v1/utils/build-logger.d.ts.map +1 -0
  61. package/lib/esm/v1/utils/build-logger.js +20 -0
  62. package/lib/esm/v1/utils/build-logger.js.map +1 -0
  63. package/lib/esm/v1/utils/charset-tools.d.ts +15 -0
  64. package/lib/esm/v1/utils/charset-tools.d.ts.map +1 -0
  65. package/lib/esm/v1/utils/charset-tools.js +37 -0
  66. package/lib/esm/v1/utils/charset-tools.js.map +1 -0
  67. package/lib/esm/v1/utils/charset.d.ts +34 -0
  68. package/lib/esm/v1/utils/charset.d.ts.map +1 -0
  69. package/lib/esm/v1/utils/charset.js +52 -0
  70. package/lib/esm/v1/utils/charset.js.map +1 -0
  71. package/lib/esm/v1/utils/parts-match.d.ts +12 -0
  72. package/lib/esm/v1/utils/parts-match.d.ts.map +1 -0
  73. package/lib/esm/v1/utils/parts-match.js +30 -0
  74. package/lib/esm/v1/utils/parts-match.js.map +1 -0
  75. package/lib/esm/v1/utils/syntax-kind.d.ts +22 -0
  76. package/lib/esm/v1/utils/syntax-kind.d.ts.map +1 -0
  77. package/lib/esm/v1/utils/syntax-kind.js +28 -0
  78. package/lib/esm/v1/utils/syntax-kind.js.map +1 -0
  79. package/lib/esm/v1/utils/take-while.d.ts +53 -0
  80. package/lib/esm/v1/utils/take-while.d.ts.map +1 -0
  81. package/lib/esm/v1/utils/take-while.js +69 -0
  82. package/lib/esm/v1/utils/take-while.js.map +1 -0
  83. package/package.json +1 -1
  84. package/lib/esm/chunk.d.ts +0 -28
  85. package/lib/esm/chunk.d.ts.map +0 -1
  86. package/lib/esm/chunk.js +0 -84
  87. package/lib/esm/chunk.js.map +0 -1
  88. package/lib/esm/document.d.ts +0 -20
  89. package/lib/esm/document.d.ts.map +0 -1
  90. package/lib/esm/document.js +0 -138
  91. package/lib/esm/document.js.map +0 -1
  92. package/lib/esm/lexer.d.ts +0 -38
  93. package/lib/esm/lexer.d.ts.map +0 -1
  94. package/lib/esm/lexer.js +0 -600
  95. package/lib/esm/lexer.js.map +0 -1
  96. package/lib/esm/utils/inspect.d.ts +0 -7
  97. package/lib/esm/utils/inspect.d.ts.map +0 -1
  98. package/lib/esm/utils/inspect.js +0 -39
  99. package/lib/esm/utils/inspect.js.map +0 -1
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Jonathan Delgado <hi@jon.soy> (https://jon.soy)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -9,78 +9,3 @@ DON is a human-readable data serialization format designed around the concept of
9
9
  - **Flexible Nesting**: Supports hierarchies of any depth
10
10
  - **Multiple Data Types**: Keywords, strings, numbers, booleans, and null
11
11
  - **Heredoc Support**: Multi-line content blocks for embedded scripts and text
12
- - **Comments**: Supports line comments (`//`, `#`) and multi-line comments (`/* */`)
13
- - **Unambiguous**: Clear parsing rules and delimitation
14
-
15
- ## Installation
16
-
17
- ### Using npm
18
-
19
- ```bash
20
- npm install @jondotsoy/don
21
- ```
22
-
23
- ### Using Bun
24
-
25
- ```bash
26
- bun add @jondotsoy/don
27
- ```
28
-
29
- ## Usage
30
-
31
- ### Basic Example
32
-
33
- ```typescript
34
- import { DocumentEncoder, LexerEncoder } from "@jondotsoy/don";
35
-
36
- // Parse a DON document
37
- const source = `
38
- name "my-app"
39
- version 1.0.0
40
- container {
41
- image "nginx"
42
- port 8080
43
- }
44
- `;
45
-
46
- const document = new DocumentEncoder();
47
- const directives = document.encode(source);
48
-
49
- console.log(directives);
50
- ```
51
-
52
- ### Using the Inspect Utility
53
-
54
- ```typescript
55
- import { DocumentEncoder, LexerEncoder } from "@jondotsoy/don";
56
- import { inspect } from "@jondotsoy/don/utils";
57
-
58
- const source = `
59
- service "web" replicas 3 {
60
- container "nginx" {
61
- port 80
62
- image "nginx:latest"
63
- }
64
- }
65
- `;
66
-
67
- const doc = new DocumentEncoder().encode(source);
68
-
69
- // Pretty-print the parsed document structure
70
- console.log(inspect(doc));
71
- ```
72
-
73
- ## Documentation
74
-
75
- For more information about DON, check out the [complete documentation](./docs/index.md):
76
-
77
- - [DON File Format](./docs/don-file.md): Complete format specification
78
- - [Formal Specification v0](./docs/specs/v0/spec.md): Draft specification (v0)
79
- - [Directives](./docs/concepts/directive.md): Anatomy and usage of directives
80
- - [Heredocs](./docs/concepts/heredoc.md): Multi-line content blocks
81
- - [Data Types](./docs/concepts/types/): Specification of supported types
82
- - [Inspiration](./docs/inspiration.md): Project goals and vision
83
-
84
- ## License
85
-
86
- This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
@@ -0,0 +1,10 @@
1
+ export declare class Directive {
2
+ readonly name: string;
3
+ readonly args: (number | string | boolean)[];
4
+ readonly children: Directive[];
5
+ constructor(name: string, args: (number | string | boolean)[], children?: Directive[]);
6
+ }
7
+ export declare class DON {
8
+ static parse(text: string): Directive[];
9
+ }
10
+ //# sourceMappingURL=don.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"don.d.ts","sourceRoot":"","sources":["../../src/don.ts"],"names":[],"mappings":"AAGA,qBAAa,SAAS;IAElB,QAAQ,CAAC,IAAI,EAAE,MAAM;IACrB,QAAQ,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,EAAE;IAC5C,QAAQ,CAAC,QAAQ,EAAE,SAAS,EAAE;gBAFrB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,CAAC,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,EAAE,EACnC,QAAQ,GAAE,SAAS,EAAO;CAEtC;AAsBD,qBAAa,GAAG;IACd,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,MAAM;CAK1B"}
package/lib/esm/don.js ADDED
@@ -0,0 +1,27 @@
1
+ import { SyntaxEncode } from "./v1/compiler/syntax-encode";
2
+ export class Directive {
3
+ name;
4
+ args;
5
+ children;
6
+ constructor(name, args, children = []) {
7
+ this.name = name;
8
+ this.args = args;
9
+ this.children = children;
10
+ }
11
+ }
12
+ const toDirective = (node) => {
13
+ return new Directive(node.name.text(), node.args.map((token) => token.toJS()), node.children.map((child) => toDirective(child)).flat());
14
+ };
15
+ const docToDirective = (node) => {
16
+ const directives = node.children.map((node) => {
17
+ return new Directive(node.name.text(), node.args.map((token) => token.toJS()), node.children.map((child) => toDirective(child)).flat());
18
+ });
19
+ return directives;
20
+ };
21
+ export class DON {
22
+ static parse(text) {
23
+ const documentNode = new SyntaxEncode().encode(text);
24
+ return docToDirective(documentNode);
25
+ }
26
+ }
27
+ //# sourceMappingURL=don.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"don.js","sourceRoot":"","sources":["../../src/don.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAE3D,MAAM,OAAO,SAAS;IAET;IACA;IACA;IAHX,YACW,IAAY,EACZ,IAAmC,EACnC,WAAwB,EAAE;QAF1B,SAAI,GAAJ,IAAI,CAAQ;QACZ,SAAI,GAAJ,IAAI,CAA+B;QACnC,aAAQ,GAAR,QAAQ,CAAkB;IAClC,CAAC;CACL;AAED,MAAM,WAAW,GAAG,CAAC,IAAmB,EAAa,EAAE;IACrD,OAAO,IAAI,SAAS,CAClB,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,EAChB,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,EACtC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,CACxD,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,cAAc,GAAG,CAAC,IAAkB,EAAe,EAAE;IACzD,MAAM,UAAU,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QAC5C,OAAO,IAAI,SAAS,CAClB,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,EAChB,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,EACtC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,CACxD,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,OAAO,UAAU,CAAC;AACpB,CAAC,CAAC;AAEF,MAAM,OAAO,GAAG;IACd,MAAM,CAAC,KAAK,CAAC,IAAY;QACvB,MAAM,YAAY,GAAG,IAAI,YAAY,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAErD,OAAO,cAAc,CAAC,YAAY,CAAC,CAAC;IACtC,CAAC;CACF"}
@@ -1,3 +1,3 @@
1
- export { LexerEncoder, Lexema, Token, TokenExpression } from "./lexer.js";
2
- export { Directive, Document, DocumentEncoder } from "./document.js";
1
+ export { SyntaxEncode } from "./v1/compiler/syntax-encode.js";
2
+ export { DON, Directive } from "./don.js";
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC1E,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAC9D,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC"}
package/lib/esm/index.js CHANGED
@@ -1,3 +1,3 @@
1
- export { LexerEncoder, Lexema, Token, TokenExpression } from "./lexer.js";
2
- export { Directive, Document, DocumentEncoder } from "./document.js";
1
+ export { SyntaxEncode } from "./v1/compiler/syntax-encode.js";
2
+ export { DON, Directive } from "./don.js";
3
3
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC1E,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAC9D,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC"}
@@ -0,0 +1,26 @@
1
+ import { Span } from "./span.js";
2
+ import type { Token } from "./token.js";
3
+ export declare class DocumentNode {
4
+ readonly children: DirectiveNode[];
5
+ readonly span: Span;
6
+ constructor(children: DirectiveNode[], span: Span);
7
+ static fromNodes(nodes: DirectiveNode[]): DocumentNode;
8
+ }
9
+ export declare class DirectiveNode {
10
+ #private;
11
+ get id(): number;
12
+ readonly name: Token;
13
+ readonly args: Token[];
14
+ readonly children: DirectiveNode[];
15
+ readonly span: Span;
16
+ constructor(name: Token, args: Token[], children: DirectiveNode[]);
17
+ private lastToken;
18
+ toJSON(): {
19
+ id: number;
20
+ name: string;
21
+ args: string[];
22
+ span: Span;
23
+ children: DirectiveNode[];
24
+ };
25
+ }
26
+ //# sourceMappingURL=directive-node.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"directive-node.d.ts","sourceRoot":"","sources":["../../../../src/v1/compiler/directive-node.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAKxC,qBAAa,YAAY;IAErB,QAAQ,CAAC,QAAQ,EAAE,aAAa,EAAE;IAClC,QAAQ,CAAC,IAAI,EAAE,IAAI;gBADV,QAAQ,EAAE,aAAa,EAAE,EACzB,IAAI,EAAE,IAAI;IAGrB,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,aAAa,EAAE;CAgBxC;AAED,qBAAa,aAAa;;IAGxB,IAAI,EAAE,WAEL;IAED,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC;IACrB,QAAQ,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC;IACvB,QAAQ,CAAC,QAAQ,EAAE,aAAa,EAAE,CAAC;IACnC,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;gBAER,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,QAAQ,EAAE,aAAa,EAAE;IAajE,OAAO,CAAC,SAAS;IAIjB,MAAM;;;;;;;CASP"}
@@ -0,0 +1,48 @@
1
+ import { Span } from "./span.js";
2
+ const cursorIndex = { current: -1 };
3
+ const uid = () => ++cursorIndex.current;
4
+ export class DocumentNode {
5
+ children;
6
+ span;
7
+ constructor(children, span) {
8
+ this.children = children;
9
+ this.span = span;
10
+ }
11
+ static fromNodes(nodes) {
12
+ const first = nodes.at(0);
13
+ const last = nodes.at(-1);
14
+ if (!first || !last)
15
+ throw new Error("nodes cannot be empty");
16
+ return new DocumentNode(nodes, new Span(first.span.index, last.span.index + last.span.length, first.span.startLocation, last.span.endLocation));
17
+ }
18
+ }
19
+ export class DirectiveNode {
20
+ #id = uid();
21
+ get id() {
22
+ return this.#id;
23
+ }
24
+ name;
25
+ args;
26
+ children;
27
+ span;
28
+ constructor(name, args, children) {
29
+ this.name = name;
30
+ this.args = args;
31
+ this.children = children;
32
+ const lastToken = this.lastToken();
33
+ this.span = new Span(this.name.span.index, lastToken.span.index + lastToken.span.length, this.name.span.startLocation, lastToken.span.endLocation);
34
+ }
35
+ lastToken() {
36
+ return this.children.at(-1)?.lastToken() ?? this.args.at(-1) ?? this.name;
37
+ }
38
+ toJSON() {
39
+ return {
40
+ id: this.id,
41
+ name: this.name.text(),
42
+ args: this.args.map((arg) => arg.text()),
43
+ span: this.span,
44
+ children: this.children,
45
+ };
46
+ }
47
+ }
48
+ //# sourceMappingURL=directive-node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"directive-node.js","sourceRoot":"","sources":["../../../../src/v1/compiler/directive-node.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAGjC,MAAM,WAAW,GAAG,EAAE,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC;AACpC,MAAM,GAAG,GAAG,GAAG,EAAE,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC;AAExC,MAAM,OAAO,YAAY;IAEZ;IACA;IAFX,YACW,QAAyB,EACzB,IAAU;QADV,aAAQ,GAAR,QAAQ,CAAiB;QACzB,SAAI,GAAJ,IAAI,CAAM;IAClB,CAAC;IAEJ,MAAM,CAAC,SAAS,CAAC,KAAsB;QACrC,MAAM,KAAK,GAAG,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QAC1B,MAAM,IAAI,GAAG,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QAE1B,IAAI,CAAC,KAAK,IAAI,CAAC,IAAI;YAAE,MAAM,IAAI,K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EAAE,EAAE,IAAI,CAAC,EAAE;YACX,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE;YACtB,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;YACxC,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,QAAQ,EAAE,IAAI,CAAC,QAAQ;SACxB,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,15 @@
1
+ import { PartSet } from "./part-set.js";
2
+ import { Lexema } from "./lexema.js";
3
+ export type LexemaEncodeOptions = {
4
+ /**
5
+ * Enable debug info in output
6
+ */
7
+ debug?: boolean;
8
+ allowDebugDocument?: boolean;
9
+ };
10
+ export declare class LexemaEncode {
11
+ #private;
12
+ constructor(options?: LexemaEncodeOptions);
13
+ encode(input: string | Uint8Array | Iterable<number> | PartSet): Lexema;
14
+ }
15
+ //# sourceMappingURL=lexema-encode.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lexema-encode.d.ts","sourceRoot":"","sources":["../../../../src/v1/compiler/lexema-encode.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,MAAM,MAAM,mBAAmB,GAAG;IAChC;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B,CAAC;AAEF,qBAAa,YAAY;;gBAIX,OAAO,CAAC,EAAE,mBAAmB;IAMzC,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU,GAAG,QAAQ,CAAC,MAAM,CAAC,GAAG,OAAO;CAc/D"}
@@ -0,0 +1,22 @@
1
+ import { PartSetEncode } from "./part-set-encode.js";
2
+ import { PartSet } from "./part-set.js";
3
+ import { Token } from "./token.js";
4
+ import { Lexema } from "./lexema.js";
5
+ export class LexemaEncode {
6
+ #storeDocument;
7
+ #showInvisibleTokens;
8
+ constructor(options) {
9
+ this.#storeDocument =
10
+ options?.allowDebugDocument ?? options?.debug ?? false;
11
+ this.#showInvisibleTokens = options?.debug ?? false;
12
+ }
13
+ encode(input) {
14
+ const partSet = input instanceof PartSet ? input : new PartSetEncode().encode(input);
15
+ const lexema = new Lexema(Token.scan(partSet, { showInvisibleTokens: this.#showInvisibleTokens }));
16
+ if (this.#storeDocument) {
17
+ Lexema.debugSetDocument(lexema, input);
18
+ }
19
+ return lexema;
20
+ }
21
+ }
22
+ //# sourceMappingURL=lexema-encode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lexema-encode.js","sourceRoot":"","sources":["../../../../src/v1/compiler/lexema-encode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAUrC,MAAM,OAAO,YAAY;IACvB,cAAc,CAAU;IACxB,oBAAoB,CAAU;IAE9B,YAAY,OAA6B;QACvC,IAAI,CAAC,cAAc;YACjB,OAAO,EAAE,kBAAkB,IAAI,OAAO,EAAE,KAAK,IAAI,KAAK,CAAC;QACzD,IAAI,CAAC,oBAAoB,GAAG,OAAO,EAAE,KAAK,IAAI,KAAK,CAAC;IACtD,CAAC;IAED,MAAM,CAAC,KAAuD;QAC5D,MAAM,OAAO,GACX,KAAK,YAAY,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,aAAa,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAEvE,MAAM,MAAM,GAAG,IAAI,MAAM,CACvB,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,mBAAmB,EAAE,IAAI,CAAC,oBAAoB,EAAE,CAAC,CACxE,CAAC;QAEF,IAAI,IAAI,CAAC,cAAc,EAAE,CAAC;YACxB,MAAM,CAAC,gBAAgB,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;QACzC,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;CACF"}
@@ -0,0 +1,10 @@
1
+ import type { Token } from "./token.js";
2
+ import { PartSet } from "./part-set.js";
3
+ export declare class Lexema {
4
+ #private;
5
+ readonly tokens: Token[];
6
+ constructor(tokens: Token[]);
7
+ static debugSetDocument(ref: Lexema, body: string | Uint8Array | Iterable<number> | PartSet): void;
8
+ static debugGetDocument(ref: Lexema): Uint8Array | null;
9
+ }
10
+ //# sourceMappingURL=lexema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lexema.d.ts","sourceRoot":"","sources":["../../../../src/v1/compiler/lexema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,qBAAa,MAAM;;IAML,QAAQ,CAAC,MAAM,EAAE,KAAK,EAAE;gBAAf,MAAM,EAAE,KAAK,EAAE;IAEpC,MAAM,CAAC,gBAAgB,CACrB,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,QAAQ,CAAC,MAAM,CAAC,GAAG,OAAO;IAKxD,MAAM,CAAC,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI;CAWxD"}
@@ -0,0 +1,26 @@
1
+ import { PartSet } from "./part-set.js";
2
+ export class Lexema {
3
+ tokens;
4
+ static #documents = new WeakMap();
5
+ constructor(tokens) {
6
+ this.tokens = tokens;
7
+ }
8
+ static debugSetDocument(ref, body) {
9
+ this.#documents.set(ref, body);
10
+ }
11
+ static debugGetDocument(ref) {
12
+ const body = this.#documents.get(ref) ?? null;
13
+ if (!body)
14
+ return null;
15
+ if (typeof body === "string")
16
+ return new Uint8Array(new TextEncoder().encode(body));
17
+ if (body instanceof Uint8Array)
18
+ return body;
19
+ if (Symbol.iterator in body)
20
+ return new Uint8Array(body);
21
+ if (body instanceof PartSet)
22
+ return new Uint8Array(body.parts.map((part) => part.buffer).flat());
23
+ return null;
24
+ }
25
+ }
26
+ //# sourceMappingURL=lexema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lexema.js","sourceRoot":"","sources":["../../../../src/v1/compiler/lexema.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,MAAM,OAAO,MAAM;IAMI;IALrB,MAAM,CAAC,UAAU,GAAG,IAAI,OAAO,EAG5B,CAAC;IAEJ,YAAqB,MAAe;QAAf,WAAM,GAAN,MAAM,CAAS;IAAG,CAAC;IAExC,MAAM,CAAC,gBAAgB,CACrB,GAAW,EACX,IAAsD;QAEtD,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IACjC,CAAC;IAED,MAAM,CAAC,gBAAgB,CAAC,GAAW;QACjC,MAAM,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC;QAC9C,IAAI,CAAC,IAAI;YAAE,OAAO,IAAI,CAAC;QACvB,IAAI,OAAO,IAAI,KAAK,QAAQ;YAC1B,OAAO,IAAI,UAAU,CAAC,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;QACxD,IAAI,IAAI,YAAY,UAAU;YAAE,OAAO,IAAI,CAAC;QAC5C,IAAI,MAAM,CAAC,QAAQ,IAAI,IAAI;YAAE,OAAO,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC;QACzD,IAAI,IAAI,YAAY,OAAO;YACzB,OAAO,IAAI,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;QACtE,OAAO,IAAI,CAAC;IACd,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { PartSet } from "./part-set.js";
2
+ export declare class PartSetEncode {
3
+ constructor();
4
+ encode(input: string | Uint8Array | Iterable<number>): PartSet;
5
+ }
6
+ //# sourceMappingURL=part-set-encode.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"part-set-encode.d.ts","sourceRoot":"","sources":["../../../../src/v1/compiler/part-set-encode.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,qBAAa,aAAa;;IAGxB,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU,GAAG,QAAQ,CAAC,MAAM,CAAC;CAYrD"}
@@ -0,0 +1,15 @@
1
+ import { Part } from "./part.js";
2
+ import { PartSet } from "./part-set.js";
3
+ export class PartSetEncode {
4
+ constructor() { }
5
+ encode(input) {
6
+ const buff = typeof input === "string"
7
+ ? new TextEncoder().encode(input)
8
+ : input instanceof Uint8Array
9
+ ? input
10
+ : new Uint8Array(input);
11
+ const parts = Part.scan([...buff]);
12
+ return new PartSet(parts);
13
+ }
14
+ }
15
+ //# sourceMappingURL=part-set-encode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"part-set-encode.js","sourceRoot":"","sources":["../../../../src/v1/compiler/part-set-encode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,MAAM,OAAO,aAAa;IACxB,gBAAe,CAAC;IAEhB,MAAM,CAAC,KAA6C;QAClD,MAAM,IAAI,GACR,OAAO,KAAK,KAAK,QAAQ;YACvB,CAAC,CAAC,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC;YACjC,CAAC,CAAC,KAAK,YAAY,UAAU;gBAC3B,CAAC,CAAC,KAAK;gBACP,CAAC,CAAC,IAAI,UAAU,CAAC,KAAK,CAAC,CAAC;QAE9B,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;QAEnC,OAAO,IAAI,OAAO,CAAC,KAAK,CAAC,CAAC;IAC5B,CAAC;CACF"}
@@ -0,0 +1,6 @@
1
+ import type { Part } from "./part.js";
2
+ export declare class PartSet {
3
+ readonly parts: Part[];
4
+ constructor(parts: Part[]);
5
+ }
6
+ //# sourceMappingURL=part-set.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"part-set.d.ts","sourceRoot":"","sources":["../../../../src/v1/compiler/part-set.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEtC,qBAAa,OAAO;IACN,QAAQ,CAAC,KAAK,EAAE,IAAI,EAAE;gBAAb,KAAK,EAAE,IAAI,EAAE;CACnC"}
@@ -0,0 +1,7 @@
1
+ export class PartSet {
2
+ parts;
3
+ constructor(parts) {
4
+ this.parts = parts;
5
+ }
6
+ }
7
+ //# sourceMappingURL=part-set.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"part-set.js","sourceRoot":"","sources":["../../../../src/v1/compiler/part-set.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,OAAO;IACG;IAArB,YAAqB,KAAa;QAAb,UAAK,GAAL,KAAK,CAAQ;IAAG,CAAC;CACvC"}
@@ -0,0 +1,31 @@
1
+ import { SyntaxKind } from "../utils/syntax-kind.js";
2
+ import type { u8 } from "../types/u8.js";
3
+ import { Span } from "./span.js";
4
+ import type { Location } from "../types/location.js";
5
+ type PartScanOptions = {
6
+ readonly describeLocation?: (span: Span, start: Location, end: Location) => void;
7
+ };
8
+ export declare class Part {
9
+ readonly type: SyntaxKind;
10
+ readonly buffer: u8;
11
+ readonly span: Span;
12
+ id: number;
13
+ constructor(type: SyntaxKind, buffer: u8, span: Span);
14
+ toUint8Array(): Uint8Array<ArrayBuffer>;
15
+ toText(): string;
16
+ toJSON(): {
17
+ type: SyntaxKind;
18
+ text: string;
19
+ span: Span;
20
+ };
21
+ static matches: [
22
+ type: SyntaxKind,
23
+ charset: u8,
24
+ options?: {
25
+ limit?: number;
26
+ }
27
+ ][];
28
+ static scan(buffer: u8, options?: PartScanOptions): Part[];
29
+ }
30
+ export {};
31
+ //# sourceMappingURL=part.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"part.d.ts","sourceRoot":"","sources":["../../../../src/v1/compiler/part.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAMrD,KAAK,eAAe,GAAG;IACrB,QAAQ,CAAC,gBAAgB,CAAC,EAAE,CAC1B,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,QAAQ,EACf,GAAG,EAAE,QAAQ,KACV,IAAI,CAAC;CACX,CAAC;AAEF,qBAAa,IAAI;IAIb,QAAQ,CAAC,IAAI,EAAE,UAAU;IACzB,QAAQ,CAAC,MAAM,EAAE,EAAE;IACnB,QAAQ,CAAC,IAAI,EAAE,IAAI;IALrB,EAAE,SAAS;gBAGA,IAAI,EAAE,UAAU,EAChB,MAAM,EAAE,EAAE,EACV,IAAI,EAAE,IAAI;IAGrB,YAAY;IAIZ,MAAM;IAIN,MAAM;;;;;IAQN,MAAM,CAAC,OAAO,EAAE;QACd,IAAI,EAAE,UAAU;QAChB,OAAO,EAAE,EAAE;QACX,OAAO,CAAC,EAAE;YAAE,KAAK,CAAC,EAAE,MAAM,CAAA;SAAE;KAC7B,EAAE,CAgBD;IAEF,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,EAAE,OAAO,CAAC,EAAE,eAAe;CA2ElD"}
@@ -0,0 +1,109 @@
1
+ import { Charset } from "../utils/charset.js";
2
+ import { CharsetTools } from "../utils/charset-tools.js";
3
+ import { SyntaxKind } from "../utils/syntax-kind.js";
4
+ import { Span } from "./span.js";
5
+ import { PartialSpan } from "./partial-span.js";
6
+ const cursorUid = { current: -1 };
7
+ const uid = () => ++cursorUid.current;
8
+ export class Part {
9
+ type;
10
+ buffer;
11
+ span;
12
+ id = uid();
13
+ constructor(type, buffer, span) {
14
+ this.type = type;
15
+ this.buffer = buffer;
16
+ this.span = span;
17
+ }
18
+ toUint8Array() {
19
+ return new Uint8Array(this.buffer);
20
+ }
21
+ toText() {
22
+ return new TextDecoder().decode(this.toUint8Array());
23
+ }
24
+ toJSON() {
25
+ return {
26
+ type: this.type,
27
+ text: this.toText(),
28
+ span: this.span,
29
+ };
30
+ }
31
+ static matches = [
32
+ [SyntaxKind.alphabet, CharsetTools.alphabetCharts],
33
+ [SyntaxKind.integer, CharsetTools.numericCharts],
34
+ [SyntaxKind.whitespace, CharsetTools.whitespaceCharts],
35
+ [SyntaxKind.newline, CharsetTools.newlineCharts],
36
+ // .: dot
37
+ [SyntaxKind.dot, CharsetTools.dotCharts],
38
+ // _: underscore
39
+ [SyntaxKind.underscore, CharsetTools.underscoreCharts],
40
+ // {:
41
+ [SyntaxKind.openCurlyBrace, CharsetTools.openCurlyBraceCharts],
42
+ // }:
43
+ [SyntaxKind.closeCurlyBrace, CharsetTools.closeCurlyBraceCharts],
44
+ // quote
45
+ [SyntaxKind.singleQuote, CharsetTools.singleQuoteCharts, { limit: 1 }],
46
+ [SyntaxKind.doubleQuote, CharsetTools.doubleQuoteCharts, { limit: 1 }],
47
+ ];
48
+ static scan(buffer, options) {
49
+ const charset = new Charset(buffer);
50
+ let currentPos = 0;
51
+ const parts = [];
52
+ const matches = this.matches;
53
+ let paddingLine = 0;
54
+ let currentLine = 0;
55
+ let currentColumn = 0;
56
+ let newLineBreak = SyntaxKind.newline;
57
+ const findNextToken = (currentPos) => {
58
+ for (const [type, u8, options] of matches) {
59
+ const span = charset.span(u8, currentPos, options?.limit);
60
+ if (span)
61
+ return { type: type, span: span };
62
+ }
63
+ const overflowing = currentPos >= buffer.length;
64
+ if (overflowing)
65
+ return null;
66
+ // default next char as unknown
67
+ return {
68
+ type: SyntaxKind.unknown,
69
+ span: new PartialSpan(currentPos, 1),
70
+ };
71
+ };
72
+ while (true) {
73
+ const nextToken = findNextToken(currentPos);
74
+ if (!nextToken)
75
+ break;
76
+ const startLin = currentLine;
77
+ const startCol = currentColumn;
78
+ currentPos = nextToken.span.index + nextToken.span.length;
79
+ currentColumn += nextToken.span.length;
80
+ if (nextToken.type === SyntaxKind.whitespace && startCol === 0) {
81
+ paddingLine += nextToken.span.length;
82
+ }
83
+ const startPaddingLine = paddingLine;
84
+ if (nextToken.type === newLineBreak) {
85
+ paddingLine = 0;
86
+ currentLine += nextToken.span.length;
87
+ currentColumn = 0;
88
+ }
89
+ const endPaddingLine = paddingLine;
90
+ const endLin = currentLine;
91
+ const endCol = currentColumn;
92
+ const startLocation = {
93
+ line: startLin,
94
+ column: startCol,
95
+ paddingLine: startPaddingLine,
96
+ };
97
+ const endLocation = {
98
+ line: endLin,
99
+ column: endCol,
100
+ paddingLine: endPaddingLine,
101
+ };
102
+ const span = new Span(nextToken.span.index, nextToken.span.length, startLocation, endLocation);
103
+ options?.describeLocation?.(span, startLocation, endLocation);
104
+ parts.push(new Part(nextToken.type, charset.slice(nextToken.span.index, currentPos), span));
105
+ }
106
+ return parts;
107
+ }
108
+ }
109
+ //# sourceMappingURL=part.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"part.js","sourceRoot":"","sources":["../../../../src/v1/compiler/part.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM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GAAG,IAAI,IAAI,CACnB,SAAS,CAAC,IAAI,CAAC,KAAK,EACpB,SAAS,CAAC,IAAI,CAAC,MAAM,EACrB,aAAa,EACb,WAAW,CACZ,CAAC;YAEF,OAAO,EAAE,gBAAgB,EAAE,CAAC,IAAI,EAAE,aAAa,EAAE,WAAW,CAAC,CAAC;YAE9D,KAAK,CAAC,IAAI,CACR,IAAI,IAAI,CACN,SAAS,CAAC,IAAI,EACd,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,EAAE,UAAU,CAAC,EAC/C,IAAI,CACL,CACF,CAAC;QACJ,CAAC;QAED,OAAO,KAAK,CAAC;IACf,CAAC"}
@@ -0,0 +1,6 @@
1
+ export declare class PartialSpan {
2
+ readonly index: number;
3
+ readonly length: number;
4
+ constructor(index: number, length: number);
5
+ }
6
+ //# sourceMappingURL=partial-span.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"partial-span.d.ts","sourceRoot":"","sources":["../../../../src/v1/compiler/partial-span.ts"],"names":[],"mappings":"AAAA,qBAAa,WAAW;IAEpB,QAAQ,CAAC,KAAK,EAAE,MAAM;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM;gBADd,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM;CAE1B"}
@@ -0,0 +1,9 @@
1
+ export class PartialSpan {
2
+ index;
3
+ length;
4
+ constructor(index, length) {
5
+ this.index = index;
6
+ this.length = length;
7
+ }
8
+ }
9
+ //# sourceMappingURL=partial-span.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"partial-span.js","sourceRoot":"","sources":["../../../../src/v1/compiler/partial-span.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,WAAW;IAEX;IACA;IAFX,YACW,KAAa,EACb,MAAc;QADd,UAAK,GAAL,KAAK,CAAQ;QACb,WAAM,GAAN,MAAM,CAAQ;IACtB,CAAC;CACL"}
@@ -0,0 +1,9 @@
1
+ import type { Location } from "../types/location.js";
2
+ export declare class Span {
3
+ readonly index: number;
4
+ readonly length: number;
5
+ readonly startLocation: Location;
6
+ readonly endLocation: Location;
7
+ constructor(index: number, length: number, startLocation: Location, endLocation: Location);
8
+ }
9
+ //# sourceMappingURL=span.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"span.d.ts","sourceRoot":"","sources":["../../../../src/v1/compiler/span.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAErD,qBAAa,IAAI;IAEb,QAAQ,CAAC,KAAK,EAAE,MAAM;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM;IACvB,QAAQ,CAAC,aAAa,EAAE,QAAQ;IAChC,QAAQ,CAAC,WAAW,EAAE,QAAQ;gBAHrB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,QAAQ,EACvB,WAAW,EAAE,QAAQ;CAEjC"}
@@ -0,0 +1,13 @@
1
+ export class Span {
2
+ index;
3
+ length;
4
+ startLocation;
5
+ endLocation;
6
+ constructor(index, length, startLocation, endLocation) {
7
+ this.index = index;
8
+ this.length = length;
9
+ this.startLocation = startLocation;
10
+ this.endLocation = endLocation;
11
+ }
12
+ }
13
+ //# sourceMappingURL=span.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"span.js","sourceRoot":"","sources":["../../../../src/v1/compiler/span.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,IAAI;IAEJ;IACA;IACA;IACA;IAJX,YACW,KAAa,EACb,MAAc,EACd,aAAuB,EACvB,WAAqB;QAHrB,UAAK,GAAL,KAAK,CAAQ;QACb,WAAM,GAAN,MAAM,CAAQ;QACd,kBAAa,GAAb,aAAa,CAAU;QACvB,gBAAW,GAAX,WAAW,CAAU;IAC7B,CAAC;CACL"}
@@ -0,0 +1,9 @@
1
+ import { DocumentNode } from "./directive-node.js";
2
+ import { Lexema } from "./lexema.js";
3
+ import type { PartSet } from "./part-set.js";
4
+ export declare class SyntaxEncode {
5
+ static raw: WeakMap<DocumentNode, string | Iterable<number> | Uint8Array<ArrayBufferLike> | PartSet | Lexema>;
6
+ encode(input: string | Uint8Array | Iterable<number> | PartSet | Lexema): DocumentNode;
7
+ private static scan;
8
+ }
9
+ //# sourceMappingURL=syntax-encode.d.ts.map