Skip to content

fix: keep validating after a line without '=' (Resolves #562) - #570

Merged
SJrX merged 1 commit into
242.xfrom
fix/line-without-equals-562
Oct 24, 2026
Merged

SJrX merged 1 commit into
242.xfrom
fix/line-without-equals-562

Conversation

@SJrX

@SJrX SJrX commented Oct 24, 2026

Copy link
Copy Markdown
Owner

A line that is not a section, comment or key=value assignment, such as free text with several words, lexes as a KEY followed by BAD_CHARACTER tokens. The parser had no error recovery, so it gave up at that point and the rest of the file became one error element: no later property or section was validated. systemd logs "Missing '=', ignoring line." and carries on.

Add recoverWhile rules to the grammar: after a (possibly broken) property, skip to the next token that can start a line (key, section or comment), and if junk appears where a line item should start, skip to the next section header. The bad line is still reported as a missing separator.

Found by comparing the plugin with systemd's own parsers over the Debian unit corpus: the kf6/ksyntax-highlighting test units have free text in an [X-...] section, after which several hundred invalid values went unreported.

A line that is not a section, comment or key=value assignment, such as
free text with several words, lexes as a KEY followed by BAD_CHARACTER
tokens. The parser had no error recovery, so it gave up at that point and
the rest of the file became one error element: no later property or
section was validated. systemd logs "Missing '=', ignoring line." and
carries on.

Add recoverWhile rules to the grammar: after a (possibly broken) property,
skip to the next token that can start a line (key, section or comment),
and if junk appears where a line item should start, skip to the next
section header. The bad line is still reported as a missing separator.

Found by comparing the plugin with systemd's own parsers over the Debian
unit corpus: the kf6/ksyntax-highlighting test units have free text in an
[X-...] section, after which several hundred invalid values went
unreported.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

Unit Test Results (grammar engine true)

1 777 tests   1 777 ✅  1m 16s ⏱️
  522 suites      0 💤
  522 files        0 ❌

Results for commit 596c3e2.

@github-actions

Copy link
Copy Markdown

Unit Test Results (grammar engine false)

1 777 tests   1 777 ✅  1m 16s ⏱️
  522 suites      0 💤
  522 files        0 ❌

Results for commit 596c3e2.

@SJrX
SJrX merged commit 36db272 into 242.x Oct 24, 2026
6 checks passed
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.

1 participant