● Issue #30 is fixed. #34

Merged
navicore merged 1 commit from issue-30 into main 2026-06-02 22:58:37 +00:00
Owner

#30

Summary:

  • crates/patch-prolog-core/src/parser.rs: added an EOF check after the optional trailing dot in both parse_query
    (line 161) and parse_query_with_vars (line 715). When tokens remain, build the same unexpected {kind} after
    query at line {N} col {M} message used elsewhere. "after query" phrasing distinguishes this from mid-expression
    parse errors so the user knows the goal parsed, but had extra material trailing it.
  • 8 regression tests in tests/integration.rs (test_query_*) covering: trailing atom, trailing punctuation,
    trailing-after-dot, both query entry points, plus three positive regressions (bare query, dot, ?- prefix).

Verified through the binary:

  • member(2,[1,2,3]) zzz → Parse error: unexpected atom \zzz after query at line 1 col 19, exit 2.
  • X is 8 >> 1, X =:= 4 now returns X = 4 (the right answer — >> was added in #29).
  • X is 1 + 2. still works (optional dot preserved).
  • X is 1 + 2. foo now caught (unexpected atom \foo``, exit 2).

No code-side change needed in the runner — the new error surfaces through runner.rs's existing Parse error:
formatting and exit 2.

https://git.navicore.tech/navicore/patch-prolog/issues/30 Summary: - crates/patch-prolog-core/src/parser.rs: added an EOF check after the optional trailing dot in both parse_query (line 161) and parse_query_with_vars (line 715). When tokens remain, build the same unexpected {kind} after query at line {N} col {M} message used elsewhere. "after query" phrasing distinguishes this from mid-expression parse errors so the user knows the goal parsed, but had extra material trailing it. - 8 regression tests in tests/integration.rs (test_query_*) covering: trailing atom, trailing punctuation, trailing-after-dot, both query entry points, plus three positive regressions (bare query, dot, ?- prefix). Verified through the binary: - member(2,[1,2,3]) zzz → Parse error: unexpected atom \zzz` after query at line 1 col 19`, exit 2. - X is 8 >> 1, X =:= 4 now returns X = 4 (the right answer — >> was added in #29). - X is 1 + 2. still works (optional dot preserved). - X is 1 + 2. foo now caught (unexpected atom \foo``, exit 2). No code-side change needed in the runner — the new error surfaces through runner.rs's existing Parse error: <msg> formatting and exit 2.
● Issue #30 is fixed.
All checks were successful
CI - Linux / CI - Linux x86_64 (pull_request) Successful in 19s
a987a32136
Summary:
  - crates/patch-prolog-core/src/parser.rs: added an EOF check after the optional trailing dot in both parse_query
  (line 161) and parse_query_with_vars (line 715). When tokens remain, build the same unexpected {kind} after
  query at line {N} col {M} message used elsewhere. "after query" phrasing distinguishes this from mid-expression
  parse errors so the user knows the goal parsed, but had extra material trailing it.
  - 8 regression tests in tests/integration.rs (test_query_*) covering: trailing atom, trailing punctuation,
  trailing-after-dot, both query entry points, plus three positive regressions (bare query, dot, ?- prefix).

  Verified through the binary:
  - member(2,[1,2,3]) zzz → Parse error: unexpected atom \zzz` after query at line 1 col 19`, exit 2.
  - X is 8 >> 1, X =:= 4 now returns X = 4 (the right answer — >> was added in #29).
  - X is 1 + 2. still works (optional dot preserved).
  - X is 1 + 2. foo now caught (unexpected atom \foo``, exit 2).

  No code-side change needed in the runner — the new error surfaces through runner.rs's existing Parse error:
  <msg> formatting and exit 2.
navicore deleted branch issue-30 2026-06-02 22:58:37 +00:00
Sign in to join this conversation.
No description provided.