Skip to content

Allow whitespace between = and the value in env-spec parser - #1309

Merged
theoephraim merged 2 commits into
dmno-dev:mainfrom
anubhavlal07:fix/parser-space-before-quoted-value
Nov 17, 2026
Merged

theoephraim merged 2 commits into
dmno-dev:mainfrom
anubhavlal07:fix/parser-space-before-quoted-value

Conversation

@anubhavlal07

Copy link
Copy Markdown
Contributor

Fixes #1304

A= "x" and A = "x" failed to parse with Expected "#", "\n", or [ \t] but '"' found, while A="x" and A = x worked. Values like A = fn(1), A = [a, b] and A = { k=v } parsed, but as plain strings instead of a function call or literal.

The ConfigItem rule had no whitespace match after =. The only value rule that accepted leading whitespace was unquotedString, which then refused a value starting with a quote, and the function, array, object and quoted rules could not start on a space.

The fix adds _ after "=" in ConfigItem. Unquoted values resolve the same as before, since they were already trimmed. VAL= and VAL= # comment still have no value, and an unclosed quote after a space (VAL= "not ok) still throws. A side effect: commented-out items like # A = "x" in a description block no longer cut off the description lines after them, matching # A="x".

Tests in values.test.ts cover quoted, multi-line, function call, array and object values after whitespace, plus the no-value and unclosed-quote cases. A test in general.test.ts covers the commented-out description case. The new value tests fail without the grammar change.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes: Reviewed the parser whitespace fix and regression coverage; all 301 parser tests passed.

  • Value parsing: Spaces and tabs after = now allow quoted strings, multiline strings, function calls, arrays, and objects to parse consistently.
  • Regression coverage: Tests cover empty values, comments, malformed quotes, and descriptions following commented-out structured values.
  • Release entry: Includes a patch release entry for @env-spec/parser.

Pullfrog  | View workflow run | Using gpt-6.1-sol | 𝕏

@theoephraim

Copy link
Copy Markdown
Member

Thanks for this! Will have it merged shortly.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes: Reviewed the additions since f32e741; all 317 parser tests passed.

  • Expanded whitespace coverage: Added cases for mixed whitespace, scalar types, trailing text, spaced assignments, and export.
  • Verified reference resolution: Added spaced-assignment tests for unquoted and double-quoted expansion, plus single-quoted literals.
  • Removed stale commentary: Deleted the grammar comment without changing parser behavior.

Pullfrog  | View workflow run | Using gpt-6.1-sol | 𝕏

@pkg-pr-new

pkg-pr-new Bot commented Nov 17, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@env-spec/parser@1309
npm i https://pkg.pr.new/varlock@1309

commit: cf3e19c

@theoephraim
theoephraim merged commit 68fa77a into dmno-dev:main Nov 17, 2026
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG]: env-spec parser rejects whitespace between = and a quoted value (A = "x")

2 participants