Skip to main content

Crate blade_syntax

Crate blade_syntax 

Source
Expand description

Lossless parser for Laravel Blade templates.

let parse = blade_syntax::parse("@if($user) Hi {{ $user->name }} @endif");
assert!(parse.errors().is_empty());
// The tree always reproduces the input exactly.
assert_eq!(parse.syntax().to_string(), "@if($user) Hi {{ $user->name }} @endif");

Modules§

debug
Human-readable views of a syntax tree, for tests and debugging.

Structs§

Parse
The result of parsing: a syntax tree that always reproduces the input exactly, plus any problems found along the way.
ParseError
A problem in the template, such as an unclosed echo or block.
TextRange
A range in text, represented as a pair of TextSize.
TextSize
A measure of text length. Also, equivalently, an index into text.

Enums§

BladeLanguage
Marker type that ties rowan’s generic tree to SyntaxKind.
SyntaxKind
Token kinds come first, then node kinds. The u16 value is what rowan stores.

Functions§

parse
Parses Blade source. Never fails: problems are reported in Parse::errors.

Type Aliases§

SyntaxNode
SyntaxToken