● Every repro from the issue now passes. Issue #28 is fixed. #32

Merged
navicore merged 1 commit from issue-28 into main 2026-06-02 22:41:41 +00:00
Owner

#28

Summary:

  • crates/patch-prolog-core/src/tokenizer.rs: added TokenKind::Backslash with Display arm \. Replaced the
    bare-\ error path with a fallthrough that emits Backslash (longest match still wins for =, ==, +). Unit tests
    verify \ alone and \ 3 tokenize correctly.
  • crates/patch-prolog-core/src/parser.rs:
    • Added Plus prefix arm in parse_primary — mirrors the unary - block including literal folding (+3 → 3, +3.0 →
      3.0).
    • Added Backslash prefix arm — wraps operand as (operand). No folding; the arithmetic evaluator handles \N at
      is-time.
    • Extended operator_as_atom_lookahead with Backslash → "\" so f() reads as the bare atom (consistent with
      the +/- handling from #19). Plus was already covered.
  • 10 regression tests in tests/integration.rs (test_prefix_, test_backslash_,
    test_existing_escapes_still_tokenize) covering positive parse, literal folding for +, no folding for , the
    closing-context atom rule, mixed-prefix chains (- - 3, + - 3), and regressions for the three escape sequences
    (=, ==, +) plus infix +.

Out of scope as the issue body said: declaration-class prefixes (dynamic/multifile/etc.), the infix gaps (** ^

<< xor div :), and arithmetic evaluation of \X.

https://git.navicore.tech/navicore/patch-prolog/issues/28 Summary: - crates/patch-prolog-core/src/tokenizer.rs: added TokenKind::Backslash with Display arm `\`. Replaced the bare-\ error path with a fallthrough that emits Backslash (longest match still wins for \=, \==, \+). Unit tests verify \ alone and \ 3 tokenize correctly. - crates/patch-prolog-core/src/parser.rs: - Added Plus prefix arm in parse_primary — mirrors the unary - block including literal folding (+3 → 3, +3.0 → 3.0). - Added Backslash prefix arm — wraps operand as \(operand). No folding; the arithmetic evaluator handles \N at is-time. - Extended operator_as_atom_lookahead with Backslash → "\\" so f(\) reads as the bare atom (consistent with the +/- handling from #19). Plus was already covered. - 10 regression tests in tests/integration.rs (test_prefix_*, test_backslash_*, test_existing_escapes_still_tokenize) covering positive parse, literal folding for +, no folding for \, the closing-context atom rule, mixed-prefix chains (- - 3, + - 3), and regressions for the three escape sequences (\=, \==, \+) plus infix +. Out of scope as the issue body said: declaration-class prefixes (dynamic/multifile/etc.), the infix gaps (** ^ >> << xor div :), and arithmetic evaluation of \X.
● Every repro from the issue now passes. Issue #28 is fixed.
All checks were successful
CI - Linux / CI - Linux x86_64 (pull_request) Successful in 20s
7fa26660e9
Summary:
  - crates/patch-prolog-core/src/tokenizer.rs: added TokenKind::Backslash with Display arm `\`. Replaced the
  bare-\ error path with a fallthrough that emits Backslash (longest match still wins for \=, \==, \+). Unit tests
  verify \ alone and \ 3 tokenize correctly.
  - crates/patch-prolog-core/src/parser.rs:
    - Added Plus prefix arm in parse_primary — mirrors the unary - block including literal folding (+3 → 3, +3.0 →
  3.0).
    - Added Backslash prefix arm — wraps operand as \(operand). No folding; the arithmetic evaluator handles \N at
  is-time.
    - Extended operator_as_atom_lookahead with Backslash → "\\" so f(\) reads as the bare atom (consistent with
  the +/- handling from #19). Plus was already covered.
  - 10 regression tests in tests/integration.rs (test_prefix_*, test_backslash_*,
  test_existing_escapes_still_tokenize) covering positive parse, literal folding for +, no folding for \, the
  closing-context atom rule, mixed-prefix chains (- - 3, + - 3), and regressions for the three escape sequences
  (\=, \==, \+) plus infix +.

  Out of scope as the issue body said: declaration-class prefixes (dynamic/multifile/etc.), the infix gaps (** ^
  >> << xor div :), and arithmetic evaluation of \X.
navicore deleted branch issue-28 2026-06-02 22:41:41 +00:00
Sign in to join this conversation.
No description provided.