tplm-lang 0.1.0
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/README.md +357 -0
- package/dist/compiler/grid-spec-builder.d.ts +30 -0
- package/dist/compiler/grid-spec-builder.js +1836 -0
- package/dist/compiler/index.d.ts +11 -0
- package/dist/compiler/index.js +13 -0
- package/dist/compiler/malloy-generator.d.ts +36 -0
- package/dist/compiler/malloy-generator.js +141 -0
- package/dist/compiler/multi-query-utils.d.ts +42 -0
- package/dist/compiler/multi-query-utils.js +185 -0
- package/dist/compiler/query-plan-generator.d.ts +77 -0
- package/dist/compiler/query-plan-generator.js +1456 -0
- package/dist/compiler/table-spec-builder.d.ts +11 -0
- package/dist/compiler/table-spec-builder.js +588 -0
- package/dist/compiler/table-spec.d.ts +434 -0
- package/dist/compiler/table-spec.js +274 -0
- package/dist/executor/index.d.ts +71 -0
- package/dist/executor/index.js +232 -0
- package/dist/index.d.ts +214 -0
- package/dist/index.js +220 -0
- package/dist/parser/ast.d.ts +253 -0
- package/dist/parser/ast.js +164 -0
- package/dist/parser/chevrotain-parser.d.ts +118 -0
- package/dist/parser/chevrotain-parser.js +1266 -0
- package/dist/parser/index.d.ts +30 -0
- package/dist/parser/index.js +36 -0
- package/dist/parser/parser.d.ts +4 -0
- package/dist/parser/parser.js +4354 -0
- package/dist/parser/prettifier.d.ts +14 -0
- package/dist/parser/prettifier.js +380 -0
- package/dist/renderer/grid-renderer.d.ts +19 -0
- package/dist/renderer/grid-renderer.js +541 -0
- package/dist/renderer/index.d.ts +4 -0
- package/dist/renderer/index.js +4 -0
- package/package.json +67 -0
- package/packages/parser/tpl.pegjs +568 -0
- package/packages/renderer/tpl-table.css +182 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TPL Parser - Unified Entry Point
|
|
3
|
+
*
|
|
4
|
+
* Provides a unified interface for parsing TPL statements.
|
|
5
|
+
* Default parser is Chevrotain (TypeScript-native).
|
|
6
|
+
* PEG (Peggy) parser available as fallback.
|
|
7
|
+
*/
|
|
8
|
+
import { parse as parseChevrotain } from './chevrotain-parser.js';
|
|
9
|
+
import { parse as parsePeggy } from './parser.js';
|
|
10
|
+
import type { TPLStatement } from './ast.js';
|
|
11
|
+
export type ParserType = 'chevrotain' | 'peggy';
|
|
12
|
+
export interface ParseOptions {
|
|
13
|
+
parser?: ParserType;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Parse a TPL statement.
|
|
17
|
+
*
|
|
18
|
+
* @param input - The TPL source code to parse
|
|
19
|
+
* @param options - Parser options (default: { parser: 'chevrotain' })
|
|
20
|
+
* @returns The parsed AST
|
|
21
|
+
*/
|
|
22
|
+
export declare function parse(input: string, options?: ParseOptions): TPLStatement;
|
|
23
|
+
/**
|
|
24
|
+
* Parse with error recovery (Chevrotain only).
|
|
25
|
+
* Returns partial results even if parsing fails.
|
|
26
|
+
*/
|
|
27
|
+
export declare function parseWithErrors(input: string): import("./chevrotain-parser.js").ParseResult;
|
|
28
|
+
export * from './ast.js';
|
|
29
|
+
export { parseChevrotain, parsePeggy };
|
|
30
|
+
export { formatTPL } from './prettifier.js';
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TPL Parser - Unified Entry Point
|
|
3
|
+
*
|
|
4
|
+
* Provides a unified interface for parsing TPL statements.
|
|
5
|
+
* Default parser is Chevrotain (TypeScript-native).
|
|
6
|
+
* PEG (Peggy) parser available as fallback.
|
|
7
|
+
*/
|
|
8
|
+
import { parse as parseChevrotain, parseWithErrors as parseChevrotainWithErrors } from './chevrotain-parser.js';
|
|
9
|
+
import { parse as parsePeggy } from './parser.js';
|
|
10
|
+
/**
|
|
11
|
+
* Parse a TPL statement.
|
|
12
|
+
*
|
|
13
|
+
* @param input - The TPL source code to parse
|
|
14
|
+
* @param options - Parser options (default: { parser: 'chevrotain' })
|
|
15
|
+
* @returns The parsed AST
|
|
16
|
+
*/
|
|
17
|
+
export function parse(input, options = {}) {
|
|
18
|
+
const parserType = options.parser ?? 'chevrotain';
|
|
19
|
+
if (parserType === 'peggy') {
|
|
20
|
+
return parsePeggy(input);
|
|
21
|
+
}
|
|
22
|
+
return parseChevrotain(input);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Parse with error recovery (Chevrotain only).
|
|
26
|
+
* Returns partial results even if parsing fails.
|
|
27
|
+
*/
|
|
28
|
+
export function parseWithErrors(input) {
|
|
29
|
+
return parseChevrotainWithErrors(input);
|
|
30
|
+
}
|
|
31
|
+
// Re-export types
|
|
32
|
+
export * from './ast.js';
|
|
33
|
+
// Re-export individual parsers for direct access
|
|
34
|
+
export { parseChevrotain, parsePeggy };
|
|
35
|
+
// Re-export prettifier
|
|
36
|
+
export { formatTPL } from './prettifier.js';
|