● All green: 6 runner (+3 new for #21) + 209 integration + 148 unit. Issue #21 is implemented. #26

Merged
navicore merged 1 commit from issue-21 into main 2026-06-02 18:15:37 +00:00
Owner

#21

Summary:

  • src/runner.rs: introduced SourceInput enum (File(PathBuf) | Stdin | Inline(String)); RunArgs.files replaced by
    RunArgs.sources: Vec. Added materialize_source that reads stdin lazily on demand and tags errors
    with / / the file path. Stdlib parsing path is unchanged.
  • src/main.rs: dropped required = true from the Run subcommand's files; added -p/--program TEXT (repeatable);
    positional - is mapped to SourceInput::Stdin. Dispatch builds the Vec in CLI order (files first,
    then --program snippets) and emits a friendly error if no source was provided.
  • 3 regression tests in runner.rs: inline source parses, inline source tags errors as , mixed file +
    inline sources combine correctly.

Verified via the binary:

  • patch-prolog run --program 'p(1). p(2).' --goal 'p(X)' → produces solutions.
  • echo 'foo(bar).' | patch-prolog run - --goal 'foo(X)' → produces solutions.
  • Parse errors in inline / stdin show as Parse error in : … / Parse error in : ….
  • No source → friendly error message, exit 2.
  • All existing modes (single file, multiple files, file + --program, multiple --program) work.
https://git.navicore.tech/navicore/patch-prolog/issues/21 Summary: - src/runner.rs: introduced SourceInput enum (File(PathBuf) | Stdin | Inline(String)); RunArgs.files replaced by RunArgs.sources: Vec<SourceInput>. Added materialize_source that reads stdin lazily on demand and tags errors with <stdin> / <inline> / the file path. Stdlib parsing path is unchanged. - src/main.rs: dropped required = true from the Run subcommand's files; added -p/--program TEXT (repeatable); positional - is mapped to SourceInput::Stdin. Dispatch builds the Vec<SourceInput> in CLI order (files first, then --program snippets) and emits a friendly error if no source was provided. - 3 regression tests in runner.rs: inline source parses, inline source tags errors as <inline>, mixed file + inline sources combine correctly. Verified via the binary: - patch-prolog run --program 'p(1). p(2).' --goal 'p(X)' → produces solutions. - echo 'foo(bar).' | patch-prolog run - --goal 'foo(X)' → produces solutions. - Parse errors in inline / stdin show as Parse error in <inline>: … / Parse error in <stdin>: …. - No source → friendly error message, exit 2. - All existing modes (single file, multiple files, file + --program, multiple --program) work.
● All green: 6 runner (+3 new for #21) + 209 integration + 148 unit. Issue #21 is implemented.
All checks were successful
CI - Linux / CI - Linux x86_64 (pull_request) Successful in 21s
691e3ef67e
Summary:
  - src/runner.rs: introduced SourceInput enum (File(PathBuf) | Stdin | Inline(String)); RunArgs.files replaced by
  RunArgs.sources: Vec<SourceInput>. Added materialize_source that reads stdin lazily on demand and tags errors
  with <stdin> / <inline> / the file path. Stdlib parsing path is unchanged.
  - src/main.rs: dropped required = true from the Run subcommand's files; added -p/--program TEXT (repeatable);
  positional - is mapped to SourceInput::Stdin. Dispatch builds the Vec<SourceInput> in CLI order (files first,
  then --program snippets) and emits a friendly error if no source was provided.
  - 3 regression tests in runner.rs: inline source parses, inline source tags errors as <inline>, mixed file +
  inline sources combine correctly.

  Verified via the binary:
  - patch-prolog run --program 'p(1). p(2).' --goal 'p(X)' → produces solutions.
  - echo 'foo(bar).' | patch-prolog run - --goal 'foo(X)' → produces solutions.
  - Parse errors in inline / stdin show as Parse error in <inline>: … / Parse error in <stdin>: ….
  - No source → friendly error message, exit 2.
  - All existing modes (single file, multiple files, file + --program, multiple --program) work.
navicore deleted branch issue-21 2026-06-02 18:15:37 +00:00
Sign in to join this conversation.
No description provided.