Oak INI Parser
A high-performance INI parser with streaming support, built on oak-core for efficient INI parsing and validation.
🎯 Overview
Oak-ini is a fast and memory-efficient INI parser designed to handle both small INI documents and large configuration files. Built on the reliable oak-core foundation, it provides comprehensive INI parsing with excellent error reporting and validation capabilities.
✨ Features
- Streaming Support: Parse large INI files without loading entirely into memory
- Complete INI Syntax: Full support for standard INI format
- Zero-Copy: Efficient parsing with minimal memory allocations
- Error Recovery: Detailed error messages with line/column information
- Type Validation: Strict type checking and validation
- Fast Performance: Optimized for speed and memory efficiency
🚀 Quick Start
Basic example:
use IniParser;
📋 Parsing Examples
Document Parsing
use ;
let parser = new;
let ini = r#"[application]
name = MyApp
version = 1.0.0
author = John Doe
[database]
host = localhost
port = 5432"#;
let value = parser.parse?;
if let Document = value
Section Parsing
use ;
let parser = new;
let ini = r#"[server]
host = 127.0.0.1
port = 3000
ssl = true"#;
let value = parser.parse?;
if let Section = value
Property Parsing
use ;
let parser = new;
let ini = "max_connections = 100";
let value = parser.parse?;
if let Property = value
Streaming Large Files
use ;
use File;
use BufReader;
let parser = new;
let file = open?;
let reader = new;
// Parse large INI files efficiently
let value = parser.parse_reader?;
println!;
🔧 Advanced Features
Custom Validation
use ;
let parser = new;
let ini = r#"[server]
host = localhost
port = 8080
ssl = true"#;
let value = parser.parse?;
// Validate required sections
validate_config?;
Partial Parsing
use ;
let parser = new;
let ini = r#"[database]
host = localhost
port = 5432
[server]
host = 127.0.0.1
port = 3000"#;
// Parse only specific sections
let db_config = parser.parse_path?;
println!;
Error Handling
use IniParser;
let parser = new;
let invalid_ini = r#"[database]
host = localhost
port = not_a_number
[server]
host = 127.0.0.1
port = 3000"#;
match parser.parse
🏗️ INI Structure
The parser generates a comprehensive INI value structure:
- IniValue::Document: Root container for INI documents
- IniValue::Section: INI sections with names and properties
- IniValue::Property: Key-value pairs
- IniValue::Comment: Comment lines
- IniValue::Empty: Empty lines
📊 Performance
- Streaming: Parse large INI files without loading entirely into memory
- Incremental: Re-parse only changed sections
- Memory Efficient: Smart AST node allocation
- Fast Recovery: Quick error recovery for better IDE integration
🔗 Integration
Oak-ini integrates seamlessly with:
- Configuration Files: Parse INI configuration files
- Settings Management: Process application settings
- Legacy Systems: Handle legacy INI format files
- IDE Support: Language server protocol compatibility
- Build Tools: INI parsing for build configuration
📚 Examples
Check out the examples directory for comprehensive examples:
- Complete INI document parsing
- Section and property analysis
- Configuration extraction and transformation
- Integration with development workflows
🤝 Contributing
Contributions are welcome!
Please feel free to submit pull requests at the project repository or open issues.