Oak Rust Parser
A high-performance incremental Rust parser built on the Oak framework, providing full Rust syntax analysis, code formatting, and syntax highlighting.
🎯 Overview
Oak Rust is a powerful parser designed specifically for the Rust language, supporting full Rust syntax including modern language features. Built on the solid foundation of oak-core, it provides high-level convenience and detailed AST generation suitable for static analysis, code generation, formatting, and syntax highlighting.
✨ Key Features
- Full Rust Syntax Support: Supports all Rust language features, including modern specifications.
- Complete AST Generation: Generates a comprehensive abstract syntax tree.
- Lexer: Built-in tokenization with accurate position information.
- Syntax Highlighting: Supports highlighting for keywords, strings, numbers, comments, macros, etc.
- Code Formatting: Provides code formatting compliant with official style guides.
- Error Recovery: Gracefully handles syntax errors and provides detailed diagnostic information.
- Incremental Parsing: Based on the Oak framework's incremental parsing capabilities for efficient code analysis.
🚀 Quick Start
Basic Parsing Example
use ;
use Language;
Syntax Highlighting Example
use RustHighlighter;
use Highlighter;
Code Formatting Example
use RustFormatter;
📋 Parsing Examples
Function Parsing
use ;
let language = new;
let source = r#"
fn add(a: i32, b: i32) -> i32 {
a + b
}
"#;