Skip to content

feat: add shared grammar terminals for systemd integer and route-table parsing - #566

Merged
SJrX merged 1 commit into
242.xfrom
feat/shared-terminals
Oct 24, 2026
Merged

SJrX merged 1 commit into
242.xfrom
feat/shared-terminals

Conversation

@SJrX

@SJrX SJrX commented Oct 24, 2026

Copy link
Copy Markdown
Owner

Add SafeAtoTerminal, an exact model of systemd's safe_ato* family at 0f0682b773: signed/unsigned, base 0/8/10/16, the SAFE_ATO_REFUSE_* flags, BigInteger bounds up to the full 64-bit range, mangle_base's 0b/0o prefixes (with the sign and whitespace strtoul accepts after them), the disabled C23 0b support, and strtoul's modulo-2^64 wrap-around. Malformed input is a syntax error located where strtoul stops; out-of-range values are a semantic error on the number token. It works with both grammar engines, and valueOf() returns the stored value for predicates.

Add ROUTE_TABLE_FROM_STRING for manager_get_route_table_from_string(): the predefined names, a non-zero safe_atou32, or any value that networkd.conf's RouteTable= could define as a name (non-empty, no ':', not all digits). That leniency is documented.

Register SafeAtoTerminal as a LITERAL for colouring. Tests cover every corner case confirmed with the real systemd parsers (sd-check), under both engines, including the highlighted ranges.

…e parsing (Resolves #563)

Add SafeAtoTerminal, an exact model of systemd's safe_ato* family at
0f0682b773: signed/unsigned, base 0/8/10/16, the SAFE_ATO_REFUSE_* flags,
BigInteger bounds up to the full 64-bit range, mangle_base's 0b/0o
prefixes (with the sign and whitespace strtoul accepts after them), the
disabled C23 0b support, and strtoul's modulo-2^64 wrap-around. Malformed
input is a syntax error located where strtoul stops; out-of-range values
are a semantic error on the number token. It works with both grammar
engines, and valueOf() returns the stored value for predicates.

Add ROUTE_TABLE_FROM_STRING for manager_get_route_table_from_string():
the predefined names, a non-zero safe_atou32, or any value that
networkd.conf's RouteTable= could define as a name (non-empty, no ':',
not all digits). That leniency is documented.

Register SafeAtoTerminal as a LITERAL for colouring. Tests cover every
corner case confirmed with the real systemd parsers (sd-check), under
both engines, including the highlighted ranges.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@SJrX
SJrX merged commit 0b70511 into 242.x Oct 24, 2026
2 of 3 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