@altopelago/aeon-core 0.9.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 +133 -0
- package/dist/index.d.ts +106 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +331 -0
- package/dist/index.js.map +1 -0
- package/dist/preamble.d.ts +18 -0
- package/dist/preamble.d.ts.map +1 -0
- package/dist/preamble.js +91 -0
- package/dist/preamble.js.map +1 -0
- package/package.json +32 -0
package/README.md
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
# @altopelago/aeon-core
|
|
2
|
+
|
|
3
|
+
The canonical, safe entry point for AEON processing.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm add @altopelago/aeon-core
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Implementation docs:
|
|
12
|
+
|
|
13
|
+
- [`docs/implementations/typescript/api/core.md`](../../../../docs/implementations/typescript/api/core.md)
|
|
14
|
+
|
|
15
|
+
## Quick Start
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
import { compile } from '@altopelago/aeon-core';
|
|
19
|
+
|
|
20
|
+
const input = `
|
|
21
|
+
config = {
|
|
22
|
+
host = "localhost"
|
|
23
|
+
port:int32 = 8080
|
|
24
|
+
}
|
|
25
|
+
`;
|
|
26
|
+
|
|
27
|
+
const result = compile(input);
|
|
28
|
+
|
|
29
|
+
if (result.errors.length === 0) {
|
|
30
|
+
for (const event of result.events) {
|
|
31
|
+
console.log(event.path, event.value);
|
|
32
|
+
}
|
|
33
|
+
} else {
|
|
34
|
+
for (const error of result.errors) {
|
|
35
|
+
console.error(error.message);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## What You Get
|
|
41
|
+
|
|
42
|
+
- `events`: Assignment Events emitted from the source document
|
|
43
|
+
- `errors`: diagnostics from lexing, parsing, and downstream compile phases
|
|
44
|
+
|
|
45
|
+
## Common Patterns
|
|
46
|
+
|
|
47
|
+
### Fail closed by default
|
|
48
|
+
|
|
49
|
+
`compile()` returns an empty `events` array if any phase reports errors.
|
|
50
|
+
That is the production-safe default.
|
|
51
|
+
|
|
52
|
+
### Recovery mode for tooling
|
|
53
|
+
|
|
54
|
+
Use recovery mode only when partial output is useful for editors or diagnostics:
|
|
55
|
+
|
|
56
|
+
```ts
|
|
57
|
+
const result = compile(input, { recovery: true });
|
|
58
|
+
|
|
59
|
+
console.log(result.events); // may be partial
|
|
60
|
+
console.log(result.errors); // all known issues
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
> Warning: recovery mode is for tooling only.
|
|
64
|
+
|
|
65
|
+
### Typical next step
|
|
66
|
+
|
|
67
|
+
If you need schema validation after compile, pass `result.events` to `@altopelago/aeos-core`.
|
|
68
|
+
|
|
69
|
+
### Inspect the file preamble without full parsing
|
|
70
|
+
|
|
71
|
+
Use `inspectFilePreamble()` to read only the allowed file-header slot for:
|
|
72
|
+
- a leading `#!...` shebang
|
|
73
|
+
- a `//! format:<id>` host directive on line 1, or line 2 after a shebang
|
|
74
|
+
|
|
75
|
+
```ts
|
|
76
|
+
import { inspectFilePreamble } from '@altopelago/aeon-core';
|
|
77
|
+
|
|
78
|
+
const info = inspectFilePreamble('#!/usr/bin/env aeon\n//! format:aeon.test.v1\nvalue = {');
|
|
79
|
+
console.log(info.format); // "aeon.test.v1"
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## API
|
|
83
|
+
|
|
84
|
+
### `compile(input, options?)`
|
|
85
|
+
|
|
86
|
+
Compiles an AEON document into Assignment Events.
|
|
87
|
+
|
|
88
|
+
**Parameters:**
|
|
89
|
+
- `input: string` — AEON document source text
|
|
90
|
+
- `options?: CompileOptions`
|
|
91
|
+
- `recovery?: boolean` — Enable recovery mode (default: `false`)
|
|
92
|
+
- `maxInputBytes?: number` — Maximum accepted UTF-8 input size before fail-closed rejection
|
|
93
|
+
- `maxAttributeDepth?: number`
|
|
94
|
+
- `maxSeparatorDepth?: number`
|
|
95
|
+
- `emitAnnotations?: boolean`
|
|
96
|
+
- `datatypePolicy?: 'reserved_only' | 'allow_custom'`
|
|
97
|
+
|
|
98
|
+
**Returns:** `CompileResult`
|
|
99
|
+
- `events: AssignmentEvent[]` — Assignment events (empty if errors and not in recovery mode)
|
|
100
|
+
- `errors: AEONError[]` — All errors from all phases
|
|
101
|
+
- `header` — Parsed header metadata for downstream finalization/runtime projection
|
|
102
|
+
|
|
103
|
+
### `inspectFilePreamble(input)`
|
|
104
|
+
|
|
105
|
+
Reads only the file-header preamble slot and returns:
|
|
106
|
+
- `shebang`
|
|
107
|
+
- `hostDirective`
|
|
108
|
+
- `format`
|
|
109
|
+
- `span`
|
|
110
|
+
|
|
111
|
+
## Exported Types
|
|
112
|
+
|
|
113
|
+
- `CompileResult` — Return type of `compile()`
|
|
114
|
+
- `CompileOptions` — Options for `compile()`
|
|
115
|
+
- `AssignmentEvent` — Individual binding event
|
|
116
|
+
- `CanonicalPath` — Path representation
|
|
117
|
+
- `AEONError` — Union of all error types
|
|
118
|
+
- `Span`, `Position` — Source location types
|
|
119
|
+
- `formatPath()` — Utility to format paths as strings
|
|
120
|
+
|
|
121
|
+
## Lower-Level Packages
|
|
122
|
+
|
|
123
|
+
For advanced tooling, lower-level packages are available but considered unstable:
|
|
124
|
+
|
|
125
|
+
- `@altopelago/aeon-lexer` — Tokenization
|
|
126
|
+
- `@altopelago/aeon-parser` — AST construction
|
|
127
|
+
- `@altopelago/aeon-aes` — Event emission and validation
|
|
128
|
+
|
|
129
|
+
These APIs may evolve. Prefer `@altopelago/aeon-core` for stable usage.
|
|
130
|
+
|
|
131
|
+
For the implementation-defined option surface and security-oriented controls, see:
|
|
132
|
+
|
|
133
|
+
- [`docs/implementations/typescript/limits-and-policies.md`](../../../../docs/implementations/typescript/limits-and-policies.md)
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @altopelago/aeon-core - AEON Core Package
|
|
3
|
+
*
|
|
4
|
+
* The canonical, safe entry point for AEON processing.
|
|
5
|
+
*
|
|
6
|
+
* Usage:
|
|
7
|
+
* ```ts
|
|
8
|
+
* import { compile } from '@altopelago/aeon-core';
|
|
9
|
+
*
|
|
10
|
+
* const result = compile('key = "value"');
|
|
11
|
+
* if (result.errors.length === 0) {
|
|
12
|
+
* console.log(result.events);
|
|
13
|
+
* }
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
import { type LexerError } from '@altopelago/aeon-lexer';
|
|
17
|
+
import { type ParserError, type Document, type Value } from '@altopelago/aeon-parser';
|
|
18
|
+
import { EventEmissionError, type AssignmentEvent, type PathResolutionError, type ReferenceValidationError, type ModeEnforcementError, type DatatypePolicy } from '@altopelago/aeon-aes';
|
|
19
|
+
import { type AnnotationRecord } from '@altopelago/aeon-annotation-stream';
|
|
20
|
+
export { inspectFilePreamble, type FilePreambleInfo, type HostDirective, type HostDirectiveKind } from './preamble.js';
|
|
21
|
+
export declare const VERSION = "0.9.0";
|
|
22
|
+
/**
|
|
23
|
+
* Union of all possible AEON errors
|
|
24
|
+
*/
|
|
25
|
+
export type AEONError = LexerError | ParserError | PathResolutionError | EventEmissionError | ReferenceValidationError | ModeEnforcementError | InputSizeExceededError;
|
|
26
|
+
export declare class InputSizeExceededError extends Error {
|
|
27
|
+
readonly code = "INPUT_SIZE_EXCEEDED";
|
|
28
|
+
readonly actualBytes: number;
|
|
29
|
+
readonly maxBytes: number;
|
|
30
|
+
constructor(actualBytes: number, maxBytes: number);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Compilation result
|
|
34
|
+
*/
|
|
35
|
+
export interface CompileResult {
|
|
36
|
+
/** Assignment events (empty if any errors occurred unless recovery mode) */
|
|
37
|
+
readonly events: readonly AssignmentEvent[];
|
|
38
|
+
/** All errors from all phases */
|
|
39
|
+
readonly errors: readonly AEONError[];
|
|
40
|
+
/** Parsed header metadata for downstream projection/finalization. */
|
|
41
|
+
readonly header?: {
|
|
42
|
+
readonly fields: ReadonlyMap<string, Value>;
|
|
43
|
+
readonly span: Document['span'];
|
|
44
|
+
readonly form: 'structured' | 'shorthand';
|
|
45
|
+
};
|
|
46
|
+
/** Structured comment records emitted in parallel when enabled */
|
|
47
|
+
readonly annotations?: readonly AnnotationRecord[];
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Compilation options
|
|
51
|
+
*/
|
|
52
|
+
export interface CompileOptions {
|
|
53
|
+
/**
|
|
54
|
+
* Enable recovery mode: emit partial events even if errors exist.
|
|
55
|
+
* Default: false (fail-closed - no events on any error)
|
|
56
|
+
*
|
|
57
|
+
* WARNING: Recovery mode should only be used for tooling (e.g., IDE support).
|
|
58
|
+
* For production processing, always use fail-closed (default).
|
|
59
|
+
*/
|
|
60
|
+
readonly recovery?: boolean;
|
|
61
|
+
/** Maximum number of attribute segments in a reference path (default: 1). */
|
|
62
|
+
readonly maxAttributeDepth?: number;
|
|
63
|
+
/** Maximum number of separator specs in a datatype annotation (default: 1). */
|
|
64
|
+
readonly maxSeparatorDepth?: number;
|
|
65
|
+
/** Maximum nesting depth for nested generic type annotations (default: 1). */
|
|
66
|
+
readonly maxGenericDepth?: number;
|
|
67
|
+
/** Maximum container nesting depth for objects, lists, tuples, and nodes (default: 256). */
|
|
68
|
+
readonly maxNestingDepth?: number;
|
|
69
|
+
/** Emit structured annotation stream records. Default: true. */
|
|
70
|
+
readonly emitAnnotations?: boolean;
|
|
71
|
+
/** Datatype policy in strict mode. Default: reserved_only */
|
|
72
|
+
readonly datatypePolicy?: DatatypePolicy;
|
|
73
|
+
/** Maximum UTF-8 input size in bytes. Fail-closed when exceeded. */
|
|
74
|
+
readonly maxInputBytes?: number;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Compile an AEON document into Assignment Events
|
|
78
|
+
*
|
|
79
|
+
* This is the canonical, safe entry point for AEON processing.
|
|
80
|
+
* It runs all phases (lex → parse → resolve → emit → validate → enforce)
|
|
81
|
+
* and returns a deterministic result.
|
|
82
|
+
*
|
|
83
|
+
* **Fail-closed behavior**: If ANY error occurs in ANY phase,
|
|
84
|
+
* the returned events array will be empty. Errors are always collected
|
|
85
|
+
* and returned for diagnostics.
|
|
86
|
+
*
|
|
87
|
+
* @param input - AEON document source text
|
|
88
|
+
* @param options - Optional compilation settings
|
|
89
|
+
* @returns Compilation result with events and errors
|
|
90
|
+
*
|
|
91
|
+
* @example
|
|
92
|
+
* ```ts
|
|
93
|
+
* const result = compile('config = { port = 8080 }');
|
|
94
|
+
* if (result.errors.length === 0) {
|
|
95
|
+
* for (const event of result.events) {
|
|
96
|
+
* console.log(event.path, event.value);
|
|
97
|
+
* }
|
|
98
|
+
* }
|
|
99
|
+
* ```
|
|
100
|
+
*/
|
|
101
|
+
export declare function compile(input: string, options?: CompileOptions): CompileResult;
|
|
102
|
+
export type { AssignmentEvent, CanonicalPath } from '@altopelago/aeon-aes';
|
|
103
|
+
export type { AnnotationRecord } from '@altopelago/aeon-annotation-stream';
|
|
104
|
+
export type { Span, Position } from '@altopelago/aeon-lexer';
|
|
105
|
+
export { formatPath } from '@altopelago/aeon-aes';
|
|
106
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAY,KAAK,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,EAA2C,KAAK,WAAW,EAAE,KAAK,QAAQ,EAAE,KAAK,KAAK,EAAgB,MAAM,yBAAyB,CAAC;AAC7I,OAAO,EAKH,kBAAkB,EAClB,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACxB,KAAK,wBAAwB,EAC7B,KAAK,oBAAoB,EACzB,KAAK,cAAc,EACtB,MAAM,sBAAsB,CAAC;A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EAAE,MAAM,CAAC;IACpC,+EAA+E;IAC/E,QAAQ,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IACpC,8EAA8E;IAC9E,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;IAClC,4FAA4F;IAC5F,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;IAClC,gEAAgE;IAChE,QAAQ,CAAC,eAAe,CAAC,EAAE,OAAO,CAAC;IACnC,6DAA6D;IAC7D,QAAQ,CAAC,cAAc,CAAC,EAAE,cAAc,CAAC;IACzC,oEAAoE;IACpE,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;CACnC;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,GAAE,cAAmB,GAAG,aAAa,CA8FlF;AAwBD,YAAY,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC3E,YAAY,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAG7D,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,331 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @altopelago/aeon-core - AEON Core Package
|
|
3
|
+
*
|
|
4
|
+
* The canonical, safe entry point for AEON processing.
|
|
5
|
+
*
|
|
6
|
+
* Usage:
|
|
7
|
+
* ```ts
|
|
8
|
+
* import { compile } from '@altopelago/aeon-core';
|
|
9
|
+
*
|
|
10
|
+
* const result = compile('key = "value"');
|
|
11
|
+
* if (result.errors.length === 0) {
|
|
12
|
+
* console.log(result.events);
|
|
13
|
+
* }
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
import { tokenize } from '@altopelago/aeon-lexer';
|
|
17
|
+
import { parse, SyntaxError as ParserSyntaxError } from '@altopelago/aeon-parser';
|
|
18
|
+
import { resolvePaths, emitEvents, validateReferences, enforceMode, EventEmissionError, } from '@altopelago/aeon-aes';
|
|
19
|
+
import { buildAnnotationStreamFromSourceAndSpans } from '@altopelago/aeon-annotation-stream';
|
|
20
|
+
export { inspectFilePreamble } from './preamble.js';
|
|
21
|
+
// =============================================================================
|
|
22
|
+
// PUBLIC API
|
|
23
|
+
// =============================================================================
|
|
24
|
+
export const VERSION = '0.9.0';
|
|
25
|
+
export class InputSizeExceededError extends Error {
|
|
26
|
+
code = 'INPUT_SIZE_EXCEEDED';
|
|
27
|
+
actualBytes;
|
|
28
|
+
maxBytes;
|
|
29
|
+
constructor(actualBytes, maxBytes) {
|
|
30
|
+
super(`Input size ${actualBytes} bytes exceeds configured limit of ${maxBytes} bytes`);
|
|
31
|
+
this.name = 'InputSizeExceededError';
|
|
32
|
+
this.actualBytes = actualBytes;
|
|
33
|
+
this.maxBytes = maxBytes;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Compile an AEON document into Assignment Events
|
|
38
|
+
*
|
|
39
|
+
* This is the canonical, safe entry point for AEON processing.
|
|
40
|
+
* It runs all phases (lex → parse → resolve → emit → validate → enforce)
|
|
41
|
+
* and returns a deterministic result.
|
|
42
|
+
*
|
|
43
|
+
* **Fail-closed behavior**: If ANY error occurs in ANY phase,
|
|
44
|
+
* the returned events array will be empty. Errors are always collected
|
|
45
|
+
* and returned for diagnostics.
|
|
46
|
+
*
|
|
47
|
+
* @param input - AEON document source text
|
|
48
|
+
* @param options - Optional compilation settings
|
|
49
|
+
* @returns Compilation result with events and errors
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```ts
|
|
53
|
+
* const result = compile('config = { port = 8080 }');
|
|
54
|
+
* if (result.errors.length === 0) {
|
|
55
|
+
* for (const event of result.events) {
|
|
56
|
+
* console.log(event.path, event.value);
|
|
57
|
+
* }
|
|
58
|
+
* }
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
61
|
+
export function compile(input, options = {}) {
|
|
62
|
+
const allErrors = [];
|
|
63
|
+
const recovery = options.recovery ?? false;
|
|
64
|
+
const maxAttributeDepth = options.maxAttributeDepth ?? 1;
|
|
65
|
+
const maxSeparatorDepth = options.maxSeparatorDepth ?? 1;
|
|
66
|
+
const maxGenericDepth = options.maxGenericDepth ?? 1;
|
|
67
|
+
const maxNestingDepth = options.maxNestingDepth ?? 256;
|
|
68
|
+
const emitAnnotations = options.emitAnnotations ?? true;
|
|
69
|
+
const datatypePolicy = options.datatypePolicy;
|
|
70
|
+
const maxInputBytes = options.maxInputBytes;
|
|
71
|
+
if (maxInputBytes !== undefined) {
|
|
72
|
+
const actualBytes = Buffer.byteLength(input, 'utf8');
|
|
73
|
+
if (actualBytes > maxInputBytes) {
|
|
74
|
+
allErrors.push(new InputSizeExceededError(actualBytes, maxInputBytes));
|
|
75
|
+
return { events: [], errors: allErrors };
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
input = stripLeadingBom(input);
|
|
79
|
+
// Phase 1: Lexing
|
|
80
|
+
const lexResult = tokenize(input, { includeComments: false });
|
|
81
|
+
allErrors.push(...normalizeLexerErrors(input, lexResult.errors));
|
|
82
|
+
if (lexResult.errors.length > 0 && !recovery) {
|
|
83
|
+
return { events: [], errors: allErrors };
|
|
84
|
+
}
|
|
85
|
+
// Phase 2: Parsing
|
|
86
|
+
const parseResult = parse(lexResult.tokens, { maxAttributeDepth, maxSeparatorDepth, maxGenericDepth, maxNestingDepth });
|
|
87
|
+
allErrors.push(...parseResult.errors);
|
|
88
|
+
if (parseResult.errors.length > 0 && !recovery) {
|
|
89
|
+
return { events: [], errors: allErrors };
|
|
90
|
+
}
|
|
91
|
+
if (!parseResult.document) {
|
|
92
|
+
return { events: [], errors: allErrors };
|
|
93
|
+
}
|
|
94
|
+
// Phase 3: Path Resolution
|
|
95
|
+
const resolveResult = resolvePaths(parseResult.document, { indexedPaths: true });
|
|
96
|
+
allErrors.push(...resolveResult.errors);
|
|
97
|
+
if (resolveResult.errors.length > 0 && !recovery) {
|
|
98
|
+
return { events: [], errors: allErrors };
|
|
99
|
+
}
|
|
100
|
+
// Phase 4: Event Emission
|
|
101
|
+
const emitResult = emitEvents(resolveResult, { recovery });
|
|
102
|
+
for (const err of emitResult.errors) {
|
|
103
|
+
if (err instanceof EventEmissionError) {
|
|
104
|
+
allErrors.push(err);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
if (emitResult.errors.length > 0 && !recovery && emitResult.events.length === 0) {
|
|
108
|
+
return { events: [], errors: allErrors };
|
|
109
|
+
}
|
|
110
|
+
// Phase 5: Reference Validation
|
|
111
|
+
const refResult = validateReferences(emitResult.events, { recovery, maxAttributeDepth });
|
|
112
|
+
allErrors.push(...refResult.errors);
|
|
113
|
+
if (refResult.errors.length > 0 && !recovery) {
|
|
114
|
+
return { events: [], errors: allErrors };
|
|
115
|
+
}
|
|
116
|
+
// Phase 6: Mode Enforcement
|
|
117
|
+
const modeResult = enforceMode(refResult.events, parseResult.document.header, {
|
|
118
|
+
recovery,
|
|
119
|
+
...(datatypePolicy ? { datatypePolicy } : {}),
|
|
120
|
+
});
|
|
121
|
+
allErrors.push(...modeResult.errors);
|
|
122
|
+
if (modeResult.errors.length > 0 && !recovery) {
|
|
123
|
+
return { events: [], errors: allErrors };
|
|
124
|
+
}
|
|
125
|
+
const result = {
|
|
126
|
+
events: modeResult.events,
|
|
127
|
+
errors: allErrors,
|
|
128
|
+
...(parseResult.document.header
|
|
129
|
+
? {
|
|
130
|
+
header: {
|
|
131
|
+
fields: parseResult.document.header.fields,
|
|
132
|
+
span: parseResult.document.header.span,
|
|
133
|
+
form: parseResult.document.header.form,
|
|
134
|
+
},
|
|
135
|
+
}
|
|
136
|
+
: {}),
|
|
137
|
+
};
|
|
138
|
+
if (emitAnnotations) {
|
|
139
|
+
const spanTargets = collectSpanTargets(parseResult.document);
|
|
140
|
+
result.annotations =
|
|
141
|
+
buildAnnotationStreamFromSourceAndSpans(input, modeResult.events, spanTargets);
|
|
142
|
+
}
|
|
143
|
+
return result;
|
|
144
|
+
}
|
|
145
|
+
function normalizeLexerErrors(input, errors) {
|
|
146
|
+
return errors.map((error) => {
|
|
147
|
+
if (error.code === 'INVALID_NUMBER') {
|
|
148
|
+
const raw = input.slice(error.span.start.offset, error.span.end.offset);
|
|
149
|
+
if (raw.startsWith('#') || raw.startsWith('$')) {
|
|
150
|
+
return new ParserSyntaxError(`Invalid literal spelling: '${raw}'`, error.span, null, raw);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
return error;
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
// Utility for formatting paths (commonly needed)
|
|
157
|
+
export { formatPath } from '@altopelago/aeon-aes';
|
|
158
|
+
function stripLeadingBom(input) {
|
|
159
|
+
return input.startsWith('\uFEFF') ? input.slice(1) : input;
|
|
160
|
+
}
|
|
161
|
+
function collectSpanTargets(document) {
|
|
162
|
+
const spans = [];
|
|
163
|
+
const seen = new Set();
|
|
164
|
+
const addSpan = (span) => {
|
|
165
|
+
const key = `${span.start.offset}:${span.end.offset}`;
|
|
166
|
+
if (seen.has(key)) {
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
seen.add(key);
|
|
170
|
+
spans.push(span);
|
|
171
|
+
};
|
|
172
|
+
const visitValue = (value) => {
|
|
173
|
+
addSpan(value.span);
|
|
174
|
+
switch (value.type) {
|
|
175
|
+
case 'TypedValue':
|
|
176
|
+
if (value.datatype) {
|
|
177
|
+
addSpan(value.datatype.span);
|
|
178
|
+
}
|
|
179
|
+
for (const attribute of value.attributes) {
|
|
180
|
+
addSpan(attribute.span);
|
|
181
|
+
for (const [, entry] of attribute.entries) {
|
|
182
|
+
for (const nestedAttribute of entry.attributes) {
|
|
183
|
+
addSpan(nestedAttribute.span);
|
|
184
|
+
for (const [, nestedEntry] of nestedAttribute.entries) {
|
|
185
|
+
addSpan(nestedEntry.value.span);
|
|
186
|
+
if (nestedEntry.datatype) {
|
|
187
|
+
addSpan(nestedEntry.datatype.span);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
addSpan(entry.value.span);
|
|
192
|
+
if (entry.datatype) {
|
|
193
|
+
addSpan(entry.datatype.span);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
visitValue(value.value);
|
|
198
|
+
break;
|
|
199
|
+
case 'ObjectNode':
|
|
200
|
+
for (const attribute of value.attributes) {
|
|
201
|
+
addSpan(attribute.span);
|
|
202
|
+
for (const [, entry] of attribute.entries) {
|
|
203
|
+
for (const nestedAttribute of entry.attributes) {
|
|
204
|
+
addSpan(nestedAttribute.span);
|
|
205
|
+
for (const [, nestedEntry] of nestedAttribute.entries) {
|
|
206
|
+
addSpan(nestedEntry.value.span);
|
|
207
|
+
if (nestedEntry.datatype) {
|
|
208
|
+
addSpan(nestedEntry.datatype.span);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
addSpan(entry.value.span);
|
|
213
|
+
if (entry.datatype) {
|
|
214
|
+
addSpan(entry.datatype.span);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
for (const binding of value.bindings) {
|
|
219
|
+
visitBinding(binding);
|
|
220
|
+
}
|
|
221
|
+
break;
|
|
222
|
+
case 'ListNode':
|
|
223
|
+
for (const attribute of value.attributes) {
|
|
224
|
+
addSpan(attribute.span);
|
|
225
|
+
for (const [, entry] of attribute.entries) {
|
|
226
|
+
for (const nestedAttribute of entry.attributes) {
|
|
227
|
+
addSpan(nestedAttribute.span);
|
|
228
|
+
for (const [, nestedEntry] of nestedAttribute.entries) {
|
|
229
|
+
addSpan(nestedEntry.value.span);
|
|
230
|
+
if (nestedEntry.datatype) {
|
|
231
|
+
addSpan(nestedEntry.datatype.span);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
addSpan(entry.value.span);
|
|
236
|
+
if (entry.datatype) {
|
|
237
|
+
addSpan(entry.datatype.span);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
for (const element of value.elements) {
|
|
242
|
+
visitValue(element);
|
|
243
|
+
}
|
|
244
|
+
break;
|
|
245
|
+
case 'TupleLiteral':
|
|
246
|
+
for (const attribute of value.attributes) {
|
|
247
|
+
addSpan(attribute.span);
|
|
248
|
+
for (const [, entry] of attribute.entries) {
|
|
249
|
+
for (const nestedAttribute of entry.attributes) {
|
|
250
|
+
addSpan(nestedAttribute.span);
|
|
251
|
+
for (const [, nestedEntry] of nestedAttribute.entries) {
|
|
252
|
+
addSpan(nestedEntry.value.span);
|
|
253
|
+
if (nestedEntry.datatype) {
|
|
254
|
+
addSpan(nestedEntry.datatype.span);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
addSpan(entry.value.span);
|
|
259
|
+
if (entry.datatype) {
|
|
260
|
+
addSpan(entry.datatype.span);
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
for (const element of value.elements) {
|
|
265
|
+
visitValue(element);
|
|
266
|
+
}
|
|
267
|
+
break;
|
|
268
|
+
case 'NodeLiteral':
|
|
269
|
+
for (const attribute of value.attributes) {
|
|
270
|
+
addSpan(attribute.span);
|
|
271
|
+
for (const [, entry] of attribute.entries) {
|
|
272
|
+
for (const nestedAttribute of entry.attributes) {
|
|
273
|
+
addSpan(nestedAttribute.span);
|
|
274
|
+
for (const [, nestedEntry] of nestedAttribute.entries) {
|
|
275
|
+
addSpan(nestedEntry.value.span);
|
|
276
|
+
if (nestedEntry.datatype) {
|
|
277
|
+
addSpan(nestedEntry.datatype.span);
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
addSpan(entry.value.span);
|
|
282
|
+
if (entry.datatype) {
|
|
283
|
+
addSpan(entry.datatype.span);
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
if (value.datatype) {
|
|
288
|
+
addSpan(value.datatype.span);
|
|
289
|
+
}
|
|
290
|
+
for (const child of value.children) {
|
|
291
|
+
visitValue(child);
|
|
292
|
+
}
|
|
293
|
+
break;
|
|
294
|
+
default:
|
|
295
|
+
break;
|
|
296
|
+
}
|
|
297
|
+
};
|
|
298
|
+
const visitBinding = (binding) => {
|
|
299
|
+
addSpan(binding.span);
|
|
300
|
+
if (binding.datatype) {
|
|
301
|
+
addSpan(binding.datatype.span);
|
|
302
|
+
}
|
|
303
|
+
for (const attribute of binding.attributes) {
|
|
304
|
+
addSpan(attribute.span);
|
|
305
|
+
for (const [, entry] of attribute.entries) {
|
|
306
|
+
addSpan(entry.value.span);
|
|
307
|
+
if (entry.datatype) {
|
|
308
|
+
addSpan(entry.datatype.span);
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
visitValue(binding.value);
|
|
313
|
+
};
|
|
314
|
+
if (document.header) {
|
|
315
|
+
addSpan(document.header.span);
|
|
316
|
+
for (const binding of document.header.bindings) {
|
|
317
|
+
visitBinding(binding);
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
for (const binding of document.bindings) {
|
|
321
|
+
visitBinding(binding);
|
|
322
|
+
}
|
|
323
|
+
if (document.envelope) {
|
|
324
|
+
addSpan(document.envelope.span);
|
|
325
|
+
for (const [, value] of document.envelope.fields) {
|
|
326
|
+
visitValue(value);
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
return spans;
|
|
330
|
+
}
|
|
331
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,QAAQ,EAAmB,MAAM,wBAAwB,CAAC;AACnE,OAAO,EAAE,KAAK,EAAE,WAAW,IAAI,iB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AAI,QAAQ,CAAC,QAAQ,EAAE,CAAC;QACpB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QAChC,KAAK,MAAM,CAAC,EAAE,KAAK,CAAC,IAAI,QAAQ,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;YAC/C,UAAU,CAAC,KAAK,CAAC,CAAC;QACtB,CAAC;IACL,CAAC;IAED,OAAO,KAAK,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Span } from '@altopelago/aeon-lexer';
|
|
2
|
+
export type HostDirectiveKind = 'format' | 'unknown';
|
|
3
|
+
export interface HostDirective {
|
|
4
|
+
readonly raw: string;
|
|
5
|
+
readonly kind: HostDirectiveKind;
|
|
6
|
+
readonly value: string | null;
|
|
7
|
+
}
|
|
8
|
+
export interface FilePreambleInfo {
|
|
9
|
+
readonly shebang: string | null;
|
|
10
|
+
readonly hostDirective: HostDirective | null;
|
|
11
|
+
readonly format: string | null;
|
|
12
|
+
readonly span: {
|
|
13
|
+
readonly shebang?: Span;
|
|
14
|
+
readonly hostDirective?: Span;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export declare function inspectFilePreamble(source: string): FilePreambleInfo;
|
|
18
|
+
//# sourceMappingURL=preamble.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preamble.d.ts","sourceRoot":"","sources":["../src/preamble.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAEnD,MAAM,MAAM,iBAAiB,GAAG,QAAQ,GAAG,SAAS,CAAC;AAErD,MAAM,WAAW,aAAa;IAC1B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,IAAI,EAAE,iBAAiB,CAAC;IACjC,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACjC;AAED,MAAM,WAAW,gBAAgB;IAC7B,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,QAAQ,CAAC,aAAa,EAAE,aAAa,GAAG,IAAI,CAAC;IAC7C,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,QAAQ,CAAC,IAAI,EAAE;QACX,QAAQ,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC;QACxB,QAAQ,CAAC,aAAa,CAAC,EAAE,IAAI,CAAC;KACjC,CAAC;CACL;AAQD,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,gBAAgB,CA+CpE"}
|
package/dist/preamble.js
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
export function inspectFilePreamble(source) {
|
|
2
|
+
source = stripLeadingBom(source);
|
|
3
|
+
const firstLine = readLine(source, 0, 1);
|
|
4
|
+
if (!firstLine) {
|
|
5
|
+
return { shebang: null, hostDirective: null, format: null, span: {} };
|
|
6
|
+
}
|
|
7
|
+
let shebang = null;
|
|
8
|
+
let shebangSpan;
|
|
9
|
+
let hostDirectiveLine = null;
|
|
10
|
+
if (firstLine.raw.startsWith('#!')) {
|
|
11
|
+
shebang = firstLine.raw;
|
|
12
|
+
shebangSpan = firstLine.span;
|
|
13
|
+
hostDirectiveLine = readLine(source, firstLine.nextOffset, 2);
|
|
14
|
+
}
|
|
15
|
+
else if (firstLine.raw.startsWith('//!')) {
|
|
16
|
+
hostDirectiveLine = firstLine;
|
|
17
|
+
}
|
|
18
|
+
if (!hostDirectiveLine && shebangSpan) {
|
|
19
|
+
const secondLine = readLine(source, firstLine.nextOffset, 2);
|
|
20
|
+
if (secondLine && secondLine.raw.startsWith('//!')) {
|
|
21
|
+
hostDirectiveLine = secondLine;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
let hostDirective = null;
|
|
25
|
+
let format = null;
|
|
26
|
+
let hostDirectiveSpan;
|
|
27
|
+
if (hostDirectiveLine && hostDirectiveLine.raw.startsWith('//!')) {
|
|
28
|
+
hostDirective = parseHostDirective(hostDirectiveLine.raw);
|
|
29
|
+
hostDirectiveSpan = hostDirectiveLine.span;
|
|
30
|
+
if (hostDirective.kind === 'format') {
|
|
31
|
+
format = hostDirective.value;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return {
|
|
35
|
+
shebang,
|
|
36
|
+
hostDirective,
|
|
37
|
+
format,
|
|
38
|
+
span: {
|
|
39
|
+
...(shebangSpan ? { shebang: shebangSpan } : {}),
|
|
40
|
+
...(hostDirectiveSpan ? { hostDirective: hostDirectiveSpan } : {}),
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
function stripLeadingBom(source) {
|
|
45
|
+
return source.startsWith('\uFEFF') ? source.slice(1) : source;
|
|
46
|
+
}
|
|
47
|
+
function parseHostDirective(raw) {
|
|
48
|
+
const formatPrefix = '//! format:';
|
|
49
|
+
if (raw.startsWith(formatPrefix)) {
|
|
50
|
+
const value = raw.slice(formatPrefix.length).trim();
|
|
51
|
+
return {
|
|
52
|
+
raw,
|
|
53
|
+
kind: 'format',
|
|
54
|
+
value: value.length > 0 ? value : null,
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
return {
|
|
58
|
+
raw,
|
|
59
|
+
kind: 'unknown',
|
|
60
|
+
value: null,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
function readLine(source, offset, line) {
|
|
64
|
+
let startOffset = offset;
|
|
65
|
+
if (startOffset >= source.length) {
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
if (line > 1 && source[startOffset] === '\n') {
|
|
69
|
+
startOffset += 1;
|
|
70
|
+
}
|
|
71
|
+
if (startOffset >= source.length) {
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
let endOffset = startOffset;
|
|
75
|
+
while (endOffset < source.length && source[endOffset] !== '\n') {
|
|
76
|
+
endOffset += 1;
|
|
77
|
+
}
|
|
78
|
+
let rawEndOffset = endOffset;
|
|
79
|
+
if (rawEndOffset > startOffset && source[rawEndOffset - 1] === '\r') {
|
|
80
|
+
rawEndOffset -= 1;
|
|
81
|
+
}
|
|
82
|
+
return {
|
|
83
|
+
raw: source.slice(startOffset, rawEndOffset),
|
|
84
|
+
span: {
|
|
85
|
+
start: { line, column: 1, offset: startOffset },
|
|
86
|
+
end: { line, column: rawEndOffset - startOffset + 1, offset: rawEndOffset },
|
|
87
|
+
},
|
|
88
|
+
nextOffset: endOffset < source.length ? endOffset + 1 : endOffset,
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=preamble.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preamble.js","sourceRoot":"","sources":["../src/preamble.ts"],"names":[],"mappings":"AA0BA,MAAM,UAAU,mBAAmB,CAAC,MAAc;IAC9C,MAAM,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC;IACjC,MAAM,SAAS,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IACzC,IAAI,CAAC,SAAS,EAAE,CAAC;QACb,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC;IAC1E,CAAC;IAED,IAAI,OAAO,GAAkB,IAAI,CAAC;IAClC,IAAI,WAA6B,CAAC;IAClC,IAAI,iBAAiB,GAAoB,IAAI,CAAC;IAE9C,IAAI,SAAS,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;QACjC,OAAO,GAAG,SAAS,CAAC,GAAG,CAAC;QACxB,WAAW,GAAG,SAAS,CAAC,IAAI,CAAC;QAC7B,iBAAiB,GAAG,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC;IAClE,CAAC;SAAM,IAAI,SAAS,CAAC,GAAG,CAAC,UAAU,CA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AC;IACtB,CAAC;IAED,OAAO;QACH,GAAG,EAAE,MAAM,CAAC,KAAK,CAAC,WAAW,EAAE,YAAY,CAAC;QAC5C,IAAI,EAAE;YACF,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,WAAW,EAAE;YAC/C,GAAG,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,YAAY,GAAG,WAAW,GAAG,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE;SAC9E;QACD,UAAU,EAAE,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS;KACpE,CAAC;AACN,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@altopelago/aeon-core",
|
|
3
|
+
"version": "0.9.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"types": "./dist/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"import": "./dist/index.js"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"dist",
|
|
15
|
+
"!dist/**/*.test.d.ts",
|
|
16
|
+
"!dist/**/*.test.d.ts.map",
|
|
17
|
+
"!dist/**/*.test.js",
|
|
18
|
+
"!dist/**/*.test.js.map"
|
|
19
|
+
],
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"@altopelago/aeon-lexer": "0.9.0",
|
|
22
|
+
"@altopelago/aeon-aes": "0.9.0",
|
|
23
|
+
"@altopelago/aeon-annotation-stream": "0.9.0",
|
|
24
|
+
"@altopelago/aeon-parser": "0.9.0"
|
|
25
|
+
},
|
|
26
|
+
"scripts": {
|
|
27
|
+
"build": "tsc -p tsconfig.json",
|
|
28
|
+
"test": "node --test dist/*.test.js",
|
|
29
|
+
"clean": "rm -rf dist",
|
|
30
|
+
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
31
|
+
}
|
|
32
|
+
}
|