class

Haml::Scanner

Inherits Reference < Object

A boundary scanner, NOT a second Crystal parser. Its sole job is to keep commas/braces inside strings, regexes and nested groups from becoming Haml delimiters. Syntax, overloads and types remain Crystal's responsibility.

Deliberate boundary: heredocs and Crystal macro bodies are rejected. Bare slash regexes work in operand positions. The ambiguous method /regexp/ form is rejected; write method(/regexp/) or %r(regexp) instead. Ordinary a / b and a/b division work. See docs/SYNTAX.md for the exact contract.

Constants

OPEN_TO_CLOSE = {'(' => ')', '[' => ']', '{' => '}'}
OPERAND_KEYWORDS = ["if", "unless", "when", "in", "return", "yield", "then", "else", "elsif", "rescue", "ensure", "case", "while", "until", "and", "or", "not", "do"] of ::String

Constructors

new(source : String, location : Location, max_depth : Int32 = 128)
Source

Class methods

expression(text : String, location : Location) : AST::Expression
Source

Instance methods

current
Source
eof?
Source
group(template_strings : Bool = false) : AST::Expression
Source
index
Source
location
Source
peek(offset : Int32 = 0) : Char
Source
quoted(template_string : Bool = false) : AST::Expression
Source
read_until(stops : String = "", whitespace : Bool = false, stop_at_comment : Bool = false, template_strings : Bool = false) : AST::Expression
Source
remaining
Source
skip_space
Source
skip_space_and_comments
Source
slice(start : Int32, finish : Int32 = @index) : String
Source
starts_with?(text : String) : Bool
Source
take
Source