• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

sovrin / unitas
100%

Build:
DEFAULT BRANCH: master
Repo Added 22 Mar 2026 10:54AM UTC
Files 131
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

LAST BUILD ON BRANCH master
branch: SELECT
CHANGE BRANCH
x
  • No branch selected
  • master
  • refs/tags/v0.1.0
  • refs/tags/v0.1.1
  • refs/tags/v0.2.0
  • refs/tags/v0.2.1
  • refs/tags/v0.2.2
  • refs/tags/v0.2.3
  • refs/tags/v0.2.4
  • refs/tags/v0.2.5
  • sovrin/offset-errors
  • sovrin/readme-npm-layout

19 Sep 2026 09:14AM UTC coverage: 100.0%. Remained the same
35434163224

push

github

web-flow
feat!: parse by offset and report where a failure happened (#2)

Parsers took a sliced suffix of the input, so nothing in the system knew
where it was in the original source. Position was not being withheld, it
did not exist: `position` returned the remaining length, and 50 of the
52 failure sites passed no message because there was nothing useful to
say.

    before : Error: Not all input consumed: ",b=x,c=3"
    after  : ParseError: 1:7 expected digit, found 'x'
               1 | a=1,b=x,c=3
                 |       ^

A `Parser<T>` now reads from an offset and never slices:

    type Parser<T> = (input: string, index?: number, ctx?: Context) => Result<T>;
    type Success<T> = { ok: true; value: T; index: number };
    type Failure = { ok: false; index: number; expected: readonly string[] };

Both new arguments are optional, so composing the built-in parsers is
unchanged and `myParser('input')` still works.

`ctx` is a per-parse context holding the furthest offset any branch
reached and what was wanted there. It only moves forward, so
backtracking cannot lose it, and it is written only on the failure path.
That is what makes the message point at the mistake: `separatedBy`
succeeds at 1:4 with one pair, so without it the error would read
"1:4 expected end of input" — true, and pointing at the wrong character.

Falling out of the offsets:

- `parse` reports line, column and expectations without throwing;
  `run` throws a `ParseError` carrying the same.
- `grammar` names left-recursive rules instead of overflowing the stack.
- `memoize` keys on an offset, so entries are cheap and are dropped when
  a different input is parsed.
- `regex` matches with a sticky pattern, anchored by construction.
- `position` reports the offset from the start, so it pairs with
  `locate` to give a parsed node a source span.

Nothing allocates a slice per step any more, and the library is faster
or tied against master on every benchmark:

    many(char) 200k          4.63... (continued)

332 of 332 branches covered (100.0%)

Branch coverage included in aggregate %.

460 of 460 new or added lines in 88 files covered. (100.0%)

749 of 749 relevant lines covered (100.0%)

35.78 hits per line

Relevant lines Covered
Build:
Build:
749 RELEVANT LINES 749 COVERED LINES
35.78 HITS PER LINE
Source Files on master
  • Tree
  • List 131
  • Changed 79
  • Source Changed 0
  • Coverage Changed 79
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses

Recent builds

Builds Branch Commit Type Ran Committer Via Coverage
35434163224 master feat!: parse by offset and report where a failure happened (#2) Parsers took a sliced suffix of the input, so nothing in the system knew where it was in the original source. Position was not being withheld, it did not exist: `position` returned t... push 19 Sep 2026 09:15AM UTC web-flow github
100.0
35434068498 sovrin/offset-errors test(core): cover the error-reporting paths Coveralls was failing the PR: the new error machinery had no tests of its own, and it was reached only incidentally by tests aimed at other things. `format`, `parse` and the two branches in `diagnose` t... Pull #2 19 Sep 2026 09:13AM UTC sovrin github
100.0
35433759951 sovrin/offset-errors docs: bring CLAUDE.md up to date with the context model The core types block still described the pre-0.3.0 shape — a parser taking a sliced suffix and a failure carrying an optional message — so it contradicted the code it is meant to explain. It... Pull #2 19 Sep 2026 09:06AM UTC sovrin github
98.71
34028828238 master Merge pull request #1 from sovrin/sovrin/readme-npm-layout Split API reference out of README, fix npm listing, drop two no-op exports push 06 Sep 2026 10:57AM UTC web-flow github
100.0
34028735585 sovrin/readme-npm-layout refactor(combinators): drop attempt, document that backtracking is free attempt claimed to "wrap a parser to handle backtracking on failure", but it cannot: a Failure is { ok: false; error?: string }, with no field to record a position, and combi... Pull #1 06 Sep 2026 10:55AM UTC sovrin github
100.0
25281255160 refs/tags/v0.2.5 fix(doc): improve example push 03 May 2026 02:04PM UTC sovrin github
100.0
25281228913 master fix(doc): improve example push 03 May 2026 02:03PM UTC sovrin github
100.0
25281052758 master fix(package): bump version push 03 May 2026 01:56PM UTC sovrin github
100.0
25280802712 master fix(combinators): node type push 03 May 2026 01:44PM UTC sovrin github
100.0
25276465147 master fix(primitives): float type push 03 May 2026 10:18AM UTC sovrin github
100.0
See All Builds (58)
  • Repo on GitHub
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc