Module

lexie/emit

src/lexie/emit.pooka

The pen and ink the generators share.

Small helpers for writing Pooka source: string literals, bit-array patterns, paths, indentation, and the order fixed tokens are tried in.

API reference

function

marker

src/lexie/emit.pooka:19
marker() -> String
INFERREDfn() -> String

The first line of every generated file. clean and generate only ever touch files that start with it.

function

header

src/lexie/emit.pooka:24
header(what: String) -> String
INFERREDfn(String) -> String

A generated module's opening comment.

function

module_path

src/lexie/emit.pooka:29
module_path(c: Config, leaf: String) -> String
INFERREDfn(lexie/config.Config, String) -> String

The import path of a generated module, such as syntax/lexer.

function

lines

src/lexie/emit.pooka:51
lines(all: List(String)) -> String
INFERREDfn(List(String)) -> String

Lines of generated code, joined.

function

file_path

src/lexie/emit.pooka:56
file_path(c: Config, file: String) -> String
INFERREDfn(lexie/config.Config, String) -> String

Where a generated file goes, such as src/syntax/lexer.pooka.

function

literal

src/lexie/emit.pooka:64
literal(text: String) -> String
INFERREDfn(String) -> String

Text as a Pooka string literal.

function

bytes

src/lexie/emit.pooka:116
bytes(text: String) -> Int
INFERREDfn(String) -> Int

The number of UTF-8 bytes in the text.

function

columns

src/lexie/emit.pooka:122
columns(text: String) -> Int
INFERREDfn(String) -> Int

The number of characters in the text, as the generated code counts columns.

function

starts_with

src/lexie/emit.pooka:128
starts_with(text: String, binding: String) -> String
INFERREDfn(String, String) -> String

A bit-array pattern for text at the start, binding what follows: <<"==":utf8, after:bits>>.

function

indent

src/lexie/emit.pooka:133
indent(text: String, spaces: Int) -> String
INFERREDfn(String, Int) -> String

Indent every non-empty line.

function

longest_first

src/lexie/emit.pooka:148
longest_first(items: List(#(String, a))) -> List(#(String, a))
INFERREDfn(List(#(String, a))) -> List(#(String, a))

Longest text first, then alphabetical: the order in which fixed tokens must be tried.