oak-delphi

Crates.iooak-delphi
lib.rsoak-delphi
version0.0.1
created_at2025-10-20 14:50:56.830483+00
updated_at2026-01-23 04:21:24.951043+00
descriptionDelphi language parser with support for modern Delphi syntax and object-oriented programming features.
homepagehttps://github.com/ygg-lang/oaks
repositoryhttps://github.com/ygg-lang/oaks
max_upload_size
id1892039
size86,375
publisher (github:ygg-lang:publisher)

documentation

https://docs.rs/oak-delphi

README

Oak DOT Language Parser

Crates.io Documentation

High-performance incremental DOT parser for the oak ecosystem with flexible configuration, optimized for graph description and visualization.

🎯 Overview

Oak DOT is a robust parser for the DOT graph description language, designed to handle complete DOT syntax including modern features. Built on the solid foundation of oak-core, it provides both high-level convenience and detailed AST generation for graph analysis and visualization.

✨ Features

  • Complete DOT Syntax: Supports all DOT features including modern specifications
  • Full AST Generation: Generates comprehensive Abstract Syntax Trees
  • Lexer Support: Built-in tokenization with proper span information
  • Error Recovery: Graceful handling of syntax errors with detailed diagnostics

🚀 Quick Start

Basic example:

use oak_dot::{Parser, DotLanguage, SourceText};

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let parser = Parser::new();
    let source = SourceText::new(r#"
digraph G {
    A -> B;
    B -> C;
    C -> A;
}
    "#);
    
    let result = parser.parse(&source);
    println!("Parsed DOT graph successfully.");
    Ok(())
}

📋 Parsing Examples

Graph Parsing

use oak_dot::{Parser, DotLanguage, SourceText};

let parser = Parser::new();
let source = SourceText::new(r#"
graph G {
    A -- B -- C;
    A -- C;
}
"#);

let result = parser.parse(&source);
println!("Parsed DOT graph successfully.");

Digraph Parsing

use oak_dot::{Parser, DotLanguage, SourceText};

let parser = Parser::new();
let source = SourceText::new(r#"
digraph workflow {
    start -> process1;
    process1 -> decision;
    decision -> process2 [label="yes"];
    decision -> end [label="no"];
}
"#);

let result = parser.parse(&source);
println!("Parsed DOT digraph successfully.");

🔧 Advanced Features

Token-Level Parsing

use oak_dot::{Parser, DotLanguage, SourceText};

let parser = Parser::new();
let source = SourceText::new("A -> B [color=red];");
let result = parser.parse(&source);
// Token information is available in the parse result

Error Handling

use oak_dot::{Parser, DotLanguage, SourceText};

let parser = Parser::new();
let source = SourceText::new(r#"
digraph G {
    A -> B
    B -> C;
    C -> A;
}
"#);

let result = parser.parse(&source);
if let Err(e) = result.result {
    println!("Parse error: {:?}", e);
}

🏗️ AST Structure

The parser generates a comprehensive AST with the following main structures:

  • Graph: Root container for undirected graphs
  • Digraph: Root container for directed graphs
  • Node: Node definitions with attributes
  • Edge: Edge definitions with attributes
  • Subgraph: Nested graph structures
  • Attribute: Key-value attribute pairs

📊 Performance

  • Streaming: Parse large DOT 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 of dot integrates seamlessly with:

  • Graph Visualization: Parse DOT files for rendering
  • Graph Analysis: Analyze graph structures for properties and patterns
  • Code Generation: Generate DOT files from other data structures
  • IDE Support: Language server protocol compatibility for DOT
  • Documentation: Generate documentation from graph definitions

📚 Examples

Check out the examples directory for comprehensive examples:

  • Complete DOT graph parsing
  • Node and edge analysis
  • Attribute processing
  • Integration with development workflows

🤝 Contributing

Contributions are welcome!

Please feel free to submit pull requests at the project repository or open issues.

Commit count: 80

cargo fmt