module

Mica::Core

Shared machinery for every Mica format: errors with positions, work budgets and deadlines, UTF-8 and transcoding, buffered input and line tracking. See docs/ADDING_A_FORMAT.md for how a format plugs in.

Constants

CONTEXT_CHARS = (2 * EXCERPT_CHARS) + 40

Characters of caller-supplied context (which may itself hold an excerpt) appended to a budget or deadline message.

EXCERPT_CHARS = 120

Characters of input quoted in an error message.

Class methods

excerpt(text : String, limit : Int32 = EXCERPT_CHARS) : String

Returns text cut to its first limit characters (with "..." when cut), so an error message stays short however long the input is. Steps over at most limit characters.

Source
excerpt(bytes : Bytes) : String

Returns the first EXCERPT_CHARS characters of bytes as a string, like excerpt, without copying the rest.

Source
quote(text : String | Bytes) : String

Returns excerpt of text, quoted.

Source

Nested types