linerange

package
v0.1.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 11, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package linerange parses the `lines=` fragment a citation uses to show part of a block: `a-b` or `a`, 1-based and inclusive.

It lives here because three readers need the same grammar: the checker judges a citation, the renderer slices it, and `ds read --lines` returns it. They had one copy each and drifted — the reader rejected `lines=3`, which the other two accepted, and took `2-3xyz`, which they refused — so a citation could render in a doc and fail when an assistant read it.

The ledger's stored `lines` column is a different thing and has its own parser: it must accept `1-0`, the range of an empty file.

Index

Constants

This section is empty.

Variables

View Source
var ErrBad = errors.New("bad lines")

ErrBad is returned for any fragment outside the grammar.

Functions

func Parse

func Parse(s string) (start, end int, err error)

Parse reads `a-b` or `a`. Both are decimal digits only — no sign, space, or leading `+` — and 1 <= a <= b. A single `a` is `a-a`.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL