Skip to content

Version Packages#2

Open
github-actions[bot] wants to merge 1 commit into
mainfrom
changeset-release/main
Open

Version Packages#2
github-actions[bot] wants to merge 1 commit into
mainfrom
changeset-release/main

Conversation

@github-actions

@github-actions github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated.

Releases

pascal-code-formatter@0.1.0

Minor Changes

  • 00944ab: Add formatPascalSource(code, options?): an AST-driven formatter that parses the
    source and pretty-prints the parser's AST into clean, consistently indented Pascal
    text (a string). Because structure comes from the AST rather than string-matching the
    token stream, classification is exact and parentheses are precedence-aware (a + b * c,
    not (a + (b * c))). Verified to round-trip (output re-parses), be idempotent, and
    preserve semantics (the formatted source compiles to identical JS) across the golden
    fixtures. Also exports AstFormatter and the AstFormatOptions type.

    The existing token-stream formatPascalCode is unchanged. This adds a dependency on
    pascal-parser.

Patch Changes

  • 3035567: Drop the objects-deep-compare dependency and simplify the indentation tracker. The
    begin/end/var nesting is now an explicit local marker stack instead of a general-purpose
    counterweight structure plus per-token deep-equality — clearer, testable without an
    external dependency, and one fewer package to install. Output is unchanged.

  • f5e4ec8: Fix formatPascalCode producing output that its own parser would reject. needWhiteSpace
    had an ad-hoc allow-list with no rule to separate two adjacent word tokens, so control
    keywords glued to their neighbours (for+i, to+5, do+writeln, then+the body).
    Spacing is now driven by a general rule — a space between any two word-like tokens
    (keyword/identifier/number/boolean/string, which also covers the div/mod/and/or/not
    word operators) plus a leading space before control keywords after )/]. Trailing
    whitespace is no longer emitted on a token that ends its line. Added a round-trip test
    harness that renders the formatted lines and re-parses them, covering for/while/if-then/case
    bodies on the same line as their header.

  • 1965329: Track source positions through the toolchain.

    • pascal-tokenizer: every emitted token now carries line (1-based), column
      (1-based) and offset (0-based) marking where it starts in the source. Positions
      are computed with a forward-only cursor, so tokenizing stays O(n).
    • pascal-parser: ParseError now reports where the input went wrong — its
      message is suffixed with at line L, column C and its location points at the
      offending token, instead of a bare, position-less message.
    • pascal-code-formatter: tolerates the new token fields (indentation matching now
      compares tokens by structural identity, not deep object equality).
  • Updated dependencies [14fe8d3]

  • Updated dependencies [a3f86d6]

  • Updated dependencies [d8861ac]

  • Updated dependencies [1965329]

    • pascal-parser@0.3.0
    • pascal-tokenizer@0.1.0

pascal-js-compiler@0.4.0

Minor Changes

  • c043a37: Export a typed CompileError. Unsupported-Pascal errors — var (by-reference)
    parameters, bitwise and/or/not over integers, and wrong-arity builtin calls —
    now throw CompileError instead of a bare Error, so a consumer can catch and tell
    "this program uses an unsupported feature" apart from an internal compiler bug (which
    stays a plain Error). Mirrors ParseError in pascal-parser.

Patch Changes

  • 9020b19: Fix silent codegen corruption when two arrays in different scopes share a name. Array
    low-bounds were tracked in a single flat map keyed only by name, so a local array[1..n]
    inside a subprogram overwrote the low-bound of a same-named outer array, making the outer
    array's 1-based index offset wrong (writes/reads landed outside the allocated array). Array
    scope is now snapshotted and restored around each subprogram body, so a homonym array in one
    scope no longer changes the meaning of the same identifier in a sibling or outer scope.
  • 7855f89: Reject builtins used in the wrong position with a CompileError instead of emitting a
    call to a nonexistent JS function. A value-returning builtin used as a statement
    (abs(x);) and a statement-only builtin used in an expression (x := writeln(1)) used to
    compile to abs(x); / writeln(1), which throw ReferenceError at runtime. They now fail
    at compile time, consistent with how the compiler already rejects var parameters and
    wrong arity. A user subprogram sharing a builtin's name still shadows it in either position.
  • a3f86d6: Declare "type": "commonjs" explicitly in package.json. The packages already ship
    CommonJS; stating it removes Node's module-type detection step for consumers (as flagged
    by publint) and brings these three in line with pascal-code-formatter.
  • Updated dependencies [14fe8d3]
  • Updated dependencies [a3f86d6]
  • Updated dependencies [d8861ac]
  • Updated dependencies [1965329]
    • pascal-parser@0.3.0

pascal-parser@0.3.0

Minor Changes

  • 14fe8d3: Declaration is now a discriminated union (VariableDeclaration | FunctionDeclaration | ProcedureDeclaration | ConstantDeclaration) instead of one wide interface where every
    field was optional. Each variant is exported and carries exactly the fields it has, so a
    switch (decl.type) narrows to the concrete node with no cast — matching how Statement
    and Expression already work. Consumers that switch on decl.type gain precise field
    types; code that read fields like decl.parameters off a bare Declaration without
    narrowing must now narrow first.

  • d8861ac: Statement AST nodes now carry their real source location (location.start = the
    line/column/offset of their first token), stamped in parseStatement. Previously
    every node location was zeroed. This enables consumers to map a statement back to
    its source line — the playground step-debugger being the first such consumer.
    Expression and declaration nodes remain zeroed until they too have a position
    consumer.

  • 1965329: Track source positions through the toolchain.

    • pascal-tokenizer: every emitted token now carries line (1-based), column
      (1-based) and offset (0-based) marking where it starts in the source. Positions
      are computed with a forward-only cursor, so tokenizing stays O(n).
    • pascal-parser: ParseError now reports where the input went wrong — its
      message is suffixed with at line L, column C and its location points at the
      offending token, instead of a bare, position-less message.
    • pascal-code-formatter: tolerates the new token fields (indentation matching now
      compares tokens by structural identity, not deep object equality).

Patch Changes

  • a3f86d6: Declare "type": "commonjs" explicitly in package.json. The packages already ship
    CommonJS; stating it removes Node's module-type detection step for consumers (as flagged
    by publint) and brings these three in line with pascal-code-formatter.
  • Updated dependencies [a3f86d6]
  • Updated dependencies [1965329]
    • pascal-tokenizer@0.1.0

pascal-tokenizer@0.1.0

Minor Changes

  • 1965329: Track source positions through the toolchain.

    • pascal-tokenizer: every emitted token now carries line (1-based), column
      (1-based) and offset (0-based) marking where it starts in the source. Positions
      are computed with a forward-only cursor, so tokenizing stays O(n).
    • pascal-parser: ParseError now reports where the input went wrong — its
      message is suffixed with at line L, column C and its location points at the
      offending token, instead of a bare, position-less message.
    • pascal-code-formatter: tolerates the new token fields (indentation matching now
      compares tokens by structural identity, not deep object equality).

Patch Changes

  • a3f86d6: Declare "type": "commonjs" explicitly in package.json. The packages already ship
    CommonJS; stating it removes Node's module-type detection step for consumers (as flagged
    by publint) and brings these three in line with pascal-code-formatter.

@github-actions github-actions Bot force-pushed the changeset-release/main branch from fcc82fc to a3ac202 Compare July 9, 2026 07:33
@github-actions github-actions Bot force-pushed the changeset-release/main branch from a3ac202 to 9ab39d0 Compare July 10, 2026 00:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants