class

Haml::Generator

Inherits Reference < Object

Emits a method BODY that writes to an existing IO. Native Crystal compilation is the next stage; Haml.compile does not execute or type-check expressions.

Formatting contract: no pretty-print indentation, one structural LF after each rendered line/tag, unless suppressed by < or >. These modifiers affect structural separators only, never arbitrary whitespace in runtime values. This makes streaming possible without buffering an entire response.

Constants

RESERVED_WORDS = ["_", "__DIR__", "__FILE__", "__LINE__", "__END_LINE__", "abstract", "alias", "annotation", "as", "asm", "begin", "break", "case", "class", "def", "do", "else", "elsif", "end", "ensure", "enum", "extend", "false", "for", "fun", "if", "in", "include", "instance_sizeof", "lib", "macro", "module", "next", "nil", "of", "offsetof", "out", "pointerof", "private", "protected", "require", "rescue", "return", "select", "self", "sizeof", "struct", "super", "then", "true", "type", "typeof", "uninitialized", "union", "unless", "until", "verbatim", "when", "while", "with", "yield"] of ::String

Syntactic identifier validation must also reject reserved words. Merely matching [a-z_] would let --io=end produce invalid generated Crystal.

Constructors

new(io_name : String, options : Options, fingerprint : String)
Source

Class methods

valid_io_name?(name : String) : Bool
Source

Instance methods

generate(document : AST::Document) : String
Source