Skip to main content

Crate oak_core

Crate oak_core 

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 use crate::builder::Builder;
pub use crate::builder::BuilderCache;
pub use crate::errors::OakDiagnostics;
pub use crate::errors::OakError;
pub use crate::errors::OakErrorKind;
pub use crate::language::ElementRole;
pub use crate::language::ElementType;
pub use crate::language::Language;
pub use crate::language::LanguageCategory;
pub use crate::language::TokenRole;
pub use crate::language::TokenType;
pub use crate::language::UniversalElementRole;
pub use crate::language::UniversalTokenRole;
pub use crate::lexer::LexOutput;
pub use crate::lexer::Lexer;
pub use crate::lexer::LexerCache;
pub use crate::lexer::LexerState;
pub use crate::lexer::Token;
pub use crate::lexer::TokenStream;
pub use crate::lexer::Tokens;
pub use crate::memory::arena::SyntaxArena;
pub use crate::parser::Associativity;
pub use crate::parser::OperatorInfo;
pub use crate::parser::ParseCache;
pub use crate::parser::ParseOutput;
pub use crate::parser::ParseSession;
pub use crate::parser::Parser;
pub use crate::parser::ParserState;
pub use crate::parser::Pratt;
pub use crate::parser::PrattParser;
pub use crate::parser::binary;
pub use crate::parser::parse;
pub use crate::parser::parse_one_pass;
pub use crate::parser::postfix;
pub use crate::parser::state::TreeSink;
pub use crate::parser::unary;
pub use crate::source::Source;
pub use crate::source::SourceText;
pub use crate::source::TextEdit;
pub use crate::tree::GreenNode;
pub use crate::tree::GreenTree;
pub use crate::tree::RedLeaf;
pub use crate::tree::RedNode;
pub use crate::tree::RedTree;

Modulesยง

builder
Incremental tree builder and cache management.
errors
Error handling and diagnostic reporting for the parsing system.
helpers
Helper utilities for common operations. Helper utilities for common operations in the Oak Core parsing framework.
language
Language definition trait for coordinating language-specific components.
lexer
Lexical analysis and tokenization functionality.
memory
Memory management utilities (Arena, Bump).
parser
Parsing functionality for converting tokens to kind trees.
serde_arc_str
Serde support for triomphe::Arc<str>.
serde_range
Serde support for core::range::Range.
source
Source text management and location tracking. Source text management and location tracking for incremental parsing.
tree
Tree structures for representing kind trees (green and red trees). Red-green tree implementation for efficient kind tree representation.
visitor
Tree traversal and transformation utilities. Tree traversal and transformation utilities.

Structsยง

Arc
An atomically reference counted shared pointer
RangeExperimental
A (half-open) range bounded inclusively below and exclusively above (start..end in a future edition).