1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
//! Template syntax parsing.
//!
//! This module provides parsing of template syntax into an AST using winnow combinators.
//!
//! ## Phase 3 Implementation
//!
//! - Single-pass parser using winnow combinators
//! - AST node types (Variable, If, For, etc.)
//! - Span tracking for error reporting
//!
//! The parser is internal: it is reached through template binding, never
//! through the public API.
use ;
/// Syntax error type.
/// Parses template syntax from a string into an AST.
///
/// This is the main entry point for Phase 3. The parser operates on plain strings
/// and is independent of DOCX/XML concerns.
///
/// # Errors
///
/// Returns a `SyntaxError` if the template contains invalid syntax:
/// - Unclosed placeholders (`{{` without `}}`)
/// - Unclosed blocks (`{% if %}` without `{% endif %}`)
/// - Mismatched block terminators
/// - Invalid expressions
pub
/// Parses a standalone expression such as `user.name` or `not items.0`.
///
/// Used by the binding layer for the condition of an `if` tag and the iterable
/// of a `for` tag.
pub