Skip to main content

Crate oak_pretty_print

Crate oak_pretty_print 

Source
Expand description

§🛠️ Developer Guide

This directory contains the core logic implementation of the project. Below are instructions for a quick start.

§🚦 Quick Start

§Core API Usage

// Example: Basic calling workflow
fn main() {
    // 1. Initialization
    // 2. Execute core logic
    // 3. Handle returned results
}

§🔍 Module Description

  • lib.rs: Exports public interfaces and core traits.
  • parser/ (if exists): Implements specific syntax parsing logic.
  • ast/ (if exists): Defines the syntax tree structure.

§🏗️ Architecture Design

The project follows the general architectural specifications of the Oak ecosystem, emphasizing:

  1. Immutability: Uses the Green/Red Tree structure to ensure efficient sharing of syntax trees.
  2. Fault Tolerance: Core logic is highly inclusive of erroneous input.
  3. Scalability: Convenient for downstream tools to perform secondary development.

Re-exports§

pub extern crate alloc;
pub use crate::comment::Comment;
pub use crate::comment::CommentCollector;
pub use crate::comment::CommentKind;
pub use crate::comment::CommentProcessor;
pub use crate::document::Document;
pub use crate::document::IndentStyle;
pub use crate::document::LineEnding;
pub use crate::document::Printer;
pub use crate::document::PrinterConfig;
pub use crate::errors::FormatResult;
pub use crate::state::DefaultFormatState;
pub use crate::to_doc::AsDocument;
pub use crate::to_doc::ToDocument;
pub use crate::whitespace::WhitespaceProcessor;

Modules§

comment
Comment handling and processing
document
Document abstraction and printer
errors
Error types for formatting
state
Formatting state
to_doc
Traits for converting types to documents
whitespace
Whitespace handling and processing

Macros§

define_rules
Macro for defining language rules.
doc
Macro for generating documentation from templates.

Constants§

HARD_LINE
Force a line break and propagate it to parent groups
LINE
Force a line break
NIL
Empty document
SOFT_LINE
Soft line break: a line break if the group breaks, otherwise empty
SOFT_LINE_SPACE
Soft line break with space: a line break if the group breaks, otherwise a space

Traits§

Language
Language definition trait that coordinates all language-related types and behaviors.

Functions§

indent
Increase indentation
join
Join multiple documents with a specified separator

Type Aliases§

Doc
Type alias for Document

Derive Macros§

AsDocument
Derives the AsDocument trait.
FormatRule
Derives the FormatRule trait.