@shapeshift-labs/frontier-lang-parser 0.3.63 → 0.3.64

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.
@@ -222,6 +222,7 @@ function conversionChild(source, block, options, line, child) {
222
222
 
223
223
  function readGenericRowSyntaxChildren(source, block, options, config) {
224
224
  const children = [];
225
+ const seenIds = new Set();
225
226
  const rowPattern = new RegExp('^([A-Za-z_$][\\w$-]*)\\s+' + ROW_NAME_PATTERN + '(.*)$');
226
227
  for (const line of readBodyLines(source, block)) {
227
228
  if (!line.text || line.text.startsWith('#')) continue;
@@ -230,12 +231,22 @@ function readGenericRowSyntaxChildren(source, block, options, config) {
230
231
  const [, rowKind, name, rest] = row;
231
232
  if (!config.rowKinds.has(rowKind)) continue;
232
233
  const normalizedRowKind = config.normalize?.(rowKind) ?? rowKind;
234
+ const id = idFrom(rest, `${config.idPrefix}_${safeId(normalizedRowKind)}_${safeId(name)}`);
235
+ let recognized = true;
236
+ let reason;
237
+ if (seenIds.has(id)) {
238
+ recognized = false;
239
+ reason = 'duplicate-generic-row-id';
240
+ }
241
+ if (recognized) {
242
+ seenIds.add(id);
243
+ }
233
244
  children.push(cleanRecord({
234
245
  kind: config.childKind,
235
246
  rowKind,
236
247
  normalizedRowKind,
237
248
  name,
238
- id: idFrom(rest, `${config.idPrefix}_${safeId(normalizedRowKind)}_${safeId(name)}`),
249
+ id,
239
250
  header: line.text,
240
251
  startOffset: line.startOffset,
241
252
  endOffset: line.endOffset,
@@ -246,7 +257,8 @@ function readGenericRowSyntaxChildren(source, block, options, config) {
246
257
  moduleId: block.moduleId,
247
258
  moduleName: block.moduleName,
248
259
  sourceSpan: sourceSpan(source, block, line.startOffset, line.endOffset, options),
249
- recognized: true
260
+ recognized,
261
+ reason
250
262
  }));
251
263
  }
252
264
  return children;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shapeshift-labs/frontier-lang-parser",
3
- "version": "0.3.63",
3
+ "version": "0.3.64",
4
4
  "description": "Parser for the first Frontier Lang .frontier syntax slice.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",