ghtml/parser

Template parser for .ghtml files.

Converts template source text into tokens and builds an AST representing the template structure including HTML elements, expressions, and control flow.

Values

pub fn format_error(
  error: types.ParseError,
  source: String,
) -> String

Format a single parse error with source context

pub fn format_errors(
  errors: List(types.ParseError),
  source: String,
) -> String

Format multiple parse errors

pub fn parse(
  input: String,
) -> Result(types.Template, List(types.ParseError))

Parse a template string into a Template AST

pub fn tokenize(
  input: String,
) -> Result(List(types.Token), List(types.ParseError))

Tokenize a template string into a list of tokens

Search Document