@shapeshift-labs/frontier-lang-parser 0.3.83 → 0.3.84

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.
@@ -4,6 +4,7 @@ export function parseNativeSourceBlock(block) {
4
4
  const name = nameFrom(block.header);
5
5
  const losses = parseLosses(name, block.body);
6
6
  const nativeSourceId = idFrom(block.header, `native_${name}`);
7
+ const language = readWord('language', block.body) ?? readWord('sourceLanguage', block.body) ?? name;
7
8
  const evidence = parseEvidenceRecords(block.body);
8
9
  const sourceMaps = parseSourceMaps(block.body, {
9
10
  nativeSourceId,
@@ -13,7 +14,7 @@ export function parseNativeSourceBlock(block) {
13
14
  });
14
15
  const mergeCandidates = parseMergeCandidates(block.body, {
15
16
  nativeSourceId,
16
- language: readWord('language', block.body) ?? name,
17
+ language,
17
18
  sourcePath: readWord('sourcePath', block.body) ?? readWord('path', block.body),
18
19
  sourceMaps,
19
20
  evidence
@@ -21,13 +22,13 @@ export function parseNativeSourceBlock(block) {
21
22
  const node = nativeSourceNode({
22
23
  id: nativeSourceId,
23
24
  name,
24
- language: readWord('language', block.body) ?? name,
25
+ language,
25
26
  parser: readWord('parser', block.body),
26
27
  parserVersion: readWord('parserVersion', block.body),
27
28
  sourcePath: readWord('sourcePath', block.body) ?? readWord('path', block.body),
28
29
  sourceHash: readWord('sourceHash', block.body),
29
30
  symbol: readWord('symbol', block.body),
30
- frontierNodeIds: readList('frontierNodes', block.body),
31
+ frontierNodeIds: readList('frontierNodes', block.body) ?? readList('frontierNodeIds', block.body) ?? readList('frontierNodeId', block.body) ?? readList('frontierNode', block.body),
31
32
  sourceMapIds: sourceMaps.map((sourceMap) => sourceMap.id),
32
33
  mergeCandidateIds: mergeCandidates.map((candidate) => candidate.id),
33
34
  evidenceIds: evidence.map((record) => record.id),
@@ -139,7 +140,7 @@ function parseMergeCandidates(body, context) {
139
140
  const sourceMapMappingIds = readInlineList(rest, 'sourceMapMapping', 'sourceMapMappings', 'sourceMapMappingIds');
140
141
  return createSemanticMergeCandidateRecord(cleanRecord({
141
142
  id: idFrom(rest, `merge_candidate_${name}`),
142
- language: readInlineWord('language', rest) ?? context.language,
143
+ language: readInlineWord('language', rest) ?? readInlineWord('sourceLanguage', rest) ?? context.language,
143
144
  sourcePath: readInlineWord('sourcePath', rest) ?? readInlineWord('path', rest) ?? context.sourcePath,
144
145
  baseHash: readInlineWord('baseHash', rest),
145
146
  targetHash: readInlineWord('targetHash', rest),
@@ -11,6 +11,7 @@ const semanticEditRows = words('script semanticEditScript projection semanticEdi
11
11
  const gateAdmissionRows = words('gate evidence proofEvidence admission admissionDecision proofObligation obligation gap proofGap');
12
12
  const resourceRows = words('sourceLanguage language sourcePath path sourceHash status evidence evidenceIds resource owner loan alias move drop escape lifetime lifetimeRegion life outlives lifetimeRelation lifeRelation borrow borrowScope borrowRegion unsafe unsafeBoundary memory memoryRegion region layout dataLayout pointer ptr address access memoryAccess atomic volatile abi abiBoundary callBoundary sync synchronization synchronisation synchronizationEdge synchronisationEdge happensBefore happens-before hb fence fenceEdge barrier barrierEdge trap traps undefined undefinedBehavior undefinedBehaviour ub conflict proof proofObligation obligation proofEvidence sourceMap sourcemap mapping sourceMapMapping missingEvidence');
13
13
  const targetRows = words('language targetLanguage sourceLanguage package packageName emitPath targetPath sourcePath path sourceHash targetHash runtime runtimeHost moduleFormat projection lowering lower layer adapter adapterId readiness disposition status evidence proofEvidence proof loss missingEvidence gap proofGap sourceMap sourcemap mapping sourceMapMapping');
14
+ const nativeSourceRows = words('language sourceLanguage parser parserVersion sourcePath path sourceHash symbol frontierNodes frontierNode frontierNodeId frontierNodeIds loss evidence proofEvidence sourceMap sourcemap mapping sourceMapMapping mergeCandidate candidate');
14
15
  const coreFailClosed = (reason) => ({ failClosedUnknownRows: true, unknownRowReason: reason });
15
16
 
16
17
  export const ROW_SYNTAX_CONFIG = Object.freeze({
@@ -56,7 +57,7 @@ export const ROW_SYNTAX_CONFIG = Object.freeze({
56
57
  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),
57
58
  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),
58
59
  proof: rowConfig('proofRow', 'proof_row', words('contract refinement invariant termination temporal obligation artifact assumption')),
59
- nativeSource: rowConfig('nativeSourceRow', 'native_source_row', words('loss evidence proofEvidence sourceMap sourcemap mapping sourceMapMapping mergeCandidate candidate'), normalizeNativeSourceRow)
60
+ nativeSource: rowConfig('nativeSourceRow', 'native_source_row', nativeSourceRows, normalizeNativeSourceRow, coreFailClosed('unsupported-native-source-row'))
60
61
  });
61
62
 
62
63
  function rowConfig(childKind, idPrefix, rowKinds, normalize, options = {}) {
@@ -234,6 +235,9 @@ function normalizeParadigmRow(rowKind) {
234
235
  }
235
236
 
236
237
  function normalizeNativeSourceRow(rowKind) {
238
+ if (rowKind === 'sourceLanguage') return 'language';
239
+ if (rowKind === 'path') return 'sourcePath';
240
+ if (rowKind === 'frontierNode' || rowKind === 'frontierNodeId' || rowKind === 'frontierNodeIds') return 'frontierNodes';
237
241
  if (rowKind === 'proofEvidence') return 'evidence';
238
242
  if (rowKind === 'sourcemap' || rowKind === 'mapping' || rowKind === 'sourceMapMapping') return 'sourceMap';
239
243
  if (rowKind === 'candidate') return 'mergeCandidate';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shapeshift-labs/frontier-lang-parser",
3
- "version": "0.3.83",
3
+ "version": "0.3.84",
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/source-syntax-family-summary-smoke.mjs && node test/resource-graph-source-syntax-smoke.mjs && node test/tgt-source-smoke.mjs && node test/member-identity-smoke.mjs && node test/generic-row-parse-identity-smoke.mjs && node test/type-variant-payload-smoke.mjs && node test/type-generic-ref-smoke.mjs && node test/type-parameter-constraints-smoke.mjs && node test/type-structural-expression-smoke.mjs && node test/action-body-smoke.mjs && node test/action-structured-literals-smoke.mjs && node test/action-return-smoke.mjs && node test/action-else-smoke.mjs && node test/action-match-smoke.mjs && node test/action-for-in-smoke.mjs && node test/action-repeat-smoke.mjs && node test/action-call-smoke.mjs && node test/semantic-operation-edit-smoke.mjs && node test/target-projection-aggregate-smoke.mjs && node test/conversion-constraint-fields-smoke.mjs && node test/conversion-evidence-smoke.mjs && node test/gate-admission-evidence-smoke.mjs && node test/package-canvas-surface-smoke.mjs && node test/view-render-graph-smoke.mjs && node test/view-source-syntax-smoke.mjs && node test/resource-graph-smoke.mjs && node test/machine-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/source-syntax-family-summary-smoke.mjs && node test/resource-graph-source-syntax-smoke.mjs && node test/tgt-source-smoke.mjs && node test/native-source-rows-smoke.mjs && node test/member-identity-smoke.mjs && node test/generic-row-parse-identity-smoke.mjs && node test/type-variant-payload-smoke.mjs && node test/type-generic-ref-smoke.mjs && node test/type-parameter-constraints-smoke.mjs && node test/type-structural-expression-smoke.mjs && node test/action-body-smoke.mjs && node test/action-structured-literals-smoke.mjs && node test/action-return-smoke.mjs && node test/action-else-smoke.mjs && node test/action-match-smoke.mjs && node test/action-for-in-smoke.mjs && node test/action-repeat-smoke.mjs && node test/action-call-smoke.mjs && node test/semantic-operation-edit-smoke.mjs && node test/target-projection-aggregate-smoke.mjs && node test/conversion-constraint-fields-smoke.mjs && node test/conversion-evidence-smoke.mjs && node test/gate-admission-evidence-smoke.mjs && node test/package-canvas-surface-smoke.mjs && node test/view-render-graph-smoke.mjs && node test/view-source-syntax-smoke.mjs && node test/resource-graph-smoke.mjs && node test/machine-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",