Module
tuck/parser
src/tuck/parser.pookaReading the tags in order, and remembering which ones are still open.
A recursive-descent parser: each kind of tag has a function that reads
it and everything up to its end tag, and expressions are read from the
loosest operator (or) down to single values. Any mistake becomes a
TuckError pointing at the token that did not fit.
API reference
parse(template: String, lexemes: List(Lexeme)) -> Result(Document, TuckError)
INFERRED
fn(String, List(tuck/lexer.Lexeme)) -> Result(tuck/ast.Document, tuck/error.TuckError)Read a template's lexemes into a document.
import tuck/lexer
import tuck/parser
let assert Ok(lexemes) = lexer.lex("page", "{% if ok %}yes{% endif %}")
let assert Ok(document) = parser.parse("page", lexemes)
assert document.extends == None