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
//! OOXML field instruction parser and evaluator.
//!
//! Parses raw field instruction strings (from `w:instrText` or `w:fldSimple/@instr`)
//! into a typed AST, and evaluates them given a document context.
//!
//! # Examples
//!
//! ```
//! use dxpdf::field::{parse, evaluate, FieldContext};
//!
//! // Parse a PAGE field
//! let instr = parse(" PAGE ").unwrap();
//!
//! // Evaluate with context
//! let mut ctx = FieldContext::default();
//! ctx.page_number = Some(7);
//! let result = evaluate(&instr, &ctx);
//! ```
pub
pub
pub use ;
pub use FieldContext;
pub use FieldParseError;
pub use ;
/// Parse a field instruction string into a typed `FieldInstruction`.
///
/// The input is the raw instruction text as found in `w:instrText` elements
/// or the `instr` attribute of `w:fldSimple`, e.g. `" PAGE "`, `" TOC \o \"1-3\" \h "`.
///
/// Returns `Err(FieldParseError)` for malformed syntax (unterminated strings,
/// missing required arguments, invalid values). Unknown but syntactically valid
/// field types parse into `FieldInstruction::Unknown`.