@jondotsoy/don 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +51 -22
- package/lib/esm/don.d.ts +10 -0
- package/lib/esm/don.d.ts.map +1 -0
- package/lib/esm/don.js +27 -0
- package/lib/esm/don.js.map +1 -0
- package/lib/esm/index.d.ts +1 -2
- package/lib/esm/index.d.ts.map +1 -1
- package/lib/esm/index.js +2 -2
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/v1/__utils__/key-syntax-kind.d.ts +2 -0
- package/lib/esm/v1/__utils__/key-syntax-kind.d.ts.map +1 -0
- package/lib/esm/v1/__utils__/key-syntax-kind.js +23 -0
- package/lib/esm/v1/__utils__/key-syntax-kind.js.map +1 -0
- package/lib/esm/v1/__utils__/normalize.d.ts +3 -0
- package/lib/esm/v1/__utils__/normalize.d.ts.map +1 -0
- package/lib/esm/v1/__utils__/normalize.js +10 -0
- package/lib/esm/v1/__utils__/normalize.js.map +1 -0
- package/lib/esm/v1/__utils__/t.d.ts +15 -0
- package/lib/esm/v1/__utils__/t.d.ts.map +1 -0
- package/lib/esm/v1/__utils__/t.js +32 -0
- package/lib/esm/v1/__utils__/t.js.map +1 -0
- package/lib/esm/v1/__utils__/to-token-snapshot.d.ts +7 -0
- package/lib/esm/v1/__utils__/to-token-snapshot.d.ts.map +1 -0
- package/lib/esm/v1/__utils__/to-token-snapshot.js +162 -0
- package/lib/esm/v1/__utils__/to-token-snapshot.js.map +1 -0
- package/lib/esm/v1/compiler/directive-node.d.ts +26 -0
- package/lib/esm/v1/compiler/directive-node.d.ts.map +1 -0
- package/lib/esm/v1/compiler/directive-node.js +48 -0
- package/lib/esm/v1/compiler/directive-node.js.map +1 -0
- package/lib/esm/v1/compiler/lexema-encode.d.ts +15 -0
- package/lib/esm/v1/compiler/lexema-encode.d.ts.map +1 -0
- package/lib/esm/v1/compiler/lexema-encode.js +22 -0
- package/lib/esm/v1/compiler/lexema-encode.js.map +1 -0
- package/lib/esm/v1/compiler/lexema.d.ts +10 -0
- package/lib/esm/v1/compiler/lexema.d.ts.map +1 -0
- package/lib/esm/v1/compiler/lexema.js +26 -0
- package/lib/esm/v1/compiler/lexema.js.map +1 -0
- package/lib/esm/v1/compiler/part-set-encode.d.ts +6 -0
- package/lib/esm/v1/compiler/part-set-encode.d.ts.map +1 -0
- package/lib/esm/v1/compiler/part-set-encode.js +15 -0
- package/lib/esm/v1/compiler/part-set-encode.js.map +1 -0
- package/lib/esm/v1/compiler/part-set.d.ts +6 -0
- package/lib/esm/v1/compiler/part-set.d.ts.map +1 -0
- package/lib/esm/v1/compiler/part-set.js +7 -0
- package/lib/esm/v1/compiler/part-set.js.map +1 -0
- package/lib/esm/v1/compiler/part.d.ts +31 -0
- package/lib/esm/v1/compiler/part.d.ts.map +1 -0
- package/lib/esm/v1/compiler/part.js +109 -0
- package/lib/esm/v1/compiler/part.js.map +1 -0
- package/lib/esm/v1/compiler/partial-span.d.ts +6 -0
- package/lib/esm/v1/compiler/partial-span.d.ts.map +1 -0
- package/lib/esm/v1/compiler/partial-span.js +9 -0
- package/lib/esm/v1/compiler/partial-span.js.map +1 -0
- package/lib/esm/v1/compiler/span.d.ts +9 -0
- package/lib/esm/v1/compiler/span.d.ts.map +1 -0
- package/lib/esm/v1/compiler/span.js +13 -0
- package/lib/esm/v1/compiler/span.js.map +1 -0
- package/lib/esm/v1/compiler/syntax-encode.d.ts +9 -0
- package/lib/esm/v1/compiler/syntax-encode.d.ts.map +1 -0
- package/lib/esm/v1/compiler/syntax-encode.js +160 -0
- package/lib/esm/v1/compiler/syntax-encode.js.map +1 -0
- package/lib/esm/v1/compiler/token.d.ts +59 -0
- package/lib/esm/v1/compiler/token.d.ts.map +1 -0
- package/lib/esm/v1/compiler/token.js +320 -0
- package/lib/esm/v1/compiler/token.js.map +1 -0
- package/lib/esm/v1/types/location.d.ts +6 -0
- package/lib/esm/v1/types/location.d.ts.map +1 -0
- package/lib/esm/v1/types/location.js +2 -0
- package/lib/esm/v1/types/location.js.map +1 -0
- package/lib/esm/v1/types/u8.d.ts +2 -0
- package/lib/esm/v1/types/u8.d.ts.map +1 -0
- package/lib/esm/v1/types/u8.js +2 -0
- package/lib/esm/v1/types/u8.js.map +1 -0
- package/lib/esm/v1/utils/build-logger.d.ts +11 -0
- package/lib/esm/v1/utils/build-logger.d.ts.map +1 -0
- package/lib/esm/v1/utils/build-logger.js +20 -0
- package/lib/esm/v1/utils/build-logger.js.map +1 -0
- package/lib/esm/v1/utils/charset-tools.d.ts +15 -0
- package/lib/esm/v1/utils/charset-tools.d.ts.map +1 -0
- package/lib/esm/v1/utils/charset-tools.js +37 -0
- package/lib/esm/v1/utils/charset-tools.js.map +1 -0
- package/lib/esm/v1/utils/charset.d.ts +34 -0
- package/lib/esm/v1/utils/charset.d.ts.map +1 -0
- package/lib/esm/v1/utils/charset.js +52 -0
- package/lib/esm/v1/utils/charset.js.map +1 -0
- package/lib/esm/v1/utils/parts-match.d.ts +12 -0
- package/lib/esm/v1/utils/parts-match.d.ts.map +1 -0
- package/lib/esm/v1/utils/parts-match.js +30 -0
- package/lib/esm/v1/utils/parts-match.js.map +1 -0
- package/lib/esm/v1/utils/syntax-kind.d.ts +22 -0
- package/lib/esm/v1/utils/syntax-kind.d.ts.map +1 -0
- package/lib/esm/v1/utils/syntax-kind.js +28 -0
- package/lib/esm/v1/utils/syntax-kind.js.map +1 -0
- package/lib/esm/v1/utils/take-while.d.ts +53 -0
- package/lib/esm/v1/utils/take-while.d.ts.map +1 -0
- package/lib/esm/v1/utils/take-while.js +69 -0
- package/lib/esm/v1/utils/take-while.js.map +1 -0
- package/package.json +1 -1
- package/lib/esm/chunk.d.ts +0 -28
- package/lib/esm/chunk.d.ts.map +0 -1
- package/lib/esm/chunk.js +0 -84
- package/lib/esm/chunk.js.map +0 -1
- package/lib/esm/document.d.ts +0 -20
- package/lib/esm/document.d.ts.map +0 -1
- package/lib/esm/document.js +0 -138
- package/lib/esm/document.js.map +0 -1
- package/lib/esm/lexer.d.ts +0 -38
- package/lib/esm/lexer.d.ts.map +0 -1
- package/lib/esm/lexer.js +0 -600
- package/lib/esm/lexer.js.map +0 -1
- package/lib/esm/utils/inspect.d.ts +0 -7
- package/lib/esm/utils/inspect.d.ts.map +0 -1
- package/lib/esm/utils/inspect.js +0 -39
- package/lib/esm/utils/inspect.js.map +0 -1
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export declare enum SyntaxKind {
|
|
2
|
+
unknown = 0,
|
|
3
|
+
alphabet = 1,
|
|
4
|
+
integer = 2,
|
|
5
|
+
whitespace = 3,
|
|
6
|
+
newline = 4,
|
|
7
|
+
dot = 5,
|
|
8
|
+
underscore = 6,
|
|
9
|
+
singleQuote = 7,
|
|
10
|
+
doubleQuote = 8,
|
|
11
|
+
openCurlyBrace = 9,
|
|
12
|
+
closeCurlyBrace = 10,
|
|
13
|
+
keyword = 11,
|
|
14
|
+
string = 12,
|
|
15
|
+
numeric = 13,
|
|
16
|
+
boolean = 14,
|
|
17
|
+
null = 15,
|
|
18
|
+
comment = 16,
|
|
19
|
+
indent = 17,
|
|
20
|
+
heredoc = 18
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=syntax-kind.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"syntax-kind.d.ts","sourceRoot":"","sources":["../../../../src/v1/utils/syntax-kind.ts"],"names":[],"mappings":"AAAA,oBAAY,UAAU;IACpB,OAAO,IAAA;IACP,QAAQ,IAAA;IACR,OAAO,IAAA;IACP,UAAU,IAAA;IACV,OAAO,IAAA;IACP,GAAG,IAAA;IACH,UAAU,IAAA;IACV,WAAW,IAAA;IACX,WAAW,IAAA;IAEX,cAAc,IAAA;IAEd,eAAe,KAAA;IAKf,OAAO,KAAA;IACP,MAAM,KAAA;IACN,OAAO,KAAA;IACP,OAAO,KAAA;IACP,IAAI,KAAA;IACJ,OAAO,KAAA;IACP,MAAM,KAAA;IACN,OAAO,KAAA;CACR"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export var SyntaxKind;
|
|
2
|
+
(function (SyntaxKind) {
|
|
3
|
+
SyntaxKind[SyntaxKind["unknown"] = 0] = "unknown";
|
|
4
|
+
SyntaxKind[SyntaxKind["alphabet"] = 1] = "alphabet";
|
|
5
|
+
SyntaxKind[SyntaxKind["integer"] = 2] = "integer";
|
|
6
|
+
SyntaxKind[SyntaxKind["whitespace"] = 3] = "whitespace";
|
|
7
|
+
SyntaxKind[SyntaxKind["newline"] = 4] = "newline";
|
|
8
|
+
SyntaxKind[SyntaxKind["dot"] = 5] = "dot";
|
|
9
|
+
SyntaxKind[SyntaxKind["underscore"] = 6] = "underscore";
|
|
10
|
+
SyntaxKind[SyntaxKind["singleQuote"] = 7] = "singleQuote";
|
|
11
|
+
SyntaxKind[SyntaxKind["doubleQuote"] = 8] = "doubleQuote";
|
|
12
|
+
// {
|
|
13
|
+
SyntaxKind[SyntaxKind["openCurlyBrace"] = 9] = "openCurlyBrace";
|
|
14
|
+
// }
|
|
15
|
+
SyntaxKind[SyntaxKind["closeCurlyBrace"] = 10] = "closeCurlyBrace";
|
|
16
|
+
////
|
|
17
|
+
// token types
|
|
18
|
+
////
|
|
19
|
+
SyntaxKind[SyntaxKind["keyword"] = 11] = "keyword";
|
|
20
|
+
SyntaxKind[SyntaxKind["string"] = 12] = "string";
|
|
21
|
+
SyntaxKind[SyntaxKind["numeric"] = 13] = "numeric";
|
|
22
|
+
SyntaxKind[SyntaxKind["boolean"] = 14] = "boolean";
|
|
23
|
+
SyntaxKind[SyntaxKind["null"] = 15] = "null";
|
|
24
|
+
SyntaxKind[SyntaxKind["comment"] = 16] = "comment";
|
|
25
|
+
SyntaxKind[SyntaxKind["indent"] = 17] = "indent";
|
|
26
|
+
SyntaxKind[SyntaxKind["heredoc"] = 18] = "heredoc";
|
|
27
|
+
})(SyntaxKind || (SyntaxKind = {}));
|
|
28
|
+
//# sourceMappingURL=syntax-kind.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"syntax-kind.js","sourceRoot":"","sources":["../../../../src/v1/utils/syntax-kind.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,UA0BX;AA1BD,WAAY,UAAU;IACpB,iDAAO,CAAA;IACP,mDAAQ,CAAA;IACR,iDAAO,CAAA;IACP,uDAAU,CAAA;IACV,iDAAO,CAAA;IACP,yCAAG,CAAA;IACH,uDAAU,CAAA;IACV,yDAAW,CAAA;IACX,yDAAW,CAAA;IACX,IAAI;IACJ,+DAAc,CAAA;IACd,IAAI;IACJ,kEAAe,CAAA;IAEf,IAAI;IACJ,cAAc;IACd,IAAI;IACJ,kDAAO,CAAA;IACP,gDAAM,CAAA;IACN,kDAAO,CAAA;IACP,kDAAO,CAAA;IACP,4CAAI,CAAA;IACJ,kDAAO,CAAA;IACP,gDAAM,CAAA;IACN,kDAAO,CAAA;AACT,CAAC,EA1BW,UAAU,KAAV,UAAU,QA0BrB"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generator function that yields elements from an array while a predicate condition is true.
|
|
3
|
+
* Stops iteration as soon as the predicate returns false.
|
|
4
|
+
*
|
|
5
|
+
* @template T - The type of elements in the array
|
|
6
|
+
* @param {T[]} array - The source array to iterate over
|
|
7
|
+
* @param {(value: T, index: number, array: T[]) => boolean} predicate - Function that tests each element.
|
|
8
|
+
* Returns true to continue yielding elements, false to stop iteration.
|
|
9
|
+
* @param {number} [fromIndex=0] - The index to start iteration from (defaults to 0)
|
|
10
|
+
* @yields {T} Elements from the array while the predicate returns true
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```ts
|
|
14
|
+
* const numbers = [1, 2, 3, 4, 5, 6];
|
|
15
|
+
* const lessThanFour = [...takeWhile(numbers, n => n < 4)];
|
|
16
|
+
* // Result: [1, 2, 3]
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* const tokens = ['a', 'b', 'c', 'd'];
|
|
22
|
+
* const untilC = [...takeWhile(tokens, t => t !== 'c')];
|
|
23
|
+
* // Result: ['a', 'b']
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```ts
|
|
28
|
+
* // Starting from a specific index
|
|
29
|
+
* const items = [1, 2, 3, 4, 5];
|
|
30
|
+
* const fromIndex2 = [...takeWhile(items, n => n < 5, 2)];
|
|
31
|
+
* // Result: [3, 4]
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export declare const takeWhile: <T>(array: T[], predicate: (value: T, index: number, array: T[]) => boolean, fromIndex?: number) => Generator<NonNullable<T>, void, unknown>;
|
|
35
|
+
/**
|
|
36
|
+
* Finds the index of the first element in an array that satisfies the provided predicate function.
|
|
37
|
+
*
|
|
38
|
+
* @template T - The type of elements in the array
|
|
39
|
+
* @param array - The array to search
|
|
40
|
+
* @param predicate - Function to test each element. Returns truthy value for matching element
|
|
41
|
+
* @param fromIndex - The index to start searching from (default: 0)
|
|
42
|
+
* @returns The index of the first matching element, or -1 if no match is found
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```ts
|
|
46
|
+
* const numbers = [1, 2, 3, 4, 5];
|
|
47
|
+
* findIndex(numbers, (n) => n > 3); // Returns 3
|
|
48
|
+
* findIndex(numbers, (n) => n > 3, 4); // Returns 4 (starts from index 4)
|
|
49
|
+
* findIndex(numbers, (n) => n > 10); // Returns -1
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
export declare const findIndex: <T>(array: T[], predicate: (value: T, index: number, obj: T[]) => unknown, fromIndex?: number) => number;
|
|
53
|
+
//# sourceMappingURL=take-while.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"take-while.d.ts","sourceRoot":"","sources":["../../../../src/v1/utils/take-while.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,eAAO,MAAM,SAAS,GAAc,CAAC,EACnC,OAAO,CAAC,EAAE,EACV,WAAW,CAAC,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,OAAO,EAC3D,YAAW,MAAU,6CAWtB,CAAC;AAEF;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,SAAS,GAAa,CAAC,EAClC,OAAO,CAAC,EAAE,EACV,WAAW,CAAC,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,KAAK,OAAO,EACzD,YAAW,MAAU,WAUtB,CAAC"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generator function that yields elements from an array while a predicate condition is true.
|
|
3
|
+
* Stops iteration as soon as the predicate returns false.
|
|
4
|
+
*
|
|
5
|
+
* @template T - The type of elements in the array
|
|
6
|
+
* @param {T[]} array - The source array to iterate over
|
|
7
|
+
* @param {(value: T, index: number, array: T[]) => boolean} predicate - Function that tests each element.
|
|
8
|
+
* Returns true to continue yielding elements, false to stop iteration.
|
|
9
|
+
* @param {number} [fromIndex=0] - The index to start iteration from (defaults to 0)
|
|
10
|
+
* @yields {T} Elements from the array while the predicate returns true
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```ts
|
|
14
|
+
* const numbers = [1, 2, 3, 4, 5, 6];
|
|
15
|
+
* const lessThanFour = [...takeWhile(numbers, n => n < 4)];
|
|
16
|
+
* // Result: [1, 2, 3]
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* const tokens = ['a', 'b', 'c', 'd'];
|
|
22
|
+
* const untilC = [...takeWhile(tokens, t => t !== 'c')];
|
|
23
|
+
* // Result: ['a', 'b']
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```ts
|
|
28
|
+
* // Starting from a specific index
|
|
29
|
+
* const items = [1, 2, 3, 4, 5];
|
|
30
|
+
* const fromIndex2 = [...takeWhile(items, n => n < 5, 2)];
|
|
31
|
+
* // Result: [3, 4]
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export const takeWhile = function* (array, predicate, fromIndex = 0) {
|
|
35
|
+
for (let index = fromIndex; index < array.length; index++) {
|
|
36
|
+
const item = array[index];
|
|
37
|
+
if (!predicate(item, index, array)) {
|
|
38
|
+
break;
|
|
39
|
+
}
|
|
40
|
+
yield item;
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Finds the index of the first element in an array that satisfies the provided predicate function.
|
|
45
|
+
*
|
|
46
|
+
* @template T - The type of elements in the array
|
|
47
|
+
* @param array - The array to search
|
|
48
|
+
* @param predicate - Function to test each element. Returns truthy value for matching element
|
|
49
|
+
* @param fromIndex - The index to start searching from (default: 0)
|
|
50
|
+
* @returns The index of the first matching element, or -1 if no match is found
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* ```ts
|
|
54
|
+
* const numbers = [1, 2, 3, 4, 5];
|
|
55
|
+
* findIndex(numbers, (n) => n > 3); // Returns 3
|
|
56
|
+
* findIndex(numbers, (n) => n > 3, 4); // Returns 4 (starts from index 4)
|
|
57
|
+
* findIndex(numbers, (n) => n > 10); // Returns -1
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
export const findIndex = function (array, predicate, fromIndex = 0) {
|
|
61
|
+
for (let index = fromIndex; index < array.length; index++) {
|
|
62
|
+
const item = array[index];
|
|
63
|
+
if (predicate(item, index, array)) {
|
|
64
|
+
return index;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return -1;
|
|
68
|
+
};
|
|
69
|
+
//# sourceMappingURL=take-while.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"take-while.js","sourceRoot":"","sources":["../../../../src/v1/utils/take-while.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,QAAQ,CAAC,EAChC,KAAU,EACV,SAA2D,EAC3D,YAAoB,CAAC;IAErB,KAAK,IAAI,KAAK,GAAG,SAAS,EAAE,KAAK,GAAG,KAAK,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC;QAC1D,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAE,CAAC;QAE3B,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC;YACnC,MAAM;QACR,CAAC;QAED,MAAM,IAAI,CAAC;IACb,CAAC;AACH,CAAC,CAAC;AAEF;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,UACvB,KAAU,EACV,SAAyD,EACzD,YAAoB,CAAC;IAErB,KAAK,IAAI,KAAK,GAAG,SAAS,EAAE,KAAK,GAAG,KAAK,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC;QAC1D,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAE,CAAC;QAE3B,IAAI,SAAS,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC;YAClC,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IACD,OAAO,CAAC,CAAC,CAAC;AACZ,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jondotsoy/don",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"description": "DON (Directive Object Notation) - A human-readable data serialization format based on directives and subdirectives for configuration files, infrastructure definitions, and structured data",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"don",
|
package/lib/esm/chunk.d.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
export declare class Chunk {
|
|
2
|
-
readonly pos: number;
|
|
3
|
-
readonly length: number;
|
|
4
|
-
readonly value: Iterable<number>;
|
|
5
|
-
readonly debug_str: string;
|
|
6
|
-
constructor(pos: number, length: number, value: Iterable<number>, debug_str?: string);
|
|
7
|
-
}
|
|
8
|
-
export declare class ChunkList {
|
|
9
|
-
readonly length: number;
|
|
10
|
-
readonly chunks: Iterable<Chunk>;
|
|
11
|
-
constructor(length: number, chunks: Iterable<Chunk>);
|
|
12
|
-
}
|
|
13
|
-
export declare class Expression {
|
|
14
|
-
readonly m: number[];
|
|
15
|
-
constructor(m: number[]);
|
|
16
|
-
test(buff: number[], fromIndex: number): boolean;
|
|
17
|
-
exec(buff: number[], fromIndex: number): number[];
|
|
18
|
-
static keywordExpression: Expression;
|
|
19
|
-
static spaceExpression: Expression;
|
|
20
|
-
}
|
|
21
|
-
type LexerEncoderOptions = {};
|
|
22
|
-
export declare class ChunkEncoder {
|
|
23
|
-
private options?;
|
|
24
|
-
constructor(options?: LexerEncoderOptions | undefined);
|
|
25
|
-
encode(buff: string | Iterable<number>): ChunkList;
|
|
26
|
-
}
|
|
27
|
-
export {};
|
|
28
|
-
//# sourceMappingURL=chunk.d.ts.map
|
package/lib/esm/chunk.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"chunk.d.ts","sourceRoot":"","sources":["../../src/chunk.ts"],"names":[],"mappings":"AAAA,qBAAa,KAAK;IAEd,QAAQ,CAAC,GAAG,EAAE,MAAM;IACpB,QAAQ,CAAC,MAAM,EAAE,MAAM;IACvB,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC;IAChC,QAAQ,CAAC,SAAS;gBAHT,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,EACvB,SAAS,SAEjB;CAEJ;AAED,qBAAa,SAAS;IAElB,QAAQ,CAAC,MAAM,EAAE,MAAM;IACvB,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,KAAK,CAAC;gBADvB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,QAAQ,CAAC,KAAK,CAAC;CAEnC;AAKD,qBAAa,UAAU;IACT,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE;gBAAX,CAAC,EAAE,MAAM,EAAE;IAEhC,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO;IAMhD,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE;IAUjD,MAAM,CAAC,iBAAiB,aASrB;IAEH,MAAM,CAAC,eAAe,aAAwB;CAC/C;AAED,KAAK,mBAAmB,GAAG,EAAE,CAAC;AAE9B,qBAAa,YAAY;IACX,OAAO,CAAC,OAAO,CAAC;gBAAR,OAAO,CAAC,EAAE,mBAAmB,YAAA;IAEjD,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC,GAAG,SAAS;CAiCnD"}
|
package/lib/esm/chunk.js
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
export class Chunk {
|
|
2
|
-
pos;
|
|
3
|
-
length;
|
|
4
|
-
value;
|
|
5
|
-
debug_str;
|
|
6
|
-
constructor(pos, length, value, debug_str = JSON.stringify(new TextDecoder().decode(new Uint8Array(value)))) {
|
|
7
|
-
this.pos = pos;
|
|
8
|
-
this.length = length;
|
|
9
|
-
this.value = value;
|
|
10
|
-
this.debug_str = debug_str;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
export class ChunkList {
|
|
14
|
-
length;
|
|
15
|
-
chunks;
|
|
16
|
-
constructor(length, chunks) {
|
|
17
|
-
this.length = length;
|
|
18
|
-
this.chunks = chunks;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
const range = (start, end) => Array.from({ length: -start + end + 1 }, (_, i) => i + start);
|
|
22
|
-
export class Expression {
|
|
23
|
-
m;
|
|
24
|
-
constructor(m) {
|
|
25
|
-
this.m = m;
|
|
26
|
-
}
|
|
27
|
-
test(buff, fromIndex) {
|
|
28
|
-
const charCode = buff[fromIndex];
|
|
29
|
-
if (charCode === undefined)
|
|
30
|
-
return false;
|
|
31
|
-
return this.m.includes(charCode);
|
|
32
|
-
}
|
|
33
|
-
exec(buff, fromIndex) {
|
|
34
|
-
let end = fromIndex;
|
|
35
|
-
while (end < buff.length && this.test(buff, end)) {
|
|
36
|
-
end++;
|
|
37
|
-
}
|
|
38
|
-
return buff.slice(fromIndex, end);
|
|
39
|
-
}
|
|
40
|
-
static keywordExpression = new Expression([
|
|
41
|
-
// a-z (97 ... 122)
|
|
42
|
-
...range(97, 122),
|
|
43
|
-
// A-Z (65 ... 90)
|
|
44
|
-
...range(65, 90),
|
|
45
|
-
// _ (95)
|
|
46
|
-
95,
|
|
47
|
-
// 0-9 (48 ... 57)
|
|
48
|
-
...range(48, 57),
|
|
49
|
-
]);
|
|
50
|
-
static spaceExpression = new Expression([32]);
|
|
51
|
-
}
|
|
52
|
-
export class ChunkEncoder {
|
|
53
|
-
options;
|
|
54
|
-
constructor(options) {
|
|
55
|
-
this.options = options;
|
|
56
|
-
}
|
|
57
|
-
encode(buff) {
|
|
58
|
-
const numberIterable = typeof buff === "string" ? new TextEncoder().encode(buff) : buff;
|
|
59
|
-
const bytes = Array.from(numberIterable);
|
|
60
|
-
const tokens = [];
|
|
61
|
-
let pos = 0;
|
|
62
|
-
const expressions = [
|
|
63
|
-
Expression.keywordExpression,
|
|
64
|
-
Expression.spaceExpression,
|
|
65
|
-
];
|
|
66
|
-
while (pos < bytes.length) {
|
|
67
|
-
const charCode = bytes[pos];
|
|
68
|
-
if (charCode === undefined)
|
|
69
|
-
break;
|
|
70
|
-
const expression = expressions.find((expression) => expression.test(bytes, pos));
|
|
71
|
-
if (expression) {
|
|
72
|
-
const value = expression.exec(bytes, pos);
|
|
73
|
-
tokens.push(new Chunk(pos, value.length, value));
|
|
74
|
-
pos += value.length;
|
|
75
|
-
continue;
|
|
76
|
-
}
|
|
77
|
-
// Symbols
|
|
78
|
-
tokens.push(new Chunk(pos, 1, [charCode]));
|
|
79
|
-
pos++;
|
|
80
|
-
}
|
|
81
|
-
return new ChunkList(tokens.length, tokens);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
//# sourceMappingURL=chunk.js.map
|
package/lib/esm/chunk.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"chunk.js","sourceRoot":"","sources":["../../src/chunk.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,KAAK;IAEL;IACA;IACA;IACA;IAJX,YACW,GAAW,EACX,MAAc,EACd,KAAuB,EACvB,YAAY,IAAI,CAAC,SAAS,CACjC,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,IAAI,UAAU,CAAC,KAAK,CAAC,CAAC,CAChD;QALQ,QAAG,GAAH,GAAG,CAAQ;QACX,WAAM,GAAN,MAAM,CAAQ;QACd,UAAK,GAAL,KAAK,CAAkB;QACvB,cAAS,GAAT,SAAS,CAEjB;IACA,CAAC;CACL;AAED,MAAM,OAAO,SAAS;IAET;IACA;IAFX,YACW,MAAc,EACd,MAAuB;QADvB,WAAM,GAAN,MAAM,CAAQ;QACd,WAAM,GAAN,MAAM,CAAiB;IAC/B,CAAC;CACL;AAED,MAAM,KAAK,GAAG,CAAC,KAAa,EAAE,GAAW,EAAE,EAAE,CAC3C,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC,KAAK,GAAG,GAAG,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC;AAEhE,MAAM,OAAO,UAAU;IACA;IAArB,YAAqB,CAAW;QAAX,MAAC,GAAD,CAAC,CAAU;IAAG,CAA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GAAY,EAAE,CAAC;QAC3B,IAAI,GAAG,GAAG,CAAC,CAAC;QAEZ,MAAM,WAAW,GAAG;YAClB,UAAU,CAAC,iBAAiB;YAC5B,UAAU,CAAC,eAAe;SAC3B,CAAC;QAEF,OAAO,GAAG,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC;YAC1B,MAAM,QAAQ,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC;YAC5B,IAAI,QAAQ,KAAK,SAAS;gBAAE,MAAM;YAElC,MAAM,UAAU,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,EAAE,CACjD,UAAU,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,CAAC,CAC5B,CAAC;YACF,IAAI,UAAU,EAAE,CAAC;gBACf,MAAM,KAAK,GAAG,UAAU,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;gBAC1C,MAAM,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC;gBACjD,GAAG,IAAI,KAAK,CAAC,MAAM,CAAC;gBACpB,SAAS;YACX,CAAC;YAED,UAAU;YACV,MAAM,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;YAC3C,GAAG,EAAE,CAAC;QACR,CAAC;QAED,OAAO,IAAI,SAAS,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9C,CAAC;CACF"}
|
package/lib/esm/document.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { ChunkList } from "./chunk";
|
|
2
|
-
import { Lexema, Token } from "./lexer";
|
|
3
|
-
export declare class Directive {
|
|
4
|
-
readonly name: Token;
|
|
5
|
-
readonly args: Token[];
|
|
6
|
-
readonly children: Directive[];
|
|
7
|
-
constructor(name: Token, args: Token[], children: Directive[]);
|
|
8
|
-
static isDirective(doc: unknown): doc is Directive;
|
|
9
|
-
}
|
|
10
|
-
export declare class Document {
|
|
11
|
-
readonly children: Directive[];
|
|
12
|
-
constructor(children: Directive[]);
|
|
13
|
-
static isDocument(doc: unknown): doc is Document;
|
|
14
|
-
}
|
|
15
|
-
export declare class DocumentEncoder {
|
|
16
|
-
encode(input: string | Iterable<number> | ChunkList | Lexema): Document;
|
|
17
|
-
private segmentByBrackets;
|
|
18
|
-
private parseDirectives;
|
|
19
|
-
}
|
|
20
|
-
//# sourceMappingURL=document.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"document.d.ts","sourceRoot":"","sources":["../../src/document.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EAAgB,MAAM,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEtD,qBAAa,SAAS;IAElB,QAAQ,CAAC,IAAI,EAAE,KAAK;IACpB,QAAQ,CAAC,IAAI,EAAE,KAAK,EAAE;IACtB,QAAQ,CAAC,QAAQ,EAAE,SAAS,EAAE;gBAFrB,IAAI,EAAE,KAAK,EACX,IAAI,EAAE,KAAK,EAAE,EACb,QAAQ,EAAE,SAAS,EAAE;IAGhC,MAAM,CAAC,WAAW,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,SAAS;CAGnD;AAED,qBAAa,QAAQ;IACP,QAAQ,CAAC,QAAQ,EAAE,SAAS,EAAE;gBAArB,QAAQ,EAAE,SAAS,EAAE;IAE1C,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,QAAQ;CAGjD;AAUD,qBAAa,eAAe;IAC1B,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC,GAAG,SAAS,GAAG,MAAM,GAAG,QAAQ;IAavE,OAAO,CAAC,iBAAiB;IAsCzB,OAAO,CAAC,eAAe;CAiGxB"}
|
package/lib/esm/document.js
DELETED
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
import { LexerEncoder, Lexema } from "./lexer";
|
|
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
|
-
static isDirective(doc) {
|
|
12
|
-
return doc instanceof Directive;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
export class Document {
|
|
16
|
-
children;
|
|
17
|
-
constructor(children) {
|
|
18
|
-
this.children = children;
|
|
19
|
-
}
|
|
20
|
-
static isDocument(doc) {
|
|
21
|
-
return doc instanceof Document;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
export class DocumentEncoder {
|
|
25
|
-
encode(input) {
|
|
26
|
-
const lexema = input instanceof Lexema ? input : new LexerEncoder().encode(input);
|
|
27
|
-
const tokens = Array.from(lexema.tokens);
|
|
28
|
-
// Segmentar por grupos de brackets
|
|
29
|
-
const groups = this.segmentByBrackets(tokens);
|
|
30
|
-
// Parsear las directivas
|
|
31
|
-
const directives = this.parseDirectives(tokens, 0, tokens.length, groups);
|
|
32
|
-
return new Document(directives);
|
|
33
|
-
}
|
|
34
|
-
segmentByBrackets(tokens) {
|
|
35
|
-
const groups = [];
|
|
36
|
-
const stack = [];
|
|
37
|
-
for (let i = 0; i < tokens.length; i++) {
|
|
38
|
-
const token = tokens[i];
|
|
39
|
-
if (!token || token.type !== "punctuator")
|
|
40
|
-
continue;
|
|
41
|
-
const value = token.raw;
|
|
42
|
-
if (value === "{") {
|
|
43
|
-
stack.push({ type: "braces", openIndex: i });
|
|
44
|
-
}
|
|
45
|
-
else if (value === "}") {
|
|
46
|
-
const open = stack.pop();
|
|
47
|
-
if (open && open.type === "braces") {
|
|
48
|
-
groups.push({
|
|
49
|
-
openIndex: open.openIndex,
|
|
50
|
-
closeIndex: i,
|
|
51
|
-
type: "braces",
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
else if (value === "[") {
|
|
56
|
-
stack.push({ type: "brackets", openIndex: i });
|
|
57
|
-
}
|
|
58
|
-
else if (value === "]") {
|
|
59
|
-
const open = stack.pop();
|
|
60
|
-
if (open && open.type === "brackets") {
|
|
61
|
-
groups.push({
|
|
62
|
-
openIndex: open.openIndex,
|
|
63
|
-
closeIndex: i,
|
|
64
|
-
type: "brackets",
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
return groups;
|
|
70
|
-
}
|
|
71
|
-
parseDirectives(tokens, startIndex, endIndex, groups) {
|
|
72
|
-
const directives = [];
|
|
73
|
-
let i = startIndex;
|
|
74
|
-
while (i < endIndex) {
|
|
75
|
-
const token = tokens[i];
|
|
76
|
-
if (!token)
|
|
77
|
-
break;
|
|
78
|
-
// Skip newlines
|
|
79
|
-
if (token.type === "newline") {
|
|
80
|
-
i++;
|
|
81
|
-
continue;
|
|
82
|
-
}
|
|
83
|
-
// Skip closing brackets (ya fueron procesados)
|
|
84
|
-
if (token.type === "punctuator" &&
|
|
85
|
-
(token.raw === "}" || token.raw === "]")) {
|
|
86
|
-
break;
|
|
87
|
-
}
|
|
88
|
-
// Parse directive: only keyword, string, number, or boolean can be directive names
|
|
89
|
-
if (token.type === "keyword" ||
|
|
90
|
-
token.type === "string" ||
|
|
91
|
-
token.type === "number" ||
|
|
92
|
-
token.type === "boolean") {
|
|
93
|
-
const name = token;
|
|
94
|
-
const args = [];
|
|
95
|
-
i++;
|
|
96
|
-
// Collect arguments until newline, block start, or end
|
|
97
|
-
while (i < endIndex) {
|
|
98
|
-
const argToken = tokens[i];
|
|
99
|
-
if (!argToken ||
|
|
100
|
-
argToken.type === "newline" ||
|
|
101
|
-
(argToken.type === "punctuator" && argToken.raw === "{") ||
|
|
102
|
-
(argToken.type === "punctuator" && argToken.raw === "}")) {
|
|
103
|
-
break;
|
|
104
|
-
}
|
|
105
|
-
args.push(argToken);
|
|
106
|
-
i++;
|
|
107
|
-
// If we just added a heredoc, stop collecting arguments
|
|
108
|
-
// because heredoc already includes its own newline
|
|
109
|
-
if (argToken.type === "heredoc") {
|
|
110
|
-
break;
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
// Check for block - buscar el grupo que empieza en la posición actual
|
|
114
|
-
let children = [];
|
|
115
|
-
const group = groups.find((g) => g.openIndex === i && g.type === "braces");
|
|
116
|
-
if (group) {
|
|
117
|
-
// Parsear recursivamente el contenido del grupo
|
|
118
|
-
children = this.parseDirectives(tokens, group.openIndex + 1, group.closeIndex, groups);
|
|
119
|
-
i = group.closeIndex + 1; // Saltar al final del grupo
|
|
120
|
-
// After a block, there should be no more tokens before newline
|
|
121
|
-
if (i < endIndex) {
|
|
122
|
-
const nextToken = tokens[i];
|
|
123
|
-
if (nextToken && nextToken.type !== "newline") {
|
|
124
|
-
throw new Error(`Syntax error: Unexpected token after block. Expected newline but got ${nextToken.type} "${nextToken.raw}"`);
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
directives.push(new Directive(name, args, children));
|
|
129
|
-
}
|
|
130
|
-
else {
|
|
131
|
-
// Invalid directive name - throw syntax error
|
|
132
|
-
throw new Error(`Syntax error: Invalid directive name. Expected keyword, string, number, or boolean, but got ${token.type} "${token.raw}"`);
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
return directives;
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
//# sourceMappingURL=document.js.map
|
package/lib/esm/document.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"document.js","sourceRoot":"","sources":["../../src/document.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,EAAS,MAAM,SAAS,CAAC;AAEtD,MAAM,OAAO,SAAS;IAET;IACA;IACA;IAHX,YACW,IAAW,EACX,IA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-
import { ChunkList } from "./chunk";
|
|
2
|
-
export declare class Token {
|
|
3
|
-
readonly type: string;
|
|
4
|
-
readonly raw: string;
|
|
5
|
-
constructor(type: string, raw: string);
|
|
6
|
-
}
|
|
7
|
-
export declare class Lexema {
|
|
8
|
-
readonly length: number;
|
|
9
|
-
readonly tokens: Iterable<Token>;
|
|
10
|
-
constructor(length: number, tokens: Iterable<Token>);
|
|
11
|
-
}
|
|
12
|
-
declare class MatchTokenExpressionResult {
|
|
13
|
-
readonly matched: ChunkList;
|
|
14
|
-
readonly length: number;
|
|
15
|
-
constructor(matched: ChunkList, length: number);
|
|
16
|
-
}
|
|
17
|
-
export declare class TokenExpression {
|
|
18
|
-
readonly test: (chunks: ChunkList, fromIndex: number) => () => null | MatchTokenExpressionResult;
|
|
19
|
-
constructor(test: (chunks: ChunkList, fromIndex: number) => () => null | MatchTokenExpressionResult);
|
|
20
|
-
match(chunks: ChunkList, fromIndex: number): null | MatchTokenExpressionResult;
|
|
21
|
-
static stringLiteral: TokenExpression;
|
|
22
|
-
static keyword: TokenExpression;
|
|
23
|
-
static punctuator: TokenExpression;
|
|
24
|
-
static newline: TokenExpression;
|
|
25
|
-
static booleanLiteral: TokenExpression;
|
|
26
|
-
static nullLiteral: TokenExpression;
|
|
27
|
-
static numberLiteral: TokenExpression;
|
|
28
|
-
static singleComment: TokenExpression;
|
|
29
|
-
static multilineComment: TokenExpression;
|
|
30
|
-
static heredoc: TokenExpression;
|
|
31
|
-
static whitespace: TokenExpression;
|
|
32
|
-
}
|
|
33
|
-
export declare class LexerEncoder {
|
|
34
|
-
encode(inpt: string | Iterable<number> | ChunkList): Lexema;
|
|
35
|
-
private findMatchingExpression;
|
|
36
|
-
}
|
|
37
|
-
export {};
|
|
38
|
-
//# sourceMappingURL=lexer.d.ts.map
|
package/lib/esm/lexer.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"lexer.d.ts","sourceRoot":"","sources":["../../src/lexer.ts"],"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