Module
lexie/emit
src/lexie/emit.pookaThe 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
marker() -> String
fn() -> StringThe first line of every generated file. clean and generate only ever
touch files that start with it.
header(what: String) -> String
fn(String) -> StringA generated module's opening comment.
module_path(c: Config, leaf: String) -> String
fn(lexie/config.Config, String) -> StringThe import path of a generated module, such as syntax/lexer.
lines(all: List(String)) -> String
fn(List(String)) -> StringLines of generated code, joined.
file_path(c: Config, file: String) -> String
fn(lexie/config.Config, String) -> StringWhere a generated file goes, such as src/syntax/lexer.pooka.
literal(text: String) -> String
fn(String) -> StringText as a Pooka string literal.
bytes(text: String) -> Int
fn(String) -> IntThe number of UTF-8 bytes in the text.
columns(text: String) -> Int
fn(String) -> IntThe number of characters in the text, as the generated code counts columns.
starts_with(text: String, binding: String) -> String
fn(String, String) -> StringA bit-array pattern for text at the start, binding what follows:
<<"==":utf8, after:bits>>.
indent(text: String, spaces: Int) -> String
fn(String, Int) -> StringIndent every non-empty line.
longest_first(items: List(#(String, a))) -> List(#(String, a))
fn(List(#(String, a))) -> List(#(String, a))Longest text first, then alphabetical: the order in which fixed tokens must be tried.