@shapeshift-labs/frontier-lang-parser 0.3.38 → 0.3.40

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 CHANGED
@@ -88,6 +88,7 @@ The published Frontier package family is generated from one shared package catal
88
88
  - [`@shapeshift-labs/frontier-dnd`](https://www.npmjs.com/package/@shapeshift-labs/frontier-dnd): Renderer-neutral drag-and-drop sessions, sensor descriptors, collision ranking, drop planning, reorder patches, state partitioning, and registry evidence for Frontier apps.
89
89
  - [`@shapeshift-labs/frontier-dom`](https://www.npmjs.com/package/@shapeshift-labs/frontier-dom): Patch-native DOM and host renderer bindings, manifest hydration, JSX runtime/compiler helpers, SSR, devtools, and logging bridges.
90
90
  - [`@shapeshift-labs/frontier-playwright`](https://www.npmjs.com/package/@shapeshift-labs/frontier-playwright): Playwright/headless automation probes for Frontier state, DOM, devtools, marks, and timeline queries.
91
+ - [`@shapeshift-labs/frontier-annotations`](https://www.npmjs.com/package/@shapeshift-labs/frontier-annotations): Browser harness DOM annotation overlay, selected-node targeting records, CSS/source-hint capture, AST/source graph context ranking, and Codex/frontier-swarm task planning for AI-operable UI fixes.
91
92
  - [`@shapeshift-labs/frontier-test`](https://www.npmjs.com/package/@shapeshift-labs/frontier-test): Serializable test/spec evidence manifests for Frontier apps, including fixtures, commands, expected patches/effects/routes/policies, coverage declarations, run plans, run records, report adapters, replay proofs, fuzzers, benchmarks, registry graph output, and impact queries.
92
93
  - [`@shapeshift-labs/frontier-fixtures`](https://www.npmjs.com/package/@shapeshift-labs/frontier-fixtures): Deterministic fixture and scenario generation for Frontier apps, including schema-valid sample state, related entity collections, actor personas, route states, replay-verified patch streams, event records, JSONL bundles, and evidence summaries.
93
94
  - [`@shapeshift-labs/frontier-component-preview`](https://www.npmjs.com/package/@shapeshift-labs/frontier-component-preview): Frontier-native component preview books, generated preview manifests, stateful variants, Vite virtual modules, standalone browser preview shells, inspector bridges, and preview harness evidence for Frontier apps.
@@ -192,6 +193,7 @@ Package source repositories:
192
193
  - [`siliconjungle/-shapeshift-labs-frontier-dnd`](https://github.com/siliconjungle/-shapeshift-labs-frontier-dnd)
193
194
  - [`siliconjungle/-shapeshift-labs-frontier-dom`](https://github.com/siliconjungle/-shapeshift-labs-frontier-dom)
194
195
  - [`siliconjungle/-shapeshift-labs-frontier-playwright`](https://github.com/siliconjungle/-shapeshift-labs-frontier-playwright)
196
+ - [`siliconjungle/-shapeshift-labs-frontier-annotations`](https://github.com/siliconjungle/-shapeshift-labs-frontier-annotations)
195
197
  - [`siliconjungle/-shapeshift-labs-frontier-test`](https://github.com/siliconjungle/-shapeshift-labs-frontier-test)
196
198
  - [`siliconjungle/-shapeshift-labs-frontier-fixtures`](https://github.com/siliconjungle/-shapeshift-labs-frontier-fixtures)
197
199
  - [`siliconjungle/-shapeshift-labs-frontier-component-preview`](https://github.com/siliconjungle/-shapeshift-labs-frontier-component-preview)
@@ -0,0 +1,43 @@
1
+ export function mergeConversionBlocks(blocks) {
2
+ const plan = {
3
+ id: blocks.length === 1 ? blocks[0].id : 'universalConversionPlan:source',
4
+ targets: [...new Set(blocks.flatMap((block) => block.targets ?? []))],
5
+ metadata: { authoredConversionBlockIds: blocks.map((block) => block.id) }
6
+ };
7
+ for (const block of blocks) {
8
+ if (block.sourceLanguage && !plan.sourceLanguage) plan.sourceLanguage = block.sourceLanguage;
9
+ for (const [key, value] of Object.entries(block)) {
10
+ if (Array.isArray(value) && key !== 'targets') plan[key] = [...(plan[key] ?? []), ...value];
11
+ else if ((key === 'sourceRuntimes' || key === 'targetRuntimes') && value && typeof value === 'object') {
12
+ plan[key] = { ...(plan[key] ?? {}), ...value };
13
+ }
14
+ }
15
+ }
16
+ plan.evidenceIds = ids(plan.evidence);
17
+ plan.summary = {
18
+ evidenceCount: plan.evidence?.length ?? 0,
19
+ runtimeRequirementCount: plan.runtimeRequirements?.length ?? 0,
20
+ dialectCount: plan.dialects?.length ?? 0,
21
+ externCount: plan.externs?.length ?? 0,
22
+ constraintCount: conversionConstraintCount(plan)
23
+ };
24
+ plan.claims = {
25
+ autoMergeClaim: false,
26
+ semanticEquivalenceClaim: false,
27
+ conversionEquivalenceClaim: false,
28
+ runtimeEquivalenceClaim: false
29
+ };
30
+ return plan;
31
+ }
32
+
33
+ function ids(records = []) {
34
+ return records.map((record) => record?.id).filter(Boolean);
35
+ }
36
+
37
+ function conversionConstraintCount(plan) {
38
+ return Object.entries(plan).reduce((total, [key, value]) => {
39
+ if (!Array.isArray(value)) return total;
40
+ if (key.endsWith('Constraints') || key === 'resourceTransfers') return total + value.length;
41
+ return total;
42
+ }, 0);
43
+ }
@@ -13,6 +13,7 @@ export function parseConversionBlock(block) {
13
13
  const runtimeRequirement = /^(?:runtimeRequirement|requiredRuntime|requiresRuntime)\s+([A-Za-z_$][\w$-]*)(.*)$/.exec(line);
14
14
  const dialect = /^dialect\s+([A-Za-z_$][\w$-]*)(.*)$/.exec(line);
15
15
  const extern = /^extern\s+([A-Za-z_$][\w$-]*)(.*)$/.exec(line);
16
+ const evidence = /^(?:evidence|proofEvidence)\s+([A-Za-z_$][\w$-]*)(.*)$/.exec(line);
16
17
  const constraint = /^constraint\s+([A-Za-z_$][\w$-]*)\s+([A-Za-z_$][\w$-]*)(.*)$/.exec(line);
17
18
  if (target) plan.targets.push(target);
18
19
  else if (sourceLanguage) plan.sourceLanguage = sourceLanguage;
@@ -21,11 +22,35 @@ export function parseConversionBlock(block) {
21
22
  else if (runtimeRequirement) addRuntimeRequirement(plan, runtimeRequirement[1], runtimeRequirement[2]);
22
23
  else if (dialect) addDialectRecord(plan, dialect[1], dialect[2], false);
23
24
  else if (extern) addDialectRecord(plan, extern[1], extern[2], true);
25
+ else if (evidence) addEvidenceRecord(plan, evidence[1], evidence[2], authoredLine);
24
26
  else if (constraint) addConstraint(plan, constraint[1], constraint[2], constraint[3], authoredLine);
25
27
  }
26
28
  return cleanRecord({ ...plan, targets: unique(plan.targets) });
27
29
  }
28
30
 
31
+ function addEvidenceRecord(plan, name, text, authoredLine = {}) {
32
+ plan.evidence = [...(plan.evidence ?? []), cleanRecord({
33
+ id: idFrom(text, `conversion_evidence_${name}`),
34
+ name,
35
+ kind: readInlineWord('kind', text) ?? 'conversion-route-evidence',
36
+ status: readInlineWord('status', text) ?? 'unknown',
37
+ sourceLanguage: readInlineWord('sourceLanguage', text) ?? readInlineWord('language', text) ?? plan.sourceLanguage,
38
+ target: readInlineWord('target', text) ?? readInlineWord('targetLanguage', text) ?? plan.targets[0],
39
+ routeId: readInlineWord('routeId', text) ?? readInlineWord('route', text),
40
+ path: readInlineWord('path', text) ?? readInlineWord('report', text),
41
+ command: readInlineQuoted('command', text) ?? readInlineWord('command', text),
42
+ probeId: readInlineWord('probeId', text) ?? readInlineWord('probe', text),
43
+ sourceHash: readInlineWord('sourceHash', text),
44
+ targetHash: readInlineWord('targetHash', text),
45
+ telemetryHash: readInlineWord('telemetryHash', text),
46
+ proofEvidenceIds: readInlineList(text, 'proofEvidence', 'proofEvidenceId', 'proofEvidenceIds', 'proof'),
47
+ summary: readInlineQuoted('summary', text),
48
+ sourceSpan: authoredLine.sourceSpan,
49
+ authoredSourceSpan: authoredLine.sourceSpan,
50
+ metadata: { authoredConversionBlockId: plan.id, autoMergeClaim: false, semanticEquivalenceClaim: false }
51
+ })];
52
+ }
53
+
29
54
  function addRuntimeRequirement(plan, name, text) {
30
55
  plan.runtimeRequirements = [...(plan.runtimeRequirements ?? []), cleanRecord({
31
56
  id: idFrom(text, `runtime_requirement_${name}`),
package/dist/index.d.ts CHANGED
@@ -22,11 +22,14 @@ export interface FrontierSourceSyntaxDiagnostic {
22
22
  readonly location: FrontierSourcePosition;
23
23
  }
24
24
  export interface FrontierSourceChildSyntaxRecord {
25
- readonly kind: 'conversionConstraint';
25
+ readonly kind: 'conversionConstraint' | 'conversionEvidence' | 'conversionRuntimeRequirement' | 'conversionDialect' | 'conversionExtern' | 'conversionUnknownRow' | string;
26
+ readonly rowKind?: string;
27
+ readonly normalizedRowKind?: string;
26
28
  readonly name: string;
27
29
  readonly id?: string;
28
30
  readonly family?: string;
29
31
  readonly role?: string;
32
+ readonly reason?: string;
30
33
  readonly header: string;
31
34
  readonly startOffset: number;
32
35
  readonly endOffset: number;
@@ -60,6 +63,10 @@ export interface FrontierUnknownSourceBlockSyntaxRecord extends FrontierSourceBl
60
63
  readonly recognized: false;
61
64
  readonly reason: 'unsupported-top-level-block';
62
65
  }
66
+ export interface FrontierUnknownSourceChildSyntaxRecord extends FrontierSourceChildSyntaxRecord {
67
+ readonly recognized: false;
68
+ readonly reason: string;
69
+ }
63
70
  export interface FrontierSourceSyntaxReport {
64
71
  readonly kind: 'frontier.lang.sourceSyntaxReport';
65
72
  readonly version: 1;
@@ -68,10 +75,12 @@ export interface FrontierSourceSyntaxReport {
68
75
  readonly blocks: readonly FrontierSourceBlockSyntaxRecord[];
69
76
  readonly recognizedBlocks: readonly FrontierSourceBlockSyntaxRecord[];
70
77
  readonly unknownBlocks: readonly FrontierUnknownSourceBlockSyntaxRecord[];
78
+ readonly unknownChildren: readonly FrontierUnknownSourceChildSyntaxRecord[];
71
79
  readonly summary: {
72
80
  readonly blockCount: number;
73
81
  readonly recognizedBlockCount: number;
74
82
  readonly unknownBlockCount: number;
83
+ readonly unknownChildCount: number;
75
84
  readonly malformedBlockCount: number;
76
85
  readonly childCount: number;
77
86
  readonly recognizedChildCount: number;
@@ -79,6 +88,7 @@ export interface FrontierSourceSyntaxReport {
79
88
  readonly recognizedKinds: readonly string[];
80
89
  readonly recognizedChildKinds: readonly string[];
81
90
  readonly unknownKinds: readonly string[];
91
+ readonly unknownChildKinds: readonly string[];
82
92
  readonly failClosed: boolean;
83
93
  readonly unsupportedSyntax: boolean;
84
94
  };
package/dist/metadata.js CHANGED
@@ -2,6 +2,7 @@ import { mergeDialectRegistryBlocks } from './dialect-registry.js';
2
2
  import { mergeApplicationSurfaceBlocks } from './application-surface.js';
3
3
  import { mergeRuntimeCapabilityBlocks } from './runtime-capability.js';
4
4
  import { mergeTargetProjectionTargets } from './target-projection-aggregate.js';
5
+ import { mergeConversionBlocks } from './conversion-metadata.js';
5
6
 
6
7
  const PROOF_GROUPS = ['contracts', 'refinements', 'invariants', 'termination', 'temporal', 'obligations', 'artifacts', 'assumptions'];
7
8
  const PARADIGM_GROUPS = [
@@ -61,24 +62,6 @@ function mergeOperationBlocks(blocks) {
61
62
  };
62
63
  }
63
64
 
64
- function mergeConversionBlocks(blocks) {
65
- const plan = {
66
- id: blocks.length === 1 ? blocks[0].id : 'universalConversionPlan:source',
67
- targets: [...new Set(blocks.flatMap((block) => block.targets ?? []))],
68
- metadata: { authoredConversionBlockIds: blocks.map((block) => block.id) }
69
- };
70
- for (const block of blocks) {
71
- if (block.sourceLanguage && !plan.sourceLanguage) plan.sourceLanguage = block.sourceLanguage;
72
- for (const [key, value] of Object.entries(block)) {
73
- if (Array.isArray(value) && key !== 'targets') plan[key] = [...(plan[key] ?? []), ...value];
74
- else if ((key === 'sourceRuntimes' || key === 'targetRuntimes') && value && typeof value === 'object') {
75
- plan[key] = { ...(plan[key] ?? {}), ...value };
76
- }
77
- }
78
- }
79
- return plan;
80
- }
81
-
82
65
  function mergeConstraintSpaceBlocks(blocks) {
83
66
  return {
84
67
  id: blocks.length === 1 ? blocks[0].id : 'constraintSpaces:source',
@@ -1,8 +1,14 @@
1
+ import { ROW_SYNTAX_CONFIG } from './source-syntax-row-config.js';
2
+
3
+ const ROW_NAME_PATTERN = '([A-Za-z_$@./:*+-][\\w$./@:*+-]*)';
4
+
1
5
  export function readSourceSyntaxChildren(source, block, options = {}) {
2
6
  if (block.malformed) return [];
3
7
  if (block.kind === 'conversion' || block.kind === 'universalConversionPlan') {
4
8
  return readConversionSyntaxChildren(source, block, options);
5
9
  }
10
+ const rowConfig = ROW_SYNTAX_CONFIG[block.kind];
11
+ if (rowConfig) return readGenericRowSyntaxChildren(source, block, options, rowConfig);
6
12
  return [];
7
13
  }
8
14
 
@@ -10,15 +16,104 @@ function readConversionSyntaxChildren(source, block, options) {
10
16
  const children = [];
11
17
  for (const line of readBodyLines(source, block)) {
12
18
  if (!line.text || line.text.startsWith('#')) continue;
19
+ const planField = /^(?:sourceLanguage|source|target|sourceRuntime|targetRuntime)\s+/.exec(line.text);
20
+ if (planField) continue;
21
+ const runtimeRequirement = /^(runtimeRequirement|requiredRuntime|requiresRuntime)\s+([A-Za-z_$][\w$-]*)(.*)$/.exec(line.text);
22
+ if (runtimeRequirement) {
23
+ const [, rowKind, name, rest] = runtimeRequirement;
24
+ children.push(conversionChild(source, block, options, line, {
25
+ kind: 'conversionRuntimeRequirement',
26
+ rowKind,
27
+ normalizedRowKind: 'runtimeRequirement',
28
+ name,
29
+ id: idFrom(rest, `runtime_requirement_${name}`)
30
+ }));
31
+ continue;
32
+ }
33
+ const dialect = /^(dialect|extern)\s+([A-Za-z_$][\w$-]*)(.*)$/.exec(line.text);
34
+ if (dialect) {
35
+ const [, rowKind, name, rest] = dialect;
36
+ children.push(conversionChild(source, block, options, line, {
37
+ kind: rowKind === 'extern' ? 'conversionExtern' : 'conversionDialect',
38
+ rowKind,
39
+ normalizedRowKind: rowKind,
40
+ name,
41
+ id: idFrom(rest, `${rowKind}_${name}`)
42
+ }));
43
+ continue;
44
+ }
45
+ const evidence = /^(evidence|proofEvidence)\s+([A-Za-z_$][\w$-]*)(.*)$/.exec(line.text);
46
+ if (evidence) {
47
+ const [, rowKind, name, rest] = evidence;
48
+ children.push(conversionChild(source, block, options, line, {
49
+ kind: 'conversionEvidence',
50
+ rowKind,
51
+ normalizedRowKind: 'evidence',
52
+ name,
53
+ id: idFrom(rest, `conversion_evidence_${name}`)
54
+ }));
55
+ continue;
56
+ }
13
57
  const constraint = /^constraint\s+([A-Za-z_$][\w$-]*)\s+([A-Za-z_$][\w$-]*)(.*)$/.exec(line.text);
14
- if (!constraint) continue;
58
+ if (!constraint) {
59
+ const row = /^([A-Za-z_$][\w$-]*)\b/.exec(line.text);
60
+ children.push(conversionChild(source, block, options, line, {
61
+ kind: 'conversionUnknownRow',
62
+ rowKind: row?.[1],
63
+ normalizedRowKind: 'unknown',
64
+ name: row?.[1] ?? 'unknown',
65
+ id: `conversion_unknown_${safeId(row?.[1] ?? 'row')}_${line.startOffset}`,
66
+ reason: 'unsupported-conversion-row',
67
+ recognized: false
68
+ }));
69
+ continue;
70
+ }
15
71
  const [, family, name, rest] = constraint;
16
- children.push(cleanRecord({
72
+ children.push(conversionChild(source, block, options, line, {
17
73
  kind: 'conversionConstraint',
18
74
  name,
19
75
  id: idFrom(rest, `conversion_constraint_${family}_${name}`),
20
76
  family,
21
77
  role: readInlineWord('role', rest) ?? 'source',
78
+ recognized: true
79
+ }));
80
+ }
81
+ return children;
82
+ }
83
+
84
+ function conversionChild(source, block, options, line, child) {
85
+ return cleanRecord({
86
+ header: line.text,
87
+ startOffset: line.startOffset,
88
+ endOffset: line.endOffset,
89
+ location: sourcePosition(source, line.startOffset),
90
+ parentKind: block.kind,
91
+ parentId: block.id,
92
+ parentName: block.name,
93
+ moduleId: block.moduleId,
94
+ moduleName: block.moduleName,
95
+ sourceSpan: sourceSpan(source, block, line.startOffset, line.endOffset, options),
96
+ recognized: true,
97
+ ...child
98
+ });
99
+ }
100
+
101
+ function readGenericRowSyntaxChildren(source, block, options, config) {
102
+ const children = [];
103
+ const rowPattern = new RegExp('^([A-Za-z_$][\\w$-]*)\\s+' + ROW_NAME_PATTERN + '(.*)$');
104
+ for (const line of readBodyLines(source, block)) {
105
+ if (!line.text || line.text.startsWith('#')) continue;
106
+ const row = rowPattern.exec(line.text);
107
+ if (!row) continue;
108
+ const [, rowKind, name, rest] = row;
109
+ if (!config.rowKinds.has(rowKind)) continue;
110
+ const normalizedRowKind = config.normalize?.(rowKind) ?? rowKind;
111
+ children.push(cleanRecord({
112
+ kind: config.childKind,
113
+ rowKind,
114
+ normalizedRowKind,
115
+ name,
116
+ id: idFrom(rest, `${config.idPrefix}_${safeId(normalizedRowKind)}_${safeId(name)}`),
22
117
  header: line.text,
23
118
  startOffset: line.startOffset,
24
119
  endOffset: line.endOffset,
@@ -72,6 +167,7 @@ function sourceSpan(source, block, startOffset, endOffset, options = {}) {
72
167
 
73
168
  function idFrom(header, fallback) { return /@id\(\s*["']([^"']+)["']\s*\)/.exec(header)?.[1] ?? fallback; }
74
169
  function readInlineWord(label, text) { return new RegExp('(?:^|\\s)' + label + '\\s+([^\\s,]+)').exec(text)?.[1]?.trim(); }
170
+ function safeId(value) { return String(value).replace(/[^A-Za-z0-9_$-]+/g, '_').replace(/^_+|_+$/g, '') || 'row'; }
75
171
  function cleanRecord(record) {
76
172
  return Object.fromEntries(Object.entries(record).filter(([, value]) => value !== undefined && (!Array.isArray(value) || value.length > 0)));
77
173
  }
@@ -23,6 +23,10 @@ export function inspectFrontierSourceSyntax(source, options = {}) {
23
23
  reason: 'unsupported-top-level-block'
24
24
  }));
25
25
  const childRecords = blocks.flatMap((block) => block.children ?? []);
26
+ const unknownChildren = childRecords.filter((child) => !child.recognized).map((child) => ({
27
+ ...child,
28
+ reason: child.reason ?? 'unsupported-child-syntax'
29
+ }));
26
30
  const malformedBlockOpenOffsets = new Set(blocks.filter((block) => block.malformed).map((block) => block.bodyStartOffset - 1));
27
31
  const diagnostics = [
28
32
  ...blocks.flatMap((block) => block.diagnostics ?? []),
@@ -38,7 +42,7 @@ export function inspectFrontierSourceSyntax(source, options = {}) {
38
42
  }))
39
43
  ];
40
44
  const malformedBlocks = blocks.filter((block) => block.malformed);
41
- const failClosed = unknownBlocks.length > 0 || diagnostics.length > 0;
45
+ const failClosed = unknownBlocks.length > 0 || unknownChildren.length > 0 || diagnostics.length > 0;
42
46
  return {
43
47
  kind: 'frontier.lang.sourceSyntaxReport',
44
48
  version: 1,
@@ -47,10 +51,12 @@ export function inspectFrontierSourceSyntax(source, options = {}) {
47
51
  blocks,
48
52
  recognizedBlocks,
49
53
  unknownBlocks,
54
+ unknownChildren,
50
55
  summary: {
51
56
  blockCount: blocks.length,
52
57
  recognizedBlockCount: recognizedBlocks.length,
53
58
  unknownBlockCount: unknownBlocks.length,
59
+ unknownChildCount: unknownChildren.length,
54
60
  malformedBlockCount: malformedBlocks.length,
55
61
  childCount: childRecords.length,
56
62
  recognizedChildCount: childRecords.filter((child) => child.recognized).length,
@@ -58,8 +64,9 @@ export function inspectFrontierSourceSyntax(source, options = {}) {
58
64
  recognizedKinds: unique(recognizedBlocks.map((block) => block.kind)),
59
65
  recognizedChildKinds: unique(childRecords.filter((child) => child.recognized).map((child) => child.kind)),
60
66
  unknownKinds: unique(unknownBlocks.map((block) => block.kind)),
67
+ unknownChildKinds: unique(unknownChildren.map((child) => child.rowKind ?? child.kind)),
61
68
  failClosed,
62
- unsupportedSyntax: unknownBlocks.length > 0
69
+ unsupportedSyntax: unknownBlocks.length > 0 || unknownChildren.length > 0
63
70
  },
64
71
  diagnostics,
65
72
  metadata: {
@@ -0,0 +1,133 @@
1
+ const appRows = words('mount provide provides required requires require route event asset gate gap proofGap evidence proofEvidence');
2
+ const canvasRows = words('element command state stateWrite trace gap proofGap evidence proofEvidence');
3
+ const constraintRows = words('variable var constraint hard soft preference prefer collapse admission');
4
+ const dialectRows = words('dialect record extern');
5
+ const interlinguaRows = words('layer constraint edge obligation proofObligation proof lowering lower source sourceLift lift evidence');
6
+ const packageRows = words('metadata dependency script export gap proofGap evidence proofEvidence');
7
+ const runtimeRows = words('host runtimeHost hostProfile sourceHost targetHost capability hostCapability hostBinding binding requirement runtimeRequirement requiredRuntime evidence proofEvidence gap proofGap');
8
+
9
+ export const ROW_SYNTAX_CONFIG = Object.freeze({
10
+ interlingua: rowConfig('interlinguaRow', 'interlingua_row', interlinguaRows, normalizeInterlinguaRow),
11
+ universalInterlingua: rowConfig('interlinguaRow', 'interlingua_row', interlinguaRows, normalizeInterlinguaRow),
12
+ dialectRegistry: rowConfig('dialectRegistryRow', 'dialect_registry_row', dialectRows, normalizeDialectRegistryRow),
13
+ universalDialectRegistry: rowConfig('dialectRegistryRow', 'dialect_registry_row', dialectRows, normalizeDialectRegistryRow),
14
+ runtimeCapabilities: rowConfig('runtimeCapabilityRow', 'runtime_capability_row', runtimeRows, normalizeRuntimeCapabilityRow),
15
+ runtimeCapabilityMatrix: rowConfig('runtimeCapabilityRow', 'runtime_capability_row', runtimeRows, normalizeRuntimeCapabilityRow),
16
+ runtimeHosts: rowConfig('runtimeCapabilityRow', 'runtime_capability_row', runtimeRows, normalizeRuntimeCapabilityRow),
17
+ resourceGraph: rowConfig('resourceGraphRow', 'resource_graph_row', words('resource owner loan alias move drop escape lifetime lifetimeRegion life outlives lifetimeRelation lifeRelation borrow borrowScope borrowRegion unsafe unsafeBoundary conflict proof proofObligation obligation'), normalizeResourceGraphRow),
18
+ semanticResourceGraph: rowConfig('resourceGraphRow', 'resource_graph_row', words('resource owner loan alias move drop escape lifetime lifetimeRegion life outlives lifetimeRelation lifeRelation borrow borrowScope borrowRegion unsafe unsafeBoundary conflict proof proofObligation obligation'), normalizeResourceGraphRow),
19
+ applicationSurface: rowConfig('applicationSurfaceRow', 'application_surface_row', appRows, normalizeApplicationSurfaceRow),
20
+ appHost: rowConfig('applicationSurfaceRow', 'application_surface_row', appRows, normalizeApplicationSurfaceRow),
21
+ plugin: rowConfig('applicationSurfaceRow', 'application_surface_row', appRows, normalizeApplicationSurfaceRow),
22
+ pluginSurface: rowConfig('applicationSurfaceRow', 'application_surface_row', appRows, normalizeApplicationSurfaceRow),
23
+ pluginContract: rowConfig('applicationSurfaceRow', 'application_surface_row', appRows, normalizeApplicationSurfaceRow),
24
+ target: rowConfig('targetProjectionRow', 'target_projection_row', words('projection lowering layer')),
25
+ packageManifest: rowConfig('packageManifestRow', 'package_manifest_row', packageRows, normalizeProofEvidenceRows),
26
+ packageGraph: rowConfig('packageManifestRow', 'package_manifest_row', packageRows, normalizeProofEvidenceRows),
27
+ packageSurface: rowConfig('packageManifestRow', 'package_manifest_row', packageRows, normalizeProofEvidenceRows),
28
+ canvasSurface: rowConfig('canvasSurfaceRow', 'canvas_surface_row', canvasRows, normalizeCanvasSurfaceRow),
29
+ canvasGraph: rowConfig('canvasSurfaceRow', 'canvas_surface_row', canvasRows, normalizeCanvasSurfaceRow),
30
+ constraintSpace: rowConfig('constraintSpaceRow', 'constraint_space_row', constraintRows, normalizeConstraintSpaceRow),
31
+ possibilitySpace: rowConfig('constraintSpaceRow', 'constraint_space_row', constraintRows, normalizeConstraintSpaceRow),
32
+ decisionGraph: rowConfig('decisionGraphRow', 'decision_graph_row', words('node edge chunk gate evidence semanticChange change patchEvent patch admissionDecision admission candidateDecision candidate mergeDecision merge replay tournament tournamentCandidate panelProjection panel rsiLoop improvementFeedback feedback'), normalizeDecisionGraphRow),
33
+ admissionGraph: rowConfig('decisionGraphRow', 'decision_graph_row', words('node edge chunk gate evidence semanticChange change patchEvent patch admissionDecision admission candidateDecision candidate mergeDecision merge replay tournament tournamentCandidate panelProjection panel rsiLoop improvementFeedback feedback'), normalizeDecisionGraphRow),
34
+ operations: rowConfig('semanticOperationRow', 'semantic_operation_row', words('operation op'), normalizeOperationRow),
35
+ semanticOperations: rowConfig('semanticOperationRow', 'semantic_operation_row', words('operation op'), normalizeOperationRow),
36
+ paradigm: rowConfig('paradigmRow', 'paradigm_row', words('valueSemantics mutationModel effectModel ownership ownershipModel lifetime lifetimeModel bindingScope binding dispatch typeModel moduleModel concurrency errorModel memoryModel evaluation metaprogramming interop lowering'), normalizeParadigmRow),
37
+ paradigmSemantics: rowConfig('paradigmRow', 'paradigm_row', words('valueSemantics mutationModel effectModel ownership ownershipModel lifetime lifetimeModel bindingScope binding dispatch typeModel moduleModel concurrency errorModel memoryModel evaluation metaprogramming interop lowering'), normalizeParadigmRow),
38
+ proof: rowConfig('proofRow', 'proof_row', words('contract refinement invariant termination temporal obligation artifact assumption')),
39
+ nativeSource: rowConfig('nativeSourceRow', 'native_source_row', words('loss evidence proofEvidence sourceMap sourcemap mapping sourceMapMapping mergeCandidate candidate'), normalizeNativeSourceRow)
40
+ });
41
+
42
+ function rowConfig(childKind, idPrefix, rowKinds, normalize) {
43
+ return { childKind, idPrefix, rowKinds: new Set(rowKinds), normalize };
44
+ }
45
+
46
+ function words(source) { return source.split(/\s+/); }
47
+
48
+ function normalizeInterlinguaRow(rowKind) {
49
+ if (rowKind === 'edge') return 'constraint';
50
+ if (rowKind === 'proof' || rowKind === 'proofObligation') return 'obligation';
51
+ if (rowKind === 'lower' || rowKind === 'lowering') return 'lowering';
52
+ if (rowKind === 'source' || rowKind === 'sourceLift') return 'lift';
53
+ return rowKind;
54
+ }
55
+
56
+ function normalizeDialectRegistryRow(rowKind) {
57
+ if (rowKind === 'record') return 'dialect';
58
+ return rowKind;
59
+ }
60
+
61
+ function normalizeRuntimeCapabilityRow(rowKind) {
62
+ if (rowKind === 'capability') return 'hostCapability';
63
+ if (rowKind === 'binding') return 'hostBinding';
64
+ if (rowKind === 'requirement' || rowKind === 'requiredRuntime') return 'runtimeRequirement';
65
+ if (rowKind === 'proofEvidence') return 'evidence';
66
+ if (rowKind === 'gap') return 'proofGap';
67
+ return rowKind;
68
+ }
69
+
70
+ function normalizeResourceGraphRow(rowKind) {
71
+ if (rowKind === 'life' || rowKind === 'lifetimeRegion') return 'lifetime';
72
+ if (rowKind === 'lifeRelation') return 'lifetimeRelation';
73
+ if (rowKind === 'borrowRegion') return 'borrowScope';
74
+ if (rowKind === 'unsafe') return 'unsafeBoundary';
75
+ if (rowKind === 'proof' || rowKind === 'proofObligation') return 'obligation';
76
+ return rowKind;
77
+ }
78
+
79
+ function normalizeApplicationSurfaceRow(rowKind) {
80
+ if (rowKind === 'provide' || rowKind === 'provides') return 'provided-surface';
81
+ if (rowKind === 'required' || rowKind === 'requires' || rowKind === 'require') return 'required-capability';
82
+ if (rowKind === 'proofEvidence') return 'evidence';
83
+ if (rowKind === 'gap') return 'proofGap';
84
+ return rowKind;
85
+ }
86
+
87
+ function normalizeProofEvidenceRows(rowKind) {
88
+ if (rowKind === 'proofEvidence') return 'evidence';
89
+ if (rowKind === 'gap') return 'proofGap';
90
+ return rowKind;
91
+ }
92
+
93
+ function normalizeCanvasSurfaceRow(rowKind) {
94
+ if (rowKind === 'stateWrite') return 'state-write';
95
+ return normalizeProofEvidenceRows(rowKind);
96
+ }
97
+
98
+ function normalizeConstraintSpaceRow(rowKind) {
99
+ if (rowKind === 'var') return 'variable';
100
+ if (rowKind === 'hard' || rowKind === 'soft') return 'constraint';
101
+ if (rowKind === 'prefer') return 'preference';
102
+ return rowKind;
103
+ }
104
+
105
+ function normalizeDecisionGraphRow(rowKind) {
106
+ if (rowKind === 'change') return 'semanticChange';
107
+ if (rowKind === 'patch') return 'patchEvent';
108
+ if (rowKind === 'admission') return 'admissionDecision';
109
+ if (rowKind === 'candidate') return 'candidateDecision';
110
+ if (rowKind === 'merge') return 'mergeDecision';
111
+ if (rowKind === 'panel') return 'panelProjection';
112
+ if (rowKind === 'feedback') return 'improvementFeedback';
113
+ return rowKind;
114
+ }
115
+
116
+ function normalizeOperationRow(rowKind) {
117
+ if (rowKind === 'op') return 'operation';
118
+ return rowKind;
119
+ }
120
+
121
+ function normalizeParadigmRow(rowKind) {
122
+ if (rowKind === 'ownership') return 'ownershipModel';
123
+ if (rowKind === 'lifetime') return 'lifetimeModel';
124
+ if (rowKind === 'binding') return 'bindingScope';
125
+ return rowKind;
126
+ }
127
+
128
+ function normalizeNativeSourceRow(rowKind) {
129
+ if (rowKind === 'proofEvidence') return 'evidence';
130
+ if (rowKind === 'sourcemap' || rowKind === 'mapping' || rowKind === 'sourceMapMapping') return 'sourceMap';
131
+ if (rowKind === 'candidate') return 'mergeCandidate';
132
+ return rowKind;
133
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shapeshift-labs/frontier-lang-parser",
3
- "version": "0.3.38",
3
+ "version": "0.3.40",
4
4
  "description": "Parser for the first Frontier Lang .frontier syntax slice.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -22,7 +22,7 @@
22
22
  ],
23
23
  "scripts": {
24
24
  "build": "node scripts/build.mjs",
25
- "test": "npm run build && node test/smoke.mjs && node test/target-projection-aggregate-smoke.mjs && node test/conversion-constraint-fields-smoke.mjs && node test/package-canvas-surface-smoke.mjs && node test/view-render-graph-smoke.mjs && node test/resource-graph-smoke.mjs && node test/interlingua-smoke.mjs && node test/dialect-registry-smoke.mjs",
25
+ "test": "npm run build && node test/smoke.mjs && node test/target-projection-aggregate-smoke.mjs && node test/conversion-constraint-fields-smoke.mjs && node test/conversion-evidence-smoke.mjs && node test/package-canvas-surface-smoke.mjs && node test/view-render-graph-smoke.mjs && node test/resource-graph-smoke.mjs && node test/interlingua-smoke.mjs && node test/dialect-registry-smoke.mjs",
26
26
  "typecheck": "node ./node_modules/typescript/bin/tsc --noEmit -p test/tsconfig.json",
27
27
  "fuzz": "npm run build && node fuzz/smoke.mjs",
28
28
  "bench": "npm run build && node bench/smoke.mjs",