TemplateParser
final class TemplateParser
Parses Latte template tokens into AST.
Properties
| Block[][] | $blocks | ||
| $blockLayer | |||
| $inHead | |||
| $strict | |||
| $dedent | |||
| $lastIndentation |
Methods
No description
Parses tokens to nodes.
Resolves the next node in plain text context (text, indentation, Latte tag, or comment).
Consumes a Latte comment and returns a NopNode.
No description
Consumes all PHP tokens of the current tag body and returns them.
No description
Validates that the block name is valid and not already declared, then registers it.
No description
No description
No description
No description
No description
Returns the currently parsed tag, or null if no tag is being parsed.
No description
Generates a unique integer ID for use in compiled output.
No description
Details
at line 53
__construct()
No description
at line 65
TemplateNode
parse(string $template)
Parses tokens to nodes.
at line 95
FragmentNode
parseFragment(Closure $resolver, Closure|null $after = null)
No description
at line 121
Node|null
inTextResolve()
Resolves the next node in plain text context (text, indentation, Latte tag, or comment).
at line 138
TextNode
parseText()
Consumes a text token and returns a TextNode.
at line 170
NopNode
parseLatteComment()
Consumes a Latte comment and returns a NopNode.
at line 184
Node|null
parseLatteStatement(Closure|null $resolver = null)
No description
at line 322
array
consumeTag()
Consumes all PHP tokens of the current tag body and returns them.
at line 335
TemplateParser
addTags(array $parsers)
No description
at line 408
void
ensureIsConsumed(Tag $tag)
Throws if the tag parser has not consumed all tokens.
at line 420
void
checkBlockIsUnique(Block $block)
Validates that the block name is valid and not already declared, then registers it.
at line 437
TemplateParser
setPolicy(Policy|null $policy)
No description
at line 444
TemplateParser
setContentType(string $type)
No description
at line 454
string
getContentType()
No description
at line 461
TokenStream
getStream()
| internal |
No description
at line 467
TemplateLexer
getLexer()
No description
at line 476
Tag|null
peekTag()
Returns the currently parsed tag, or null if no tag is being parsed.
at line 490
void
popTag()
No description
at line 499
int
generateId()
Generates a unique integer ID for use in compiled output.
at line 505
bool
isTagAllowed(string $name)
No description