@tsplc/typegen 0.2.21 → 0.4.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/dist/codegen.js CHANGED
@@ -1,6 +1,8 @@
1
1
  // packages/typegen/src/codegen/generate.ts
2
2
  import { readdir, readFile } from "node:fs/promises";
3
3
  import { basename, join } from "node:path";
4
+ import { elementaryTypesByName } from "@tsplc/iec";
5
+ import { identifierPattern as identifierPattern2 } from "@tsplc/iec/st";
4
6
 
5
7
  // packages/typegen/src/codegen/constants.ts
6
8
  import {
@@ -126,10 +128,6 @@ function constantResolver(lists) {
126
128
  return constant;
127
129
  }
128
130
 
129
- // packages/typegen/src/codegen/generate.ts
130
- import { elementaryTypesByName } from "@tsplc/iec";
131
- import { identifierPattern as identifierPattern2 } from "@tsplc/iec/st";
132
-
133
131
  // packages/typegen/src/codegen/parser.ts
134
132
  import {
135
133
  blockCommentEnd,
@@ -393,6 +391,23 @@ class Parser {
393
391
  }
394
392
  globals(name) {
395
393
  const description = this.documentation();
394
+ const sections = [];
395
+ do {
396
+ sections.push(this.globalSection());
397
+ } while (this.peek());
398
+ const constant = sections.every((section) => section.constant);
399
+ if (!constant && sections.some((section) => section.constant)) {
400
+ this.error("a list mixes CONSTANT and writable VAR_GLOBAL sections");
401
+ }
402
+ return {
403
+ name,
404
+ description,
405
+ source: this.source.name,
406
+ constant,
407
+ members: sections.flatMap((section) => section.members)
408
+ };
409
+ }
410
+ globalSection() {
396
411
  this.expect("VAR_GLOBAL");
397
412
  const written = new Set;
398
413
  while (qualifiers.has(this.peek())) {
@@ -404,16 +419,7 @@ class Parser {
404
419
  }
405
420
  const members = this.members("END_VAR");
406
421
  this.accept(";");
407
- if (this.peek()) {
408
- this.error("only one VAR_GLOBAL block per file is supported");
409
- }
410
- return {
411
- name,
412
- description,
413
- source: this.source.name,
414
- constant: written.has("CONSTANT"),
415
- members
416
- };
422
+ return { constant: written.has("CONSTANT"), members };
417
423
  }
418
424
  }
419
425
  function parseDeclarations(source) {
@@ -577,7 +583,8 @@ function emit(declarations, globals, {
577
583
  const visited = new Set;
578
584
  function visitReference(type) {
579
585
  if (type.kind === "array") {
580
- return visitReference(type.element);
586
+ visitReference(type.element);
587
+ return;
581
588
  }
582
589
  if (type.kind === "named" && !scalars[type.name.toUpperCase()]) {
583
590
  visit(declaration(type.name));
@@ -592,7 +599,9 @@ function emit(declarations, globals, {
592
599
  }
593
600
  visiting.add(type.name);
594
601
  if (type.kind === "struct") {
595
- type.members.forEach((member) => visitReference(member.type));
602
+ type.members.forEach((member) => {
603
+ visitReference(member.type);
604
+ });
596
605
  }
597
606
  if (type.kind === "alias") {
598
607
  visitReference(type.type);
@@ -727,5 +736,5 @@ export {
727
736
  stFiles
728
737
  };
729
738
 
730
- //# debugId=AF7163667E33A4BF64756E2164756E21
739
+ //# debugId=94FE5117CC1AE33664756E2164756E21
731
740
  //# sourceMappingURL=codegen.js.map
@@ -2,11 +2,11 @@
2
2
  "version": 3,
3
3
  "sources": ["../src/codegen/generate.ts", "../src/codegen/constants.ts", "../src/codegen/parser.ts"],
4
4
  "sourcesContent": [
5
- "import { readdir, readFile } from \"node:fs/promises\";\nimport { basename, join } from \"node:path\";\nimport {\n\tconstantResolver,\n\tintegerExpression,\n\tisNumberInteger,\n} from \"./constants\";\nimport type { Publication } from \"@tsplc/config\";\nimport { type ElementaryType, elementaryTypesByName } from \"@tsplc/iec\";\nimport { identifierPattern } from \"@tsplc/iec/st\";\nimport {\n\ttype Declaration,\n\ttype GlobalList,\n\ttype Source,\n\ttype TypeReference,\n\tparseDeclarations,\n\tparseGlobals,\n} from \"./parser\";\n\nexport interface GenerateOptions {\n\t/** Directory searched recursively, or an explicit list of TYPE source files. */\n\ttypes: string | readonly string[];\n\t/** Directory or explicit GVL files; each list is named after its .st filename. */\n\tglobals?: string | readonly string[];\n\t/** Inferred contracts select published globals and supported integer constants. */\n\tpublishedGlobalsOnly?: boolean;\n\tpublication?: Publication;\n\t/**\n\t * Also emit TypeScript declarations for the PLC's types, enums, constants and globals.\n\t * Turn off when host code imports them from the TypeScript program itself; the field and\n\t * symbol tables are still emitted, because TypeScript types don't exist at runtime.\n\t */\n\tdeclarations?: boolean;\n}\n\n/** The TypeScript type a scalar is read as; the 64-bit date and time types have none. */\nconst scalarType = (type: ElementaryType) => {\n\tswitch (type.family) {\n\t\tcase \"bool\":\n\t\t\treturn \"boolean\";\n\t\tcase \"integer\":\n\t\tcase \"bits\":\n\t\t\treturn type.bits === 64 ? \"bigint\" : \"number\";\n\t\tcase \"real\":\n\t\t\treturn \"number\";\n\t\tcase \"duration\":\n\t\tcase \"date\":\n\t\tcase \"timeOfDay\":\n\t\tcase \"dateTime\":\n\t\t\treturn type.bits === 32 ? \"number\" : undefined;\n\t\tcase \"char\":\n\t\tcase \"string\":\n\t\t\treturn undefined;\n\t}\n};\n\nconst scalars: Record<string, string> = Object.fromEntries(\n\t[...elementaryTypesByName].flatMap(([name, type]) => {\n\t\tconst typescript = scalarType(type);\n\t\treturn typescript ? [[name, typescript]] : [];\n\t}),\n);\n\n/** Recursively lists .st files in name order. */\nexport async function stFiles(directory: string): Promise<string[]> {\n\tconst entries = await readdir(directory, { withFileTypes: true });\n\tconst paths = await Promise.all(\n\t\tentries\n\t\t\t.sort((a, b) => {\n\t\t\t\tif (a.name === b.name) {\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t\treturn a.name < b.name ? -1 : 1;\n\t\t\t})\n\t\t\t.map(async (entry) => {\n\t\t\t\tconst file = join(directory, entry.name);\n\t\t\t\tif (entry.isDirectory()) {\n\t\t\t\t\treturn stFiles(file);\n\t\t\t\t}\n\t\t\t\treturn entry.isFile() && /\\.st$/i.test(file) ? [file] : [];\n\t\t\t}),\n\t);\n\treturn paths.flat();\n}\n\nconst quote = (value: string) => JSON.stringify(value);\nconst documentation = (value: string) =>\n\tvalue\n\t\t? `/** ${value.replace(/\\*\\//g, \"* /\").replace(/\\r?\\n/g, \"\\n * \")} */\\n`\n\t\t: \"\";\n\nfunction unique<T extends { name: string; source: string }>(\n\titems: T[],\n): Map<string, T> {\n\tconst result = new Map<string, T>();\n\tfor (const item of items) {\n\t\tconst key = item.name.toUpperCase();\n\t\tif (result.has(key)) {\n\t\t\tthrow new Error(\n\t\t\t\t`${item.source}: duplicate declaration ${item.name} (also in ${result.get(key)?.source})`,\n\t\t\t);\n\t\t}\n\t\tresult.set(key, item);\n\t}\n\treturn result;\n}\n\n/** Reads files concurrently, so they can be parsed in order and the first invalid one is reported. */\nconst readSources = (files: readonly string[]): Promise<Source[]> =>\n\tPromise.all(\n\t\tfiles.map(async (name) => ({ name, text: await readFile(name, \"utf8\") })),\n\t);\n\nexport async function generateTypes(options: GenerateOptions): Promise<string> {\n\tconst typeFiles =\n\t\ttypeof options.types === \"string\"\n\t\t\t? await stFiles(options.types)\n\t\t\t: options.types;\n\tconst declarations = (await readSources(typeFiles)).flatMap((source) =>\n\t\tparseDeclarations(source),\n\t);\n\tconst globalFiles =\n\t\ttypeof options.globals === \"string\"\n\t\t\t? await stFiles(options.globals)\n\t\t\t: (options.globals ?? []);\n\t// Program-only projects have a valid empty export selection. Directory\n\t// discovery still rejects empty input rather than hiding a bad setting.\n\tif (\n\t\t!typeFiles.length &&\n\t\t!globalFiles.length &&\n\t\t(typeof options.types === \"string\" || typeof options.globals === \"string\")\n\t) {\n\t\tthrow new Error(\n\t\t\t`no .st declarations found in ${typeof options.types === \"string\" ? options.types : \"the selected source files\"}`,\n\t\t);\n\t}\n\tconst globals = (await readSources(globalFiles)).map((source) =>\n\t\tparseGlobals(source, basename(source.name).replace(/\\.st$/i, \"\")),\n\t);\n\tconst publishedGlobalsOnly = options.publishedGlobalsOnly ?? false;\n\tconst contract = emit(\n\t\tdeclarations,\n\t\tpublishedGlobalsOnly ? published(globals, options.publication) : globals,\n\t\t{ publishedGlobalsOnly, emitDeclarations: options.declarations ?? true },\n\t);\n\treturn options.publication\n\t\t? `${contract}\\nexport const publication = ${JSON.stringify(options.publication, null, 2)} as const;\\n`\n\t\t: contract;\n}\n\n/**\n * Constant lists stay whole; a variable list keeps the members the publication names,\n * or without one those a symbol attribute publishes, and is dropped when none remain.\n */\nfunction published(\n\tglobals: GlobalList[],\n\tpublication: Publication | undefined,\n): GlobalList[] {\n\treturn globals\n\t\t.map((list) =>\n\t\t\tlist.constant\n\t\t\t\t? list\n\t\t\t\t: {\n\t\t\t\t\t\t...list,\n\t\t\t\t\t\tmembers: list.members.filter((member) =>\n\t\t\t\t\t\t\tpublication\n\t\t\t\t\t\t\t\t? [\n\t\t\t\t\t\t\t\t\t\t...publication.production,\n\t\t\t\t\t\t\t\t\t\t...publication.development,\n\t\t\t\t\t\t\t\t\t].includes(`${list.name}.${member.name}`)\n\t\t\t\t\t\t\t\t: member.published,\n\t\t\t\t\t\t),\n\t\t\t\t\t},\n\t\t)\n\t\t.filter((list) => list.constant || list.members.length);\n}\n\nfunction emit(\n\tdeclarations: Declaration[],\n\tglobals: GlobalList[],\n\t{\n\t\tpublishedGlobalsOnly,\n\t\temitDeclarations,\n\t}: { publishedGlobalsOnly: boolean; emitDeclarations: boolean },\n): string {\n\tconst types = unique(declarations);\n\tunique(globals);\n\tconst constants = globals.filter((list) => list.constant);\n\t// Keep integer constants useful to host clients, including declaration bounds.\n\t// Private block presets and labels cannot use this integer-only export format.\n\t// Their declarations still remain available to the lazy bound resolver below.\n\tconst constantLists = publishedGlobalsOnly\n\t\t? constants\n\t\t\t\t.map((list) => ({\n\t\t\t\t\t...list,\n\t\t\t\t\tmembers: list.members.filter(\n\t\t\t\t\t\t(member) =>\n\t\t\t\t\t\t\tmember.type.kind === \"named\" &&\n\t\t\t\t\t\t\tisNumberInteger(member.type.name.toUpperCase()),\n\t\t\t\t\t),\n\t\t\t\t}))\n\t\t\t\t.filter((list) => list.members.length)\n\t\t: constants;\n\tconst variableLists = globals.filter((list) => !list.constant);\n\tconst constant = constantResolver(constants);\n\n\tfunction bound(expression: string): number {\n\t\treturn integerExpression(expression, (name) => constant(name, null));\n\t}\n\tfunction dimensions(type: Extract<TypeReference, { kind: \"array\" }>) {\n\t\treturn type.dimensions.map(({ lower, upper }) => {\n\t\t\tconst start = bound(lower);\n\t\t\tconst end = bound(upper);\n\t\t\tif (end < start || !Number.isSafeInteger(end - start + 1)) {\n\t\t\t\tthrow new Error(`invalid array bounds ${lower}..${upper}`);\n\t\t\t}\n\t\t\treturn { start, end };\n\t\t});\n\t}\n\tfunction declaration(name: string): Declaration {\n\t\tconst found = types.get(name.toUpperCase());\n\t\tif (!found) {\n\t\t\tthrow new Error(`unknown IEC type ${name}`);\n\t\t}\n\t\treturn found;\n\t}\n\tfunction tsType(type: TypeReference): string {\n\t\tif (type.kind === \"array\") {\n\t\t\tdimensions(type);\n\t\t\treturn type.dimensions.reduce(\n\t\t\t\t(child) => `Array<${child}>`,\n\t\t\t\ttsType(type.element),\n\t\t\t);\n\t\t}\n\t\tif (type.kind === \"string\") {\n\t\t\tconst length = bound(type.length);\n\t\t\tif (length < 1) {\n\t\t\t\tthrow new Error(`invalid ${type.name} length ${length}`);\n\t\t\t}\n\t\t\treturn \"string\";\n\t\t}\n\t\treturn scalars[type.name.toUpperCase()] ?? declaration(type.name).name;\n\t}\n\tfunction resolved(type: TypeReference): TypeReference {\n\t\tif (type.kind !== \"named\" || scalars[type.name.toUpperCase()]) {\n\t\t\treturn type;\n\t\t}\n\t\tconst definition = declaration(type.name);\n\t\tif (definition.kind === \"alias\") {\n\t\t\treturn resolved(definition.type);\n\t\t}\n\t\tif (definition.kind === \"enum\") {\n\t\t\treturn { kind: \"named\", name: definition.base };\n\t\t}\n\t\treturn type;\n\t}\n\tfunction iecType(type: TypeReference): string {\n\t\tconst actual = resolved(type);\n\t\tif (actual.kind === \"string\") {\n\t\t\treturn `${actual.name}(${bound(actual.length)})`;\n\t\t}\n\t\tif (actual.kind === \"array\") {\n\t\t\treturn `ARRAY[${dimensions(actual)\n\t\t\t\t.map(({ start, end }) => `${start}..${end}`)\n\t\t\t\t.join(\", \")}] OF ${iecType(actual.element)}`;\n\t\t}\n\t\treturn scalars[actual.name.toUpperCase()]\n\t\t\t? actual.name.toUpperCase()\n\t\t\t: declaration(actual.name).name;\n\t}\n\n\t// Topological order makes generated field lists reusable without duplicating child fields.\n\tconst ordered: Declaration[] = [];\n\tconst visiting = new Set<string>();\n\tconst visited = new Set<string>();\n\tfunction visitReference(type: TypeReference): void {\n\t\tif (type.kind === \"array\") {\n\t\t\treturn visitReference(type.element);\n\t\t}\n\t\tif (type.kind === \"named\" && !scalars[type.name.toUpperCase()]) {\n\t\t\tvisit(declaration(type.name));\n\t\t}\n\t}\n\tfunction visit(type: Declaration): void {\n\t\tif (visited.has(type.name)) {\n\t\t\treturn;\n\t\t}\n\t\tif (visiting.has(type.name)) {\n\t\t\tthrow new Error(\n\t\t\t\t`${type.source}: cyclic type reference involving ${type.name}`,\n\t\t\t);\n\t\t}\n\t\tvisiting.add(type.name);\n\t\tif (type.kind === \"struct\") {\n\t\t\ttype.members.forEach((member) => visitReference(member.type));\n\t\t}\n\t\tif (type.kind === \"alias\") {\n\t\t\tvisitReference(type.type);\n\t\t}\n\t\tvisiting.delete(type.name);\n\t\tvisited.add(type.name);\n\t\tordered.push(type);\n\t}\n\tdeclarations.forEach(visit);\n\n\tconst reserved = new Set(\n\t\t\"break case catch class const continue debugger default delete do else enum export extends false finally for function if import in instanceof new null return super switch this throw true try typeof var void while with yield let static implements interface package private protected public await arguments eval PlcGlobals PlcField typeFields symbols globalVariableLists publication\".split(\n\t\t\t\" \",\n\t\t),\n\t);\n\tfor (const name of [\n\t\t...declarations.map((type) => type.name),\n\t\t...constantLists.map((list) => list.name),\n\t]) {\n\t\tif (\n\t\t\t!identifierPattern.test(name) ||\n\t\t\treserved.has(name) ||\n\t\t\t/^_fields\\d+$/.test(name)\n\t\t) {\n\t\t\tthrow new Error(`name cannot be exported to TypeScript: ${name}`);\n\t\t}\n\t\treserved.add(name);\n\t}\n\tconst indexes = new Map(ordered.map((type, index) => [type.name, index]));\n\tfunction complex(type: TypeReference): boolean {\n\t\tconst actual = resolved(type);\n\t\tif (actual.kind === \"array\") {\n\t\t\treturn complex(actual.element);\n\t\t}\n\t\treturn actual.kind === \"named\" && !scalars[actual.name.toUpperCase()];\n\t}\n\t/** An enum-keyed array: like a record's fields, each key is its own contract variable. */\n\tfunction keyed(type: TypeReference): boolean {\n\t\tif (type.kind !== \"named\" || scalars[type.name.toUpperCase()]) {\n\t\t\treturn false;\n\t\t}\n\t\tconst definition = declaration(type.name);\n\t\treturn (\n\t\t\tdefinition.kind === \"alias\" &&\n\t\t\t(!!definition.keyed || keyed(definition.type))\n\t\t);\n\t}\n\tfunction fields(\n\t\ttype: TypeReference,\n\t\tpath: string,\n\t\tdescription: string,\n\t\tdepth = 0,\n\t): string {\n\t\tconst actual = resolved(type);\n\t\tif (actual.kind === \"named\" && complex(actual)) {\n\t\t\tconst children = `_fields${indexes.get(declaration(actual.name).name)}`;\n\t\t\tif (path === '\"\"') {\n\t\t\t\treturn children;\n\t\t\t}\n\t\t\treturn `${children}.map((member) => ({ ...member, field: ${path} + \".\" + member.field }))`;\n\t\t}\n\t\tif (actual.kind === \"array\" && (complex(actual.element) || keyed(type))) {\n\t\t\tconst ranges = dimensions(actual);\n\t\t\tconst coordinates = ranges.map(\n\t\t\t\t(range, index) => `String(i${depth}_${index} + (${range.start}))`,\n\t\t\t);\n\t\t\tconst arrayPath = `${path} + \"[\" + ${coordinates.join(' + \",\" + ')} + \"]\"`;\n\t\t\treturn ranges.reduceRight(\n\t\t\t\t(child, range, index) =>\n\t\t\t\t\t`Array.from({ length: ${range.end - range.start + 1} }, (_, i${depth}_${index}) => ${child}).flat()`,\n\t\t\t\tfields(actual.element, `(${arrayPath})`, description, depth + 1),\n\t\t\t);\n\t\t}\n\t\treturn `[{ field: ${path}, type: ${quote(iecType(actual))}, description: ${quote(description)} }]`;\n\t}\n\n\tconst declare = (text: string) => (emitDeclarations ? [text] : []);\n\tconst output = [\n\t\t\"// Generated by @tsplc/typegen. Edit the PLC sources and regenerate.\\n\",\n\t\t\"export interface PlcField { field: string; type: string; description: string; }\\n\",\n\t];\n\tfor (const type of ordered) {\n\t\ttry {\n\t\t\tconst doc = documentation(type.description);\n\t\t\tif (type.kind === \"struct\") {\n\t\t\t\toutput.push(\n\t\t\t\t\t...declare(\n\t\t\t\t\t\t`${doc}export interface ${type.name} {\\n${type.members.map((member) => `${documentation(member.description)}${quote(member.name)}: ${tsType(member.type)};`).join(\"\\n\")}\\n}\\n`,\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t\toutput.push(\n\t\t\t\t\t`const _fields${indexes.get(type.name)}: PlcField[] = [\\n${type.members.map((member) => `...${fields(member.type, quote(member.name), member.description)},`).join(\"\\n\")}\\n];\\n`,\n\t\t\t\t);\n\t\t\t} else if (type.kind === \"alias\") {\n\t\t\t\toutput.push(\n\t\t\t\t\t...declare(\n\t\t\t\t\t\t`${doc}export type ${type.name} = ${tsType(type.type)};\\n`,\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t\toutput.push(\n\t\t\t\t\t`const _fields${indexes.get(type.name)}: PlcField[] = ${fields({ kind: \"named\", name: type.name }, '\"\"', type.description)};\\n`,\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tif (!isNumberInteger(type.base)) {\n\t\t\t\t\tthrow new Error(`unsupported enum base ${type.base}`);\n\t\t\t\t}\n\t\t\t\tconst entries = new Map<string, number>();\n\t\t\t\tfor (const member of type.members) {\n\t\t\t\t\tconst previous = [...entries.values()].at(-1) ?? -1;\n\t\t\t\t\tconst value =\n\t\t\t\t\t\tmember.value === undefined\n\t\t\t\t\t\t\t? previous + 1\n\t\t\t\t\t\t\t: integerExpression(\n\t\t\t\t\t\t\t\t\tmember.value,\n\t\t\t\t\t\t\t\t\t(name) =>\n\t\t\t\t\t\t\t\t\t\tentries.get(name.toUpperCase()) ?? constant(name, null),\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\tentries.set(member.name.toUpperCase(), value);\n\t\t\t\t}\n\t\t\t\toutput.push(\n\t\t\t\t\t...declare(\n\t\t\t\t\t\t`${doc}export const ${type.name} = { ${type.members.map((member) => `${quote(member.name)}: ${entries.get(member.name.toUpperCase())}`).join(\", \")} } as const;\\nexport type ${type.name} = (typeof ${type.name})[keyof typeof ${type.name}];\\n`,\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t\toutput.push(\n\t\t\t\t\t`const _fields${indexes.get(type.name)}: PlcField[] = ${fields({ kind: \"named\", name: type.base }, '\"\"', type.description)};\\n`,\n\t\t\t\t);\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tthrow new Error(\n\t\t\t\t`${type.source} (${type.name}): ${error instanceof Error ? error.message : String(error)}`,\n\t\t\t\t{ cause: error },\n\t\t\t);\n\t\t}\n\t}\n\toutput.push(\n\t\t`export const typeFields = {\\n${ordered.map((type) => `${quote(type.name)}: _fields${indexes.get(type.name)},`).join(\"\\n\")}\\n};\\n`,\n\t);\n\tfor (const list of emitDeclarations ? constantLists : []) {\n\t\toutput.push(\n\t\t\t`${documentation(list.description)}export const ${list.name} = {\\n${list.members.map((member) => `${documentation(member.description)}${quote(member.name)}: ${constant(`${list.name}.${member.name}`, null)},`).join(\"\\n\")}\\n} as const;\\n`,\n\t\t);\n\t}\n\toutput.push(\n\t\t...declare(\n\t\t\t`export interface PlcGlobals {\\n${variableLists.map((list) => `${documentation(list.description)}${quote(list.name)}: {\\n${list.members.map((member) => `${documentation(member.description)}${quote(member.name)}: ${tsType(member.type)};`).join(\"\\n\")}\\n};`).join(\"\\n\")}\\n}\\n`,\n\t\t),\n\t);\n\toutput.push(\n\t\t`export const globalVariableLists = ${JSON.stringify(Object.fromEntries(variableLists.map((list) => [list.name, list.description])), null, \"\\t\")} as const;\\n`,\n\t);\n\toutput.push(\n\t\t`export const symbols = ${JSON.stringify(\n\t\t\tvariableLists.flatMap((list) =>\n\t\t\t\tlist.members.map((member) => ({\n\t\t\t\t\tname: member.name,\n\t\t\t\t\tgvl: list.name,\n\t\t\t\t\ttype:\n\t\t\t\t\t\tmember.type.kind === \"named\" &&\n\t\t\t\t\t\t!scalars[member.type.name.toUpperCase()]\n\t\t\t\t\t\t\t? declaration(member.type.name).name\n\t\t\t\t\t\t\t: iecType(member.type),\n\t\t\t\t\tdescription: member.description,\n\t\t\t\t})),\n\t\t\t),\n\t\t\tnull,\n\t\t\t\"\\t\",\n\t\t)} as const;\\n`,\n\t);\n\treturn output.join(\"\\n\");\n}\n",
5
+ "import { readdir, readFile } from \"node:fs/promises\";\nimport { basename, join } from \"node:path\";\nimport type { Publication } from \"@tsplc/config\";\nimport { type ElementaryType, elementaryTypesByName } from \"@tsplc/iec\";\nimport { identifierPattern } from \"@tsplc/iec/st\";\nimport {\n\tconstantResolver,\n\tintegerExpression,\n\tisNumberInteger,\n} from \"./constants\";\nimport {\n\ttype Declaration,\n\ttype GlobalList,\n\tparseDeclarations,\n\tparseGlobals,\n\ttype Source,\n\ttype TypeReference,\n} from \"./parser\";\n\nexport interface GenerateOptions {\n\t/** Directory searched recursively, or an explicit list of TYPE source files. */\n\ttypes: string | readonly string[];\n\t/** Directory or explicit GVL files; each list is named after its .st filename. */\n\tglobals?: string | readonly string[];\n\t/** Inferred contracts select published globals and supported integer constants. */\n\tpublishedGlobalsOnly?: boolean;\n\tpublication?: Publication;\n\t/**\n\t * Also emit TypeScript declarations for the PLC's types, enums, constants and globals.\n\t * Turn off when host code imports them from the TypeScript program itself; the field and\n\t * symbol tables are still emitted, because TypeScript types don't exist at runtime.\n\t */\n\tdeclarations?: boolean;\n}\n\n/** The TypeScript type a scalar is read as; the 64-bit date and time types have none. */\nconst scalarType = (type: ElementaryType) => {\n\tswitch (type.family) {\n\t\tcase \"bool\":\n\t\t\treturn \"boolean\";\n\t\tcase \"integer\":\n\t\tcase \"bits\":\n\t\t\treturn type.bits === 64 ? \"bigint\" : \"number\";\n\t\tcase \"real\":\n\t\t\treturn \"number\";\n\t\tcase \"duration\":\n\t\tcase \"date\":\n\t\tcase \"timeOfDay\":\n\t\tcase \"dateTime\":\n\t\t\treturn type.bits === 32 ? \"number\" : undefined;\n\t\tcase \"char\":\n\t\tcase \"string\":\n\t\t\treturn undefined;\n\t}\n};\n\nconst scalars: Record<string, string> = Object.fromEntries(\n\t[...elementaryTypesByName].flatMap(([name, type]) => {\n\t\tconst typescript = scalarType(type);\n\t\treturn typescript ? [[name, typescript]] : [];\n\t}),\n);\n\n/** Recursively lists .st files in name order. */\nexport async function stFiles(directory: string): Promise<string[]> {\n\tconst entries = await readdir(directory, { withFileTypes: true });\n\tconst paths = await Promise.all(\n\t\tentries\n\t\t\t.sort((a, b) => {\n\t\t\t\tif (a.name === b.name) {\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t\treturn a.name < b.name ? -1 : 1;\n\t\t\t})\n\t\t\t.map(async (entry) => {\n\t\t\t\tconst file = join(directory, entry.name);\n\t\t\t\tif (entry.isDirectory()) {\n\t\t\t\t\treturn stFiles(file);\n\t\t\t\t}\n\t\t\t\treturn entry.isFile() && /\\.st$/i.test(file) ? [file] : [];\n\t\t\t}),\n\t);\n\treturn paths.flat();\n}\n\nconst quote = (value: string) => JSON.stringify(value);\nconst documentation = (value: string) =>\n\tvalue\n\t\t? `/** ${value.replace(/\\*\\//g, \"* /\").replace(/\\r?\\n/g, \"\\n * \")} */\\n`\n\t\t: \"\";\n\nfunction unique<T extends { name: string; source: string }>(\n\titems: T[],\n): Map<string, T> {\n\tconst result = new Map<string, T>();\n\tfor (const item of items) {\n\t\tconst key = item.name.toUpperCase();\n\t\tif (result.has(key)) {\n\t\t\tthrow new Error(\n\t\t\t\t`${item.source}: duplicate declaration ${item.name} (also in ${result.get(key)?.source})`,\n\t\t\t);\n\t\t}\n\t\tresult.set(key, item);\n\t}\n\treturn result;\n}\n\n/** Reads files concurrently, so they can be parsed in order and the first invalid one is reported. */\nconst readSources = (files: readonly string[]): Promise<Source[]> =>\n\tPromise.all(\n\t\tfiles.map(async (name) => ({ name, text: await readFile(name, \"utf8\") })),\n\t);\n\nexport async function generateTypes(options: GenerateOptions): Promise<string> {\n\tconst typeFiles =\n\t\ttypeof options.types === \"string\"\n\t\t\t? await stFiles(options.types)\n\t\t\t: options.types;\n\tconst declarations = (await readSources(typeFiles)).flatMap((source) =>\n\t\tparseDeclarations(source),\n\t);\n\tconst globalFiles =\n\t\ttypeof options.globals === \"string\"\n\t\t\t? await stFiles(options.globals)\n\t\t\t: (options.globals ?? []);\n\t// Program-only projects have a valid empty export selection. Directory\n\t// discovery still rejects empty input rather than hiding a bad setting.\n\tif (\n\t\t!typeFiles.length &&\n\t\t!globalFiles.length &&\n\t\t(typeof options.types === \"string\" || typeof options.globals === \"string\")\n\t) {\n\t\tthrow new Error(\n\t\t\t`no .st declarations found in ${typeof options.types === \"string\" ? options.types : \"the selected source files\"}`,\n\t\t);\n\t}\n\tconst globals = (await readSources(globalFiles)).map((source) =>\n\t\tparseGlobals(source, basename(source.name).replace(/\\.st$/i, \"\")),\n\t);\n\tconst publishedGlobalsOnly = options.publishedGlobalsOnly ?? false;\n\tconst contract = emit(\n\t\tdeclarations,\n\t\tpublishedGlobalsOnly ? published(globals, options.publication) : globals,\n\t\t{ publishedGlobalsOnly, emitDeclarations: options.declarations ?? true },\n\t);\n\treturn options.publication\n\t\t? `${contract}\\nexport const publication = ${JSON.stringify(options.publication, null, 2)} as const;\\n`\n\t\t: contract;\n}\n\n/**\n * Constant lists stay whole; a variable list keeps the members the publication names,\n * or without one those a symbol attribute publishes, and is dropped when none remain.\n */\nfunction published(\n\tglobals: GlobalList[],\n\tpublication: Publication | undefined,\n): GlobalList[] {\n\treturn globals\n\t\t.map((list) =>\n\t\t\tlist.constant\n\t\t\t\t? list\n\t\t\t\t: {\n\t\t\t\t\t\t...list,\n\t\t\t\t\t\tmembers: list.members.filter((member) =>\n\t\t\t\t\t\t\tpublication\n\t\t\t\t\t\t\t\t? [\n\t\t\t\t\t\t\t\t\t\t...publication.production,\n\t\t\t\t\t\t\t\t\t\t...publication.development,\n\t\t\t\t\t\t\t\t\t].includes(`${list.name}.${member.name}`)\n\t\t\t\t\t\t\t\t: member.published,\n\t\t\t\t\t\t),\n\t\t\t\t\t},\n\t\t)\n\t\t.filter((list) => list.constant || list.members.length);\n}\n\nfunction emit(\n\tdeclarations: Declaration[],\n\tglobals: GlobalList[],\n\t{\n\t\tpublishedGlobalsOnly,\n\t\temitDeclarations,\n\t}: { publishedGlobalsOnly: boolean; emitDeclarations: boolean },\n): string {\n\tconst types = unique(declarations);\n\tunique(globals);\n\tconst constants = globals.filter((list) => list.constant);\n\t// Keep integer constants useful to host clients, including declaration bounds.\n\t// Private block presets and labels cannot use this integer-only export format.\n\t// Their declarations still remain available to the lazy bound resolver below.\n\tconst constantLists = publishedGlobalsOnly\n\t\t? constants\n\t\t\t\t.map((list) => ({\n\t\t\t\t\t...list,\n\t\t\t\t\tmembers: list.members.filter(\n\t\t\t\t\t\t(member) =>\n\t\t\t\t\t\t\tmember.type.kind === \"named\" &&\n\t\t\t\t\t\t\tisNumberInteger(member.type.name.toUpperCase()),\n\t\t\t\t\t),\n\t\t\t\t}))\n\t\t\t\t.filter((list) => list.members.length)\n\t\t: constants;\n\tconst variableLists = globals.filter((list) => !list.constant);\n\tconst constant = constantResolver(constants);\n\n\tfunction bound(expression: string): number {\n\t\treturn integerExpression(expression, (name) => constant(name, null));\n\t}\n\tfunction dimensions(type: Extract<TypeReference, { kind: \"array\" }>) {\n\t\treturn type.dimensions.map(({ lower, upper }) => {\n\t\t\tconst start = bound(lower);\n\t\t\tconst end = bound(upper);\n\t\t\tif (end < start || !Number.isSafeInteger(end - start + 1)) {\n\t\t\t\tthrow new Error(`invalid array bounds ${lower}..${upper}`);\n\t\t\t}\n\t\t\treturn { start, end };\n\t\t});\n\t}\n\tfunction declaration(name: string): Declaration {\n\t\tconst found = types.get(name.toUpperCase());\n\t\tif (!found) {\n\t\t\tthrow new Error(`unknown IEC type ${name}`);\n\t\t}\n\t\treturn found;\n\t}\n\tfunction tsType(type: TypeReference): string {\n\t\tif (type.kind === \"array\") {\n\t\t\tdimensions(type);\n\t\t\treturn type.dimensions.reduce(\n\t\t\t\t(child) => `Array<${child}>`,\n\t\t\t\ttsType(type.element),\n\t\t\t);\n\t\t}\n\t\tif (type.kind === \"string\") {\n\t\t\tconst length = bound(type.length);\n\t\t\tif (length < 1) {\n\t\t\t\tthrow new Error(`invalid ${type.name} length ${length}`);\n\t\t\t}\n\t\t\treturn \"string\";\n\t\t}\n\t\treturn scalars[type.name.toUpperCase()] ?? declaration(type.name).name;\n\t}\n\tfunction resolved(type: TypeReference): TypeReference {\n\t\tif (type.kind !== \"named\" || scalars[type.name.toUpperCase()]) {\n\t\t\treturn type;\n\t\t}\n\t\tconst definition = declaration(type.name);\n\t\tif (definition.kind === \"alias\") {\n\t\t\treturn resolved(definition.type);\n\t\t}\n\t\tif (definition.kind === \"enum\") {\n\t\t\treturn { kind: \"named\", name: definition.base };\n\t\t}\n\t\treturn type;\n\t}\n\tfunction iecType(type: TypeReference): string {\n\t\tconst actual = resolved(type);\n\t\tif (actual.kind === \"string\") {\n\t\t\treturn `${actual.name}(${bound(actual.length)})`;\n\t\t}\n\t\tif (actual.kind === \"array\") {\n\t\t\treturn `ARRAY[${dimensions(actual)\n\t\t\t\t.map(({ start, end }) => `${start}..${end}`)\n\t\t\t\t.join(\", \")}] OF ${iecType(actual.element)}`;\n\t\t}\n\t\treturn scalars[actual.name.toUpperCase()]\n\t\t\t? actual.name.toUpperCase()\n\t\t\t: declaration(actual.name).name;\n\t}\n\n\t// Topological order makes generated field lists reusable without duplicating child fields.\n\tconst ordered: Declaration[] = [];\n\tconst visiting = new Set<string>();\n\tconst visited = new Set<string>();\n\tfunction visitReference(type: TypeReference): void {\n\t\tif (type.kind === \"array\") {\n\t\t\tvisitReference(type.element);\n\t\t\treturn;\n\t\t}\n\t\tif (type.kind === \"named\" && !scalars[type.name.toUpperCase()]) {\n\t\t\tvisit(declaration(type.name));\n\t\t}\n\t}\n\tfunction visit(type: Declaration): void {\n\t\tif (visited.has(type.name)) {\n\t\t\treturn;\n\t\t}\n\t\tif (visiting.has(type.name)) {\n\t\t\tthrow new Error(\n\t\t\t\t`${type.source}: cyclic type reference involving ${type.name}`,\n\t\t\t);\n\t\t}\n\t\tvisiting.add(type.name);\n\t\tif (type.kind === \"struct\") {\n\t\t\ttype.members.forEach((member) => {\n\t\t\t\tvisitReference(member.type);\n\t\t\t});\n\t\t}\n\t\tif (type.kind === \"alias\") {\n\t\t\tvisitReference(type.type);\n\t\t}\n\t\tvisiting.delete(type.name);\n\t\tvisited.add(type.name);\n\t\tordered.push(type);\n\t}\n\tdeclarations.forEach(visit);\n\n\tconst reserved = new Set(\n\t\t\"break case catch class const continue debugger default delete do else enum export extends false finally for function if import in instanceof new null return super switch this throw true try typeof var void while with yield let static implements interface package private protected public await arguments eval PlcGlobals PlcField typeFields symbols globalVariableLists publication\".split(\n\t\t\t\" \",\n\t\t),\n\t);\n\tfor (const name of [\n\t\t...declarations.map((type) => type.name),\n\t\t...constantLists.map((list) => list.name),\n\t]) {\n\t\tif (\n\t\t\t!identifierPattern.test(name) ||\n\t\t\treserved.has(name) ||\n\t\t\t/^_fields\\d+$/.test(name)\n\t\t) {\n\t\t\tthrow new Error(`name cannot be exported to TypeScript: ${name}`);\n\t\t}\n\t\treserved.add(name);\n\t}\n\tconst indexes = new Map(ordered.map((type, index) => [type.name, index]));\n\tfunction complex(type: TypeReference): boolean {\n\t\tconst actual = resolved(type);\n\t\tif (actual.kind === \"array\") {\n\t\t\treturn complex(actual.element);\n\t\t}\n\t\treturn actual.kind === \"named\" && !scalars[actual.name.toUpperCase()];\n\t}\n\t/** An enum-keyed array: like a record's fields, each key is its own contract variable. */\n\tfunction keyed(type: TypeReference): boolean {\n\t\tif (type.kind !== \"named\" || scalars[type.name.toUpperCase()]) {\n\t\t\treturn false;\n\t\t}\n\t\tconst definition = declaration(type.name);\n\t\treturn (\n\t\t\tdefinition.kind === \"alias\" &&\n\t\t\t(!!definition.keyed || keyed(definition.type))\n\t\t);\n\t}\n\tfunction fields(\n\t\ttype: TypeReference,\n\t\tpath: string,\n\t\tdescription: string,\n\t\tdepth = 0,\n\t): string {\n\t\tconst actual = resolved(type);\n\t\tif (actual.kind === \"named\" && complex(actual)) {\n\t\t\tconst children = `_fields${indexes.get(declaration(actual.name).name)}`;\n\t\t\tif (path === '\"\"') {\n\t\t\t\treturn children;\n\t\t\t}\n\t\t\treturn `${children}.map((member) => ({ ...member, field: ${path} + \".\" + member.field }))`;\n\t\t}\n\t\tif (actual.kind === \"array\" && (complex(actual.element) || keyed(type))) {\n\t\t\tconst ranges = dimensions(actual);\n\t\t\tconst coordinates = ranges.map(\n\t\t\t\t(range, index) => `String(i${depth}_${index} + (${range.start}))`,\n\t\t\t);\n\t\t\tconst arrayPath = `${path} + \"[\" + ${coordinates.join(' + \",\" + ')} + \"]\"`;\n\t\t\treturn ranges.reduceRight(\n\t\t\t\t(child, range, index) =>\n\t\t\t\t\t`Array.from({ length: ${range.end - range.start + 1} }, (_, i${depth}_${index}) => ${child}).flat()`,\n\t\t\t\tfields(actual.element, `(${arrayPath})`, description, depth + 1),\n\t\t\t);\n\t\t}\n\t\treturn `[{ field: ${path}, type: ${quote(iecType(actual))}, description: ${quote(description)} }]`;\n\t}\n\n\tconst declare = (text: string) => (emitDeclarations ? [text] : []);\n\tconst output = [\n\t\t\"// Generated by @tsplc/typegen. Edit the PLC sources and regenerate.\\n\",\n\t\t\"export interface PlcField { field: string; type: string; description: string; }\\n\",\n\t];\n\tfor (const type of ordered) {\n\t\ttry {\n\t\t\tconst doc = documentation(type.description);\n\t\t\tif (type.kind === \"struct\") {\n\t\t\t\toutput.push(\n\t\t\t\t\t...declare(\n\t\t\t\t\t\t`${doc}export interface ${type.name} {\\n${type.members.map((member) => `${documentation(member.description)}${quote(member.name)}: ${tsType(member.type)};`).join(\"\\n\")}\\n}\\n`,\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t\toutput.push(\n\t\t\t\t\t`const _fields${indexes.get(type.name)}: PlcField[] = [\\n${type.members.map((member) => `...${fields(member.type, quote(member.name), member.description)},`).join(\"\\n\")}\\n];\\n`,\n\t\t\t\t);\n\t\t\t} else if (type.kind === \"alias\") {\n\t\t\t\toutput.push(\n\t\t\t\t\t...declare(\n\t\t\t\t\t\t`${doc}export type ${type.name} = ${tsType(type.type)};\\n`,\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t\toutput.push(\n\t\t\t\t\t`const _fields${indexes.get(type.name)}: PlcField[] = ${fields({ kind: \"named\", name: type.name }, '\"\"', type.description)};\\n`,\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tif (!isNumberInteger(type.base)) {\n\t\t\t\t\tthrow new Error(`unsupported enum base ${type.base}`);\n\t\t\t\t}\n\t\t\t\tconst entries = new Map<string, number>();\n\t\t\t\tfor (const member of type.members) {\n\t\t\t\t\tconst previous = [...entries.values()].at(-1) ?? -1;\n\t\t\t\t\tconst value =\n\t\t\t\t\t\tmember.value === undefined\n\t\t\t\t\t\t\t? previous + 1\n\t\t\t\t\t\t\t: integerExpression(\n\t\t\t\t\t\t\t\t\tmember.value,\n\t\t\t\t\t\t\t\t\t(name) =>\n\t\t\t\t\t\t\t\t\t\tentries.get(name.toUpperCase()) ?? constant(name, null),\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\tentries.set(member.name.toUpperCase(), value);\n\t\t\t\t}\n\t\t\t\toutput.push(\n\t\t\t\t\t...declare(\n\t\t\t\t\t\t`${doc}export const ${type.name} = { ${type.members.map((member) => `${quote(member.name)}: ${entries.get(member.name.toUpperCase())}`).join(\", \")} } as const;\\nexport type ${type.name} = (typeof ${type.name})[keyof typeof ${type.name}];\\n`,\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t\toutput.push(\n\t\t\t\t\t`const _fields${indexes.get(type.name)}: PlcField[] = ${fields({ kind: \"named\", name: type.base }, '\"\"', type.description)};\\n`,\n\t\t\t\t);\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tthrow new Error(\n\t\t\t\t`${type.source} (${type.name}): ${error instanceof Error ? error.message : String(error)}`,\n\t\t\t\t{ cause: error },\n\t\t\t);\n\t\t}\n\t}\n\toutput.push(\n\t\t`export const typeFields = {\\n${ordered.map((type) => `${quote(type.name)}: _fields${indexes.get(type.name)},`).join(\"\\n\")}\\n};\\n`,\n\t);\n\tfor (const list of emitDeclarations ? constantLists : []) {\n\t\toutput.push(\n\t\t\t`${documentation(list.description)}export const ${list.name} = {\\n${list.members.map((member) => `${documentation(member.description)}${quote(member.name)}: ${constant(`${list.name}.${member.name}`, null)},`).join(\"\\n\")}\\n} as const;\\n`,\n\t\t);\n\t}\n\toutput.push(\n\t\t...declare(\n\t\t\t`export interface PlcGlobals {\\n${variableLists.map((list) => `${documentation(list.description)}${quote(list.name)}: {\\n${list.members.map((member) => `${documentation(member.description)}${quote(member.name)}: ${tsType(member.type)};`).join(\"\\n\")}\\n};`).join(\"\\n\")}\\n}\\n`,\n\t\t),\n\t);\n\toutput.push(\n\t\t`export const globalVariableLists = ${JSON.stringify(Object.fromEntries(variableLists.map((list) => [list.name, list.description])), null, \"\\t\")} as const;\\n`,\n\t);\n\toutput.push(\n\t\t`export const symbols = ${JSON.stringify(\n\t\t\tvariableLists.flatMap((list) =>\n\t\t\t\tlist.members.map((member) => ({\n\t\t\t\t\tname: member.name,\n\t\t\t\t\tgvl: list.name,\n\t\t\t\t\ttype:\n\t\t\t\t\t\tmember.type.kind === \"named\" &&\n\t\t\t\t\t\t!scalars[member.type.name.toUpperCase()]\n\t\t\t\t\t\t\t? declaration(member.type.name).name\n\t\t\t\t\t\t\t: iecType(member.type),\n\t\t\t\t\tdescription: member.description,\n\t\t\t\t})),\n\t\t\t),\n\t\t\tnull,\n\t\t\t\"\\t\",\n\t\t)} as const;\\n`,\n\t);\n\treturn output.join(\"\\n\");\n}\n",
6
6
  "import {\n\telementaryType,\n\telementaryTypes,\n\tintegerRange,\n\tisIntegerValued,\n} from \"@tsplc/iec\";\nimport type { GlobalList } from \"./parser.ts\";\n\n// Constants and enum values are emitted as numbers, so they take integer types of 32 bits and under.\nexport const isNumberInteger = (name: string) => {\n\tconst type = elementaryType(name);\n\treturn isIntegerValued(type) && type.bits <= 32;\n};\n\nconst integerRanges = new Map(\n\telementaryTypes\n\t\t.filter(isIntegerValued)\n\t\t.map((type) => [type.name, integerRange(type)] as const),\n);\nconst integerToken = new RegExp(\n\tString.raw`(?:${[...integerRanges.keys()].join(\"|\")})\\s*#\\s*[+-]?(?:(?:2|8|16)#[\\da-fA-F_]+|\\d[\\d_]*)|(?:2|8|16)#[\\da-fA-F_]+|\\d[\\d_]*|[A-Za-z_]\\w*(?:\\s*\\.\\s*[A-Za-z_]\\w*)?|[()+\\-*/]`,\n\t\"g\",\n);\n\n/** Evaluate the integer-expression subset used for array bounds and constants. Never executes PLC text. */\nexport function integerExpression(\n\ttext: string,\n\tlookup: (name: string) => number,\n): number {\n\tconst compact = text.replace(/\\s+/g, \"\");\n\tconst tokens = (text.match(integerToken) ?? []).map((token) =>\n\t\ttoken.replace(/\\s+/g, \"\"),\n\t);\n\tif (tokens.join(\"\") !== compact || !tokens.length) {\n\t\tthrow new Error(`unsupported integer expression: ${text}`);\n\t}\n\tconst safe = (value: number) => {\n\t\tif (!Number.isSafeInteger(value)) {\n\t\t\tthrow new Error(`integer outside JavaScript's safe range: ${text}`);\n\t\t}\n\t\treturn value;\n\t};\n\tlet position = 0;\n\tfunction atom(): number {\n\t\tconst token = tokens[position++];\n\t\tif (token === \"+\") {\n\t\t\treturn atom();\n\t\t}\n\t\tif (token === \"-\") {\n\t\t\treturn -atom();\n\t\t}\n\t\tif (token === \"(\") {\n\t\t\tconst value = sum();\n\t\t\tif (tokens[position++] !== \")\") {\n\t\t\t\tthrow new Error(`unclosed integer expression: ${text}`);\n\t\t\t}\n\t\t\treturn value;\n\t\t}\n\t\tconst typed =\n\t\t\ttoken &&\n\t\t\t[...integerRanges].find(([name]) =>\n\t\t\t\ttoken.toUpperCase().startsWith(`${name}#`),\n\t\t\t);\n\t\tif (typed) {\n\t\t\tconst [name, [minimum, maximum]] = typed;\n\t\t\tconst value = integerExpression(token.slice(name.length + 1), lookup);\n\t\t\tif (BigInt(value) < minimum || BigInt(value) > maximum) {\n\t\t\t\tthrow new Error(`typed integer outside ${name}: ${token}`);\n\t\t\t}\n\t\t\treturn value;\n\t\t}\n\t\tif (token && /^\\d/.test(token)) {\n\t\t\tconst [base, digits] = token.replace(/_/g, \"\").split(\"#\");\n\t\t\tif (\n\t\t\t\tdigits !== undefined &&\n\t\t\t\t![...digits].every((digit) => parseInt(digit, 16) < Number(base))\n\t\t\t) {\n\t\t\t\tthrow new Error(`invalid base-${base} literal: ${token}`);\n\t\t\t}\n\t\t\treturn safe(\n\t\t\t\tdigits === undefined ? Number(base) : parseInt(digits, Number(base)),\n\t\t\t);\n\t\t}\n\t\tif (token && /^[A-Za-z_]/.test(token)) {\n\t\t\treturn lookup(token);\n\t\t}\n\t\tthrow new Error(`invalid integer expression: ${text}`);\n\t}\n\tfunction product(): number {\n\t\tlet value = atom();\n\t\twhile (tokens[position] === \"*\" || tokens[position] === \"/\") {\n\t\t\tconst operator = tokens[position++];\n\t\t\tconst right = atom();\n\t\t\tif (operator === \"/\" && right === 0) {\n\t\t\t\tthrow new Error(`division by zero: ${text}`);\n\t\t\t}\n\t\t\tvalue = safe(\n\t\t\t\toperator === \"*\" ? value * right : Math.trunc(value / right),\n\t\t\t);\n\t\t}\n\t\treturn value;\n\t}\n\tfunction sum(): number {\n\t\tlet value = product();\n\t\twhile (tokens[position] === \"+\" || tokens[position] === \"-\") {\n\t\t\tconst operator = tokens[position++];\n\t\t\tconst right = product();\n\t\t\tvalue = safe(operator === \"+\" ? value + right : value - right);\n\t\t}\n\t\treturn value;\n\t}\n\tconst value = sum();\n\tif (position !== tokens.length || !Number.isSafeInteger(value)) {\n\t\tthrow new Error(`invalid or unsafe integer expression: ${text}`);\n\t}\n\treturn value;\n}\n\n/**\n * Looks constants of CONSTANT global lists up by qualified name, or by a bare name that\n * only one list declares; inside a list's own initializers (`scope`), its members come\n * first. Each is evaluated once, when first used, so they may refer to each other in\n * any order.\n */\nexport function constantResolver(\n\tlists: readonly GlobalList[],\n): (name: string, scope: string | null) => number {\n\tconst values = new Map<string, number>();\n\tconst resolving = new Set<string>();\n\tconst definitions = lists.flatMap((list) =>\n\t\tlist.members.map((member) => ({\n\t\t\tlist,\n\t\t\tmember,\n\t\t\tkey: `${list.name}.${member.name}`.toUpperCase(),\n\t\t})),\n\t);\n\tconst constant = (name: string, scope: string | null): number => {\n\t\tconst key = name.toUpperCase();\n\t\tconst scoped =\n\t\t\tscope === null\n\t\t\t\t? undefined\n\t\t\t\t: definitions.find(\n\t\t\t\t\t\t(item) => item.key === `${scope}.${name}`.toUpperCase(),\n\t\t\t\t\t);\n\t\tconst [definition, ...others] = scoped\n\t\t\t? [scoped]\n\t\t\t: definitions.filter(\n\t\t\t\t\t(item) =>\n\t\t\t\t\t\titem.key === key ||\n\t\t\t\t\t\t(!name.includes(\".\") && item.member.name.toUpperCase() === key),\n\t\t\t\t);\n\t\tif (!definition || others.length) {\n\t\t\tthrow new Error(`unknown or ambiguous constant ${name}`);\n\t\t}\n\t\tconst cached = values.get(definition.key);\n\t\tif (cached !== undefined) {\n\t\t\treturn cached;\n\t\t}\n\t\tif (resolving.has(definition.key)) {\n\t\t\tthrow new Error(`cyclic constant ${name}`);\n\t\t}\n\t\tconst { member, list } = definition;\n\t\tif (\n\t\t\tmember.initial === undefined ||\n\t\t\tmember.type.kind !== \"named\" ||\n\t\t\t!isNumberInteger(member.type.name.toUpperCase())\n\t\t) {\n\t\t\tthrow new Error(\n\t\t\t\t`${list.source}: constant ${member.name} must have an integer type and initializer`,\n\t\t\t);\n\t\t}\n\t\tresolving.add(definition.key);\n\t\tconst value = integerExpression(member.initial, (reference) =>\n\t\t\tconstant(reference, list.name),\n\t\t);\n\t\tresolving.delete(definition.key);\n\t\tvalues.set(definition.key, value);\n\t\treturn value;\n\t};\n\treturn constant;\n}\n",
7
- "import {\n\tblockCommentEnd,\n\tdirectAddressEnd,\n\tidentifierPattern,\n\tlineCommentEnd,\n\tqualifiers,\n} from \"@tsplc/iec/st\";\n\nexport interface Source {\n\tname: string;\n\ttext: string;\n}\n\nexport type TypeReference =\n\t| { kind: \"named\"; name: string }\n\t| { kind: \"string\"; name: \"STRING\" | \"WSTRING\"; length: string }\n\t| {\n\t\t\tkind: \"array\";\n\t\t\tdimensions: { lower: string; upper: string }[];\n\t\t\telement: TypeReference;\n\t };\n\nexport interface Member {\n\tname: string;\n\tdescription: string;\n\ttype: TypeReference;\n\tinitial?: string;\n\t/** A CODESYS symbol attribute explicitly publishes this global for clients. */\n\tpublished?: boolean;\n}\n\nexport type Declaration = {\n\tname: string;\n\tdescription: string;\n\tsource: string;\n} & (\n\t| { kind: \"struct\"; members: Member[] }\n\t| {\n\t\t\tkind: \"alias\";\n\t\t\ttype: TypeReference;\n\t\t\t/** `{attribute 'tsplc_keyed'}`: an array whose indexes are enum keys, so each element is its own contract variable. */\n\t\t\tkeyed?: boolean;\n\t }\n\t| {\n\t\t\tkind: \"enum\";\n\t\t\tmembers: { name: string; value?: string }[];\n\t\t\tbase: string;\n\t }\n);\n\nexport interface GlobalList {\n\tname: string;\n\tdescription: string;\n\tsource: string;\n\tconstant: boolean;\n\tmembers: Member[];\n}\n\ninterface Token {\n\ttext: string;\n\toffset: number;\n\tkind: \"code\" | \"comment\" | \"attribute\";\n}\n\nfunction tokenize(source: Source): Token[] {\n\tconst tokens: Token[] = [];\n\tlet offset = 0;\n\twhile (offset < source.text.length) {\n\t\tconst rest = source.text.slice(offset);\n\t\tconst whitespace = /^\\s+/.exec(rest);\n\t\tif (whitespace) {\n\t\t\toffset += whitespace[0].length;\n\t\t\tcontinue;\n\t\t}\n\t\tif (rest.startsWith(\"(*\")) {\n\t\t\tconst end = blockCommentEnd(source.text, offset);\n\t\t\tif (end === null) {\n\t\t\t\tthrow new Error(`${source.name}: unterminated comment`);\n\t\t\t}\n\t\t\ttokens.push({\n\t\t\t\ttext: source.text.slice(offset + 2, end - 2).trim(),\n\t\t\t\toffset,\n\t\t\t\tkind: \"comment\",\n\t\t\t});\n\t\t\toffset = end;\n\t\t\tcontinue;\n\t\t}\n\t\tif (rest.startsWith(\"//\")) {\n\t\t\tconst end = lineCommentEnd(source.text, offset);\n\t\t\ttokens.push({\n\t\t\t\ttext: source.text.slice(offset + 2, end).trim(),\n\t\t\t\toffset,\n\t\t\t\tkind: \"comment\",\n\t\t\t});\n\t\t\toffset = end;\n\t\t\tcontinue;\n\t\t}\n\t\tconst attribute =\n\t\t\t/^\\{(?:[^}'\"]|'(?:\\$[\\s\\S]|''|[^'])*'|\"(?:\\$[\\s\\S]|\"\"|[^\"])*\")*\\}/.exec(\n\t\t\t\trest,\n\t\t\t);\n\t\tif (attribute) {\n\t\t\ttokens.push({ text: attribute[0], offset, kind: \"attribute\" });\n\t\t\toffset += attribute[0].length;\n\t\t\tcontinue;\n\t\t}\n\t\tconst addressEnd = directAddressEnd(source.text, offset);\n\t\tif (addressEnd !== null) {\n\t\t\ttokens.push({\n\t\t\t\ttext: source.text.slice(offset, addressEnd),\n\t\t\t\toffset,\n\t\t\t\tkind: \"code\",\n\t\t\t});\n\t\t\toffset = addressEnd;\n\t\t\tcontinue;\n\t\t}\n\t\tconst code =\n\t\t\t/^(?:'(?:\\$[\\s\\S]|''|[^'])*'|\"(?:\\$[\\s\\S]|\"\"|[^\"])*\"|\\d[\\d_]*#[\\da-fA-F_]+|\\d[\\d_]*(?:\\.(?!\\.)[\\d_]+)?(?:[eE][+-]?\\d+)?|[A-Za-z_]\\w*|:=|\\.\\.|[[\\]():;,.+\\-*/#])/i.exec(\n\t\t\t\trest,\n\t\t\t);\n\t\tif (!code) {\n\t\t\tthrow new Error(\n\t\t\t\t`${source.name}:${source.text.slice(0, offset).split(\"\\n\").length}: unsupported token ${JSON.stringify(rest.slice(0, 24))}`,\n\t\t\t);\n\t\t}\n\t\ttokens.push({ text: code[0], offset, kind: \"code\" });\n\t\toffset += code[0].length;\n\t}\n\treturn tokens;\n}\n\nclass Parser {\n\tprivate position = 0;\n\tprivate readonly tokens: Token[];\n\tconstructor(private readonly source: Source) {\n\t\tthis.tokens = tokenize(source);\n\t}\n\n\tprivate nextIndex(): number {\n\t\tlet index = this.position;\n\t\twhile (index < this.tokens.length && this.tokens[index]?.kind !== \"code\") {\n\t\t\tindex++;\n\t\t}\n\t\treturn index;\n\t}\n\n\tpeek(): string {\n\t\treturn this.tokens[this.nextIndex()]?.text.toUpperCase() ?? \"\";\n\t}\n\n\terror(message: string): never {\n\t\tconst offset =\n\t\t\tthis.tokens[this.nextIndex()]?.offset ?? this.source.text.length;\n\t\tthrow new Error(\n\t\t\t`${this.source.name}:${this.source.text.slice(0, offset).split(\"\\n\").length}: ${message}`,\n\t\t);\n\t}\n\n\tprivate take(): string {\n\t\tthis.position = this.nextIndex();\n\t\tconst token = this.tokens[this.position++];\n\t\tif (!token) {\n\t\t\tthis.error(\"unexpected end of declaration\");\n\t\t}\n\t\treturn token.text;\n\t}\n\n\tprivate accept(value: string): boolean {\n\t\tif (this.peek() !== value) {\n\t\t\treturn false;\n\t\t}\n\t\tthis.take();\n\t\treturn true;\n\t}\n\n\tprivate expect(value: string): void {\n\t\tif (!this.accept(value)) {\n\t\t\tthis.error(`expected ${value}, found ${this.peek() || \"end of file\"}`);\n\t\t}\n\t}\n\n\tprivate identifier(): string {\n\t\tconst name = this.take();\n\t\tif (!identifierPattern.test(name)) {\n\t\t\tthis.error(`expected identifier, found ${name}`);\n\t\t}\n\t\treturn name;\n\t}\n\n\tprivate documentation(): string {\n\t\tconst end = this.nextIndex();\n\t\tconst text = this.tokens\n\t\t\t.slice(this.position, end)\n\t\t\t.filter((token) => token.kind === \"comment\")\n\t\t\t.map((token) => token.text)\n\t\t\t.join(\"\\n\");\n\t\tthis.position = end;\n\t\treturn text;\n\t}\n\n\tprivate expression(stops: string[]): string {\n\t\tconst values: string[] = [];\n\t\tconst closing: string[] = [];\n\t\twhile (this.peek() && (closing.length || !stops.includes(this.peek()))) {\n\t\t\tconst token = this.take();\n\t\t\tif (token === \"(\" || token === \"[\") {\n\t\t\t\tclosing.push(token === \"(\" ? \")\" : \"]\");\n\t\t\t}\n\t\t\tif (token === \")\" || token === \"]\") {\n\t\t\t\tif (closing.pop() !== token) {\n\t\t\t\t\tthis.error(`unmatched ${token}`);\n\t\t\t\t}\n\t\t\t}\n\t\t\tvalues.push(token);\n\t\t}\n\t\tif (!values.length || closing.length) {\n\t\t\tthis.error(\"incomplete expression\");\n\t\t}\n\t\treturn values.join(\" \");\n\t}\n\n\tprivate reference(): TypeReference {\n\t\tif (this.accept(\"ARRAY\")) {\n\t\t\tthis.expect(\"[\");\n\t\t\tconst dimensions: { lower: string; upper: string }[] = [];\n\t\t\tdo {\n\t\t\t\tconst lower = this.expression([\"..\"]);\n\t\t\t\tthis.expect(\"..\");\n\t\t\t\tconst upper = this.expression([\",\", \"]\"]);\n\t\t\t\tdimensions.push({ lower, upper });\n\t\t\t} while (this.accept(\",\"));\n\t\t\tthis.expect(\"]\");\n\t\t\tthis.expect(\"OF\");\n\t\t\treturn { kind: \"array\", dimensions, element: this.reference() };\n\t\t}\n\t\tconst parts = [this.identifier()];\n\t\twhile (this.accept(\".\")) {\n\t\t\tparts.push(this.identifier());\n\t\t}\n\t\tconst name = parts.join(\".\");\n\t\tconst upper = name.toUpperCase();\n\t\tif (upper === \"STRING\" || upper === \"WSTRING\") {\n\t\t\tconst opening = this.peek();\n\t\t\tif (opening !== \"(\" && opening !== \"[\") {\n\t\t\t\treturn { kind: \"string\", name: upper, length: \"80\" };\n\t\t\t}\n\t\t\tthis.take();\n\t\t\tconst closing = opening === \"(\" ? \")\" : \"]\";\n\t\t\tconst length = this.expression([closing]);\n\t\t\tthis.expect(closing);\n\t\t\treturn { kind: \"string\", name: upper, length };\n\t\t}\n\t\treturn { kind: \"named\", name };\n\t}\n\n\tprivate members(end: string): Member[] {\n\t\tconst members: Member[] = [];\n\t\twhile (this.peek() !== end) {\n\t\t\tconst published = this.tokens\n\t\t\t\t.slice(this.position, this.nextIndex())\n\t\t\t\t.some(\n\t\t\t\t\t(token) =>\n\t\t\t\t\t\ttoken.kind === \"attribute\" &&\n\t\t\t\t\t\t/^\\{\\s*attribute\\s+'symbol'\\s*:=\\s*'(?:read|write|readwrite)'\\s*\\}$/i.test(\n\t\t\t\t\t\t\ttoken.text,\n\t\t\t\t\t\t),\n\t\t\t\t);\n\t\t\tconst description = this.documentation();\n\t\t\tconst names = [this.identifier()];\n\t\t\twhile (this.accept(\",\")) {\n\t\t\t\tnames.push(this.identifier());\n\t\t\t}\n\t\t\tif (this.accept(\"AT\")) {\n\t\t\t\t// Location belongs to the hardware/build mapping; it does not alter the\n\t\t\t\t// scalar type that application consumers receive from type generation.\n\t\t\t\tconst address = this.take();\n\t\t\t\tif (directAddressEnd(address, 0) !== address.length) {\n\t\t\t\t\tthis.error(`expected direct address after AT, found ${address}`);\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.expect(\":\");\n\t\t\tconst type = this.reference();\n\t\t\tconst initial = this.accept(\":=\") ? this.expression([\";\"]) : undefined;\n\t\t\tthis.expect(\";\");\n\t\t\tfor (const name of names) {\n\t\t\t\tif (\n\t\t\t\t\tmembers.some(\n\t\t\t\t\t\t(member) => member.name.toUpperCase() === name.toUpperCase(),\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\tthis.error(`duplicate member ${name}`);\n\t\t\t\t}\n\t\t\t\tmembers.push({\n\t\t\t\t\tname,\n\t\t\t\t\tdescription,\n\t\t\t\t\ttype,\n\t\t\t\t\t...(initial === undefined ? {} : { initial }),\n\t\t\t\t\t...(published ? { published: true } : {}),\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t\tthis.expect(end);\n\t\treturn members;\n\t}\n\n\tdeclarations(): Declaration[] {\n\t\tconst declarations: Declaration[] = [];\n\t\twhile (this.peek()) {\n\t\t\tconst keyed = this.tokens\n\t\t\t\t.slice(this.position, this.nextIndex())\n\t\t\t\t.some(\n\t\t\t\t\t(token) =>\n\t\t\t\t\t\ttoken.kind === \"attribute\" &&\n\t\t\t\t\t\t/^\\{\\s*attribute\\s+'tsplc_keyed'\\s*\\}$/i.test(token.text),\n\t\t\t\t);\n\t\t\tconst description = this.documentation();\n\t\t\tthis.expect(\"TYPE\");\n\t\t\tconst name = this.identifier();\n\t\t\tthis.expect(\":\");\n\t\t\tconst common = { name, description, source: this.source.name };\n\t\t\tif (this.accept(\"STRUCT\")) {\n\t\t\t\tdeclarations.push({\n\t\t\t\t\t...common,\n\t\t\t\t\tkind: \"struct\",\n\t\t\t\t\tmembers: this.members(\"END_STRUCT\"),\n\t\t\t\t});\n\t\t\t\tthis.accept(\";\");\n\t\t\t} else if (this.accept(\"(\")) {\n\t\t\t\tconst members: { name: string; value?: string }[] = [];\n\t\t\t\tdo {\n\t\t\t\t\tconst member = this.identifier();\n\t\t\t\t\tconst value = this.accept(\":=\")\n\t\t\t\t\t\t? this.expression([\",\", \")\"])\n\t\t\t\t\t\t: undefined;\n\t\t\t\t\tif (\n\t\t\t\t\t\tmembers.some(\n\t\t\t\t\t\t\t(item) => item.name.toUpperCase() === member.toUpperCase(),\n\t\t\t\t\t\t)\n\t\t\t\t\t) {\n\t\t\t\t\t\tthis.error(`duplicate enum member ${member}`);\n\t\t\t\t\t}\n\t\t\t\t\tmembers.push({ name: member, value });\n\t\t\t\t} while (this.accept(\",\") && this.peek() !== \")\");\n\t\t\t\tthis.expect(\")\");\n\t\t\t\tconst base =\n\t\t\t\t\tthis.peek() === \";\" ? \"INT\" : this.identifier().toUpperCase();\n\t\t\t\tthis.expect(\";\");\n\t\t\t\tdeclarations.push({ ...common, kind: \"enum\", members, base });\n\t\t\t} else {\n\t\t\t\tconst type = this.reference();\n\t\t\t\tthis.expect(\";\");\n\t\t\t\tdeclarations.push({\n\t\t\t\t\t...common,\n\t\t\t\t\tkind: \"alias\",\n\t\t\t\t\ttype,\n\t\t\t\t\t...(keyed ? { keyed } : {}),\n\t\t\t\t});\n\t\t\t}\n\t\t\tthis.expect(\"END_TYPE\");\n\t\t\tthis.accept(\";\");\n\t\t}\n\t\tif (!declarations.length) {\n\t\t\tthis.error(\"no TYPE declarations found\");\n\t\t}\n\t\treturn declarations;\n\t}\n\n\tglobals(name: string): GlobalList {\n\t\tconst description = this.documentation();\n\t\tthis.expect(\"VAR_GLOBAL\");\n\t\tconst written = new Set<string>();\n\t\twhile (qualifiers.has(this.peek())) {\n\t\t\tconst qualifier = this.take().toUpperCase();\n\t\t\tif (written.has(qualifier)) {\n\t\t\t\tthis.error(`duplicate ${qualifier} qualifier`);\n\t\t\t}\n\t\t\twritten.add(qualifier);\n\t\t}\n\t\tconst members = this.members(\"END_VAR\");\n\t\tthis.accept(\";\");\n\t\tif (this.peek()) {\n\t\t\tthis.error(\"only one VAR_GLOBAL block per file is supported\");\n\t\t}\n\t\treturn {\n\t\t\tname,\n\t\t\tdescription,\n\t\t\tsource: this.source.name,\n\t\t\tconstant: written.has(\"CONSTANT\"),\n\t\t\tmembers,\n\t\t};\n\t}\n}\n\nexport function parseDeclarations(source: Source): Declaration[] {\n\treturn new Parser(source).declarations();\n}\n\nexport function parseGlobals(source: Source, name: string): GlobalList {\n\treturn new Parser(source).globals(name);\n}\n"
7
+ "import {\n\tblockCommentEnd,\n\tdirectAddressEnd,\n\tidentifierPattern,\n\tlineCommentEnd,\n\tqualifiers,\n} from \"@tsplc/iec/st\";\n\nexport interface Source {\n\tname: string;\n\ttext: string;\n}\n\nexport type TypeReference =\n\t| { kind: \"named\"; name: string }\n\t| { kind: \"string\"; name: \"STRING\" | \"WSTRING\"; length: string }\n\t| {\n\t\t\tkind: \"array\";\n\t\t\tdimensions: { lower: string; upper: string }[];\n\t\t\telement: TypeReference;\n\t };\n\nexport interface Member {\n\tname: string;\n\tdescription: string;\n\ttype: TypeReference;\n\tinitial?: string;\n\t/** A CODESYS symbol attribute explicitly publishes this global for clients. */\n\tpublished?: boolean;\n}\n\nexport type Declaration = {\n\tname: string;\n\tdescription: string;\n\tsource: string;\n} & (\n\t| { kind: \"struct\"; members: Member[] }\n\t| {\n\t\t\tkind: \"alias\";\n\t\t\ttype: TypeReference;\n\t\t\t/** `{attribute 'tsplc_keyed'}`: an array whose indexes are enum keys, so each element is its own contract variable. */\n\t\t\tkeyed?: boolean;\n\t }\n\t| {\n\t\t\tkind: \"enum\";\n\t\t\tmembers: { name: string; value?: string }[];\n\t\t\tbase: string;\n\t }\n);\n\nexport interface GlobalList {\n\tname: string;\n\tdescription: string;\n\tsource: string;\n\tconstant: boolean;\n\tmembers: Member[];\n}\n\ninterface Token {\n\ttext: string;\n\toffset: number;\n\tkind: \"code\" | \"comment\" | \"attribute\";\n}\n\nfunction tokenize(source: Source): Token[] {\n\tconst tokens: Token[] = [];\n\tlet offset = 0;\n\twhile (offset < source.text.length) {\n\t\tconst rest = source.text.slice(offset);\n\t\tconst whitespace = /^\\s+/.exec(rest);\n\t\tif (whitespace) {\n\t\t\toffset += whitespace[0].length;\n\t\t\tcontinue;\n\t\t}\n\t\tif (rest.startsWith(\"(*\")) {\n\t\t\tconst end = blockCommentEnd(source.text, offset);\n\t\t\tif (end === null) {\n\t\t\t\tthrow new Error(`${source.name}: unterminated comment`);\n\t\t\t}\n\t\t\ttokens.push({\n\t\t\t\ttext: source.text.slice(offset + 2, end - 2).trim(),\n\t\t\t\toffset,\n\t\t\t\tkind: \"comment\",\n\t\t\t});\n\t\t\toffset = end;\n\t\t\tcontinue;\n\t\t}\n\t\tif (rest.startsWith(\"//\")) {\n\t\t\tconst end = lineCommentEnd(source.text, offset);\n\t\t\ttokens.push({\n\t\t\t\ttext: source.text.slice(offset + 2, end).trim(),\n\t\t\t\toffset,\n\t\t\t\tkind: \"comment\",\n\t\t\t});\n\t\t\toffset = end;\n\t\t\tcontinue;\n\t\t}\n\t\tconst attribute =\n\t\t\t/^\\{(?:[^}'\"]|'(?:\\$[\\s\\S]|''|[^'])*'|\"(?:\\$[\\s\\S]|\"\"|[^\"])*\")*\\}/.exec(\n\t\t\t\trest,\n\t\t\t);\n\t\tif (attribute) {\n\t\t\ttokens.push({ text: attribute[0], offset, kind: \"attribute\" });\n\t\t\toffset += attribute[0].length;\n\t\t\tcontinue;\n\t\t}\n\t\tconst addressEnd = directAddressEnd(source.text, offset);\n\t\tif (addressEnd !== null) {\n\t\t\ttokens.push({\n\t\t\t\ttext: source.text.slice(offset, addressEnd),\n\t\t\t\toffset,\n\t\t\t\tkind: \"code\",\n\t\t\t});\n\t\t\toffset = addressEnd;\n\t\t\tcontinue;\n\t\t}\n\t\tconst code =\n\t\t\t/^(?:'(?:\\$[\\s\\S]|''|[^'])*'|\"(?:\\$[\\s\\S]|\"\"|[^\"])*\"|\\d[\\d_]*#[\\da-fA-F_]+|\\d[\\d_]*(?:\\.(?!\\.)[\\d_]+)?(?:[eE][+-]?\\d+)?|[A-Za-z_]\\w*|:=|\\.\\.|[[\\]():;,.+\\-*/#])/i.exec(\n\t\t\t\trest,\n\t\t\t);\n\t\tif (!code) {\n\t\t\tthrow new Error(\n\t\t\t\t`${source.name}:${source.text.slice(0, offset).split(\"\\n\").length}: unsupported token ${JSON.stringify(rest.slice(0, 24))}`,\n\t\t\t);\n\t\t}\n\t\ttokens.push({ text: code[0], offset, kind: \"code\" });\n\t\toffset += code[0].length;\n\t}\n\treturn tokens;\n}\n\nclass Parser {\n\tprivate position = 0;\n\tprivate readonly tokens: Token[];\n\tconstructor(private readonly source: Source) {\n\t\tthis.tokens = tokenize(source);\n\t}\n\n\tprivate nextIndex(): number {\n\t\tlet index = this.position;\n\t\twhile (index < this.tokens.length && this.tokens[index]?.kind !== \"code\") {\n\t\t\tindex++;\n\t\t}\n\t\treturn index;\n\t}\n\n\tpeek(): string {\n\t\treturn this.tokens[this.nextIndex()]?.text.toUpperCase() ?? \"\";\n\t}\n\n\terror(message: string): never {\n\t\tconst offset =\n\t\t\tthis.tokens[this.nextIndex()]?.offset ?? this.source.text.length;\n\t\tthrow new Error(\n\t\t\t`${this.source.name}:${this.source.text.slice(0, offset).split(\"\\n\").length}: ${message}`,\n\t\t);\n\t}\n\n\tprivate take(): string {\n\t\tthis.position = this.nextIndex();\n\t\tconst token = this.tokens[this.position++];\n\t\tif (!token) {\n\t\t\tthis.error(\"unexpected end of declaration\");\n\t\t}\n\t\treturn token.text;\n\t}\n\n\tprivate accept(value: string): boolean {\n\t\tif (this.peek() !== value) {\n\t\t\treturn false;\n\t\t}\n\t\tthis.take();\n\t\treturn true;\n\t}\n\n\tprivate expect(value: string): void {\n\t\tif (!this.accept(value)) {\n\t\t\tthis.error(`expected ${value}, found ${this.peek() || \"end of file\"}`);\n\t\t}\n\t}\n\n\tprivate identifier(): string {\n\t\tconst name = this.take();\n\t\tif (!identifierPattern.test(name)) {\n\t\t\tthis.error(`expected identifier, found ${name}`);\n\t\t}\n\t\treturn name;\n\t}\n\n\tprivate documentation(): string {\n\t\tconst end = this.nextIndex();\n\t\tconst text = this.tokens\n\t\t\t.slice(this.position, end)\n\t\t\t.filter((token) => token.kind === \"comment\")\n\t\t\t.map((token) => token.text)\n\t\t\t.join(\"\\n\");\n\t\tthis.position = end;\n\t\treturn text;\n\t}\n\n\tprivate expression(stops: string[]): string {\n\t\tconst values: string[] = [];\n\t\tconst closing: string[] = [];\n\t\twhile (this.peek() && (closing.length || !stops.includes(this.peek()))) {\n\t\t\tconst token = this.take();\n\t\t\tif (token === \"(\" || token === \"[\") {\n\t\t\t\tclosing.push(token === \"(\" ? \")\" : \"]\");\n\t\t\t}\n\t\t\tif (token === \")\" || token === \"]\") {\n\t\t\t\tif (closing.pop() !== token) {\n\t\t\t\t\tthis.error(`unmatched ${token}`);\n\t\t\t\t}\n\t\t\t}\n\t\t\tvalues.push(token);\n\t\t}\n\t\tif (!values.length || closing.length) {\n\t\t\tthis.error(\"incomplete expression\");\n\t\t}\n\t\treturn values.join(\" \");\n\t}\n\n\tprivate reference(): TypeReference {\n\t\tif (this.accept(\"ARRAY\")) {\n\t\t\tthis.expect(\"[\");\n\t\t\tconst dimensions: { lower: string; upper: string }[] = [];\n\t\t\tdo {\n\t\t\t\tconst lower = this.expression([\"..\"]);\n\t\t\t\tthis.expect(\"..\");\n\t\t\t\tconst upper = this.expression([\",\", \"]\"]);\n\t\t\t\tdimensions.push({ lower, upper });\n\t\t\t} while (this.accept(\",\"));\n\t\t\tthis.expect(\"]\");\n\t\t\tthis.expect(\"OF\");\n\t\t\treturn { kind: \"array\", dimensions, element: this.reference() };\n\t\t}\n\t\tconst parts = [this.identifier()];\n\t\twhile (this.accept(\".\")) {\n\t\t\tparts.push(this.identifier());\n\t\t}\n\t\tconst name = parts.join(\".\");\n\t\tconst upper = name.toUpperCase();\n\t\tif (upper === \"STRING\" || upper === \"WSTRING\") {\n\t\t\tconst opening = this.peek();\n\t\t\tif (opening !== \"(\" && opening !== \"[\") {\n\t\t\t\treturn { kind: \"string\", name: upper, length: \"80\" };\n\t\t\t}\n\t\t\tthis.take();\n\t\t\tconst closing = opening === \"(\" ? \")\" : \"]\";\n\t\t\tconst length = this.expression([closing]);\n\t\t\tthis.expect(closing);\n\t\t\treturn { kind: \"string\", name: upper, length };\n\t\t}\n\t\treturn { kind: \"named\", name };\n\t}\n\n\tprivate members(end: string): Member[] {\n\t\tconst members: Member[] = [];\n\t\twhile (this.peek() !== end) {\n\t\t\tconst published = this.tokens\n\t\t\t\t.slice(this.position, this.nextIndex())\n\t\t\t\t.some(\n\t\t\t\t\t(token) =>\n\t\t\t\t\t\ttoken.kind === \"attribute\" &&\n\t\t\t\t\t\t/^\\{\\s*attribute\\s+'symbol'\\s*:=\\s*'(?:read|write|readwrite)'\\s*\\}$/i.test(\n\t\t\t\t\t\t\ttoken.text,\n\t\t\t\t\t\t),\n\t\t\t\t);\n\t\t\tconst description = this.documentation();\n\t\t\tconst names = [this.identifier()];\n\t\t\twhile (this.accept(\",\")) {\n\t\t\t\tnames.push(this.identifier());\n\t\t\t}\n\t\t\tif (this.accept(\"AT\")) {\n\t\t\t\t// Location belongs to the hardware/build mapping; it does not alter the\n\t\t\t\t// scalar type that application consumers receive from type generation.\n\t\t\t\tconst address = this.take();\n\t\t\t\tif (directAddressEnd(address, 0) !== address.length) {\n\t\t\t\t\tthis.error(`expected direct address after AT, found ${address}`);\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.expect(\":\");\n\t\t\tconst type = this.reference();\n\t\t\tconst initial = this.accept(\":=\") ? this.expression([\";\"]) : undefined;\n\t\t\tthis.expect(\";\");\n\t\t\tfor (const name of names) {\n\t\t\t\tif (\n\t\t\t\t\tmembers.some(\n\t\t\t\t\t\t(member) => member.name.toUpperCase() === name.toUpperCase(),\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\tthis.error(`duplicate member ${name}`);\n\t\t\t\t}\n\t\t\t\tmembers.push({\n\t\t\t\t\tname,\n\t\t\t\t\tdescription,\n\t\t\t\t\ttype,\n\t\t\t\t\t...(initial === undefined ? {} : { initial }),\n\t\t\t\t\t...(published ? { published: true } : {}),\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t\tthis.expect(end);\n\t\treturn members;\n\t}\n\n\tdeclarations(): Declaration[] {\n\t\tconst declarations: Declaration[] = [];\n\t\twhile (this.peek()) {\n\t\t\tconst keyed = this.tokens\n\t\t\t\t.slice(this.position, this.nextIndex())\n\t\t\t\t.some(\n\t\t\t\t\t(token) =>\n\t\t\t\t\t\ttoken.kind === \"attribute\" &&\n\t\t\t\t\t\t/^\\{\\s*attribute\\s+'tsplc_keyed'\\s*\\}$/i.test(token.text),\n\t\t\t\t);\n\t\t\tconst description = this.documentation();\n\t\t\tthis.expect(\"TYPE\");\n\t\t\tconst name = this.identifier();\n\t\t\tthis.expect(\":\");\n\t\t\tconst common = { name, description, source: this.source.name };\n\t\t\tif (this.accept(\"STRUCT\")) {\n\t\t\t\tdeclarations.push({\n\t\t\t\t\t...common,\n\t\t\t\t\tkind: \"struct\",\n\t\t\t\t\tmembers: this.members(\"END_STRUCT\"),\n\t\t\t\t});\n\t\t\t\tthis.accept(\";\");\n\t\t\t} else if (this.accept(\"(\")) {\n\t\t\t\tconst members: { name: string; value?: string }[] = [];\n\t\t\t\tdo {\n\t\t\t\t\tconst member = this.identifier();\n\t\t\t\t\tconst value = this.accept(\":=\")\n\t\t\t\t\t\t? this.expression([\",\", \")\"])\n\t\t\t\t\t\t: undefined;\n\t\t\t\t\tif (\n\t\t\t\t\t\tmembers.some(\n\t\t\t\t\t\t\t(item) => item.name.toUpperCase() === member.toUpperCase(),\n\t\t\t\t\t\t)\n\t\t\t\t\t) {\n\t\t\t\t\t\tthis.error(`duplicate enum member ${member}`);\n\t\t\t\t\t}\n\t\t\t\t\tmembers.push({ name: member, value });\n\t\t\t\t} while (this.accept(\",\") && this.peek() !== \")\");\n\t\t\t\tthis.expect(\")\");\n\t\t\t\tconst base =\n\t\t\t\t\tthis.peek() === \";\" ? \"INT\" : this.identifier().toUpperCase();\n\t\t\t\tthis.expect(\";\");\n\t\t\t\tdeclarations.push({ ...common, kind: \"enum\", members, base });\n\t\t\t} else {\n\t\t\t\tconst type = this.reference();\n\t\t\t\tthis.expect(\";\");\n\t\t\t\tdeclarations.push({\n\t\t\t\t\t...common,\n\t\t\t\t\tkind: \"alias\",\n\t\t\t\t\ttype,\n\t\t\t\t\t...(keyed ? { keyed } : {}),\n\t\t\t\t});\n\t\t\t}\n\t\t\tthis.expect(\"END_TYPE\");\n\t\t\tthis.accept(\";\");\n\t\t}\n\t\tif (!declarations.length) {\n\t\t\tthis.error(\"no TYPE declarations found\");\n\t\t}\n\t\treturn declarations;\n\t}\n\n\tglobals(name: string): GlobalList {\n\t\tconst description = this.documentation();\n\t\tconst sections: { constant: boolean; members: Member[] }[] = [];\n\t\tdo {\n\t\t\tsections.push(this.globalSection());\n\t\t} while (this.peek());\n\t\tconst constant = sections.every((section) => section.constant);\n\t\t// Typed access is per list: a list can't be read-only for some of its members.\n\t\tif (!constant && sections.some((section) => section.constant)) {\n\t\t\tthis.error(\"a list mixes CONSTANT and writable VAR_GLOBAL sections\");\n\t\t}\n\t\treturn {\n\t\t\tname,\n\t\t\tdescription,\n\t\t\tsource: this.source.name,\n\t\t\tconstant,\n\t\t\tmembers: sections.flatMap((section) => section.members),\n\t\t};\n\t}\n\n\t/** One `VAR_GLOBAL … END_VAR` section of a list. A list keeps retained state in a section of its own. */\n\tprivate globalSection(): { constant: boolean; members: Member[] } {\n\t\tthis.expect(\"VAR_GLOBAL\");\n\t\tconst written = new Set<string>();\n\t\twhile (qualifiers.has(this.peek())) {\n\t\t\tconst qualifier = this.take().toUpperCase();\n\t\t\tif (written.has(qualifier)) {\n\t\t\t\tthis.error(`duplicate ${qualifier} qualifier`);\n\t\t\t}\n\t\t\twritten.add(qualifier);\n\t\t}\n\t\tconst members = this.members(\"END_VAR\");\n\t\tthis.accept(\";\");\n\t\treturn { constant: written.has(\"CONSTANT\"), members };\n\t}\n}\n\nexport function parseDeclarations(source: Source): Declaration[] {\n\treturn new Parser(source).declarations();\n}\n\nexport function parseGlobals(source: Source, name: string): GlobalList {\n\treturn new Parser(source).globals(name);\n}\n"
8
8
  ],
9
- "mappings": ";AAAA;AACA;;;ACDA;AAAA;AAAA;AAAA;AAAA;AAAA;AASO,IAAM,kBAAkB,CAAC,SAAiB;AAAA,EAChD,MAAM,OAAO,eAAe,IAAI;AAAA,EAChC,OAAO,gBAAgB,IAAI,KAAK,KAAK,QAAQ;AAAA;AAG9C,IAAM,gBAAgB,IAAI,IACzB,gBACE,OAAO,eAAe,EACtB,IAAI,CAAC,SAAS,CAAC,KAAK,MAAM,aAAa,IAAI,CAAC,CAAU,CACzD;AACA,IAAM,eAAe,IAAI,OACxB,OAAO,SAAS,CAAC,GAAG,cAAc,KAAK,CAAC,EAAE,KAAK,GAAG,uIAClD,GACD;AAGO,SAAS,iBAAiB,CAChC,MACA,QACS;AAAA,EACT,MAAM,UAAU,KAAK,QAAQ,Q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