class Marten::Template::Parser

Overview

The Marten template parser.

This class allows to parse a raw template in order to produce a node set. Under the hood, the parser will leverage a lexer (Marten::Template::Parser::Lexer) in order to generate a Marten::Template::NodeSet object, which contains the set of nodes that were generated from the parsing process. These nodes are all able to be rendered in order to then generate a final output for a given context.

Defined in:

marten/template/parser.cr
marten/template/parser/lexer.cr
marten/template/parser/token.cr
marten/template/parser/token_type.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(source : String) #

[View source]

Instance Method Detail

def encountered_block_names : Array(String) #

[View source]
def parse(up_to : Array(String) | Nil | Tuple = nil) : NodeSet #

Generates a set of nodes from the lexical tokens.


[View source]
def shift_token #

Extracts the next token from the available lexical tokens.


[View source]