vize_armature
Armature - The structural parser framework for Vize Vue templates.
Name Origin
Armature (/ˈɑːrmətʃər/) is the internal skeleton or framework that supports a sculpture during its creation. Just as an armature provides the structural foundation that a sculptor builds upon, vize_armature provides the parsing framework that analyzes and structures Vue templates.
The armature is the invisible but essential structure that gives shape to the final work - similarly, this crate provides the parsing infrastructure that extracts structure from raw template text.
Features
- High-Performance Tokenizer: State machine-based HTML tokenizer optimized for Vue template syntax
- Vue Template Parser: Full support for Vue-specific syntax including:
- Directives (
v-if,v-for,v-bind,v-on, etc.) - Interpolation (
{{ expression }}) - Custom delimiters
- Dynamic arguments (
v-bind:[key]) - Modifiers (
@click.stop.prevent)
- Directives (
- Arena Allocation: Zero-copy parsing using bumpalo arena allocator
- Error Recovery: Graceful handling of malformed templates with detailed error messages
- Source Location Tracking: Precise line/column tracking for IDE integration
Dependencies
vize_carton- Core types and arena allocatorvize_relief- AST definitions, errors, and options
Usage
use ;
use Bump;
// Simple parsing
let allocator = new;
let source = "<div>{{ message }}</div>";
let = parse;
// Parsing with options
let options = default;
let = parse_with_options;
Architecture
vize_armature
├── tokenizer.rs # State machine tokenizer
└── parser.rs # AST builder using tokenizer callbacks
The parser uses a callback-based design where the tokenizer emits events that the parser handles to build the AST.
License
MIT