oak_core/
lib.rs

1#![doc = include_str!("readme.md")]
2#![allow(incomplete_features)]
3#![allow(internal_features)] // Allow using internal features like `core_intrinsics`
4#![feature(allocator_api)] // Required for custom arena allocation and manual memory management
5#![feature(core_intrinsics)] // Used for `likely`/`unlikely` hints in performance-critical paths
6#![feature(lazy_type_alias)] // Allows more flexible type aliases for complex generic AST structures
7#![feature(new_range_api)] // Uses the modernized `core::range` API for precise source tracking
8// #![feature(nonnull_slice_from_raw_parts)] // Essential for creating raw slices in `SyntaxArena` without null checks
9#![feature(portable_simd)] // Enables SIMD acceleration for high-performance lexing and parsing
10#![feature(slice_ptr_get)] // Provides ergonomic access to raw pointers within slices
11#![feature(trusted_len)] // Optimizes iterator performance by trusting length hints in core structures
12#![warn(missing_docs)]
13#![doc(html_logo_url = "https://raw.githubusercontent.com/ygg-lang/oaks/refs/heads/dev/documents/logo.svg")]
14#![doc(html_favicon_url = "https://raw.githubusercontent.com/ygg-lang/oaks/refs/heads/dev/documents/logo.svg")]
15
16/// Incremental tree builder and cache management.
17pub mod builder;
18/// Error handling and diagnostic reporting for the parsing system.
19pub mod errors;
20/// Language definition trait for coordinating language-specific components.
21pub mod language;
22/// Lexical analysis and tokenization functionality.
23pub mod lexer;
24/// Memory management utilities (Arena, Bump).
25pub mod memory;
26/// Parsing functionality for converting tokens to kind trees.
27pub mod parser;
28pub mod serde_range;
29/// Source text management and location tracking.
30pub mod source;
31/// Tree structures for representing kind trees (green and red trees).
32pub mod tree;
33/// Tree traversal and transformation utilities.
34pub mod visitor;
35
36/// Helper utilities for common operations.
37pub mod helpers;
38
39pub use core::range::Range;
40
41pub use crate::{
42    builder::{Builder, BuilderCache},
43    errors::{OakDiagnostics, OakError, OakErrorKind},
44    language::{ElementRole, ElementType, Language, LanguageCategory, TokenRole, TokenType, UniversalElementRole, UniversalTokenRole},
45    lexer::{LexOutput, Lexer, LexerCache, LexerState, Token, Tokens},
46    memory::arena::SyntaxArena,
47    parser::{Associativity, OperatorInfo, ParseCache, ParseOutput, ParseSession, Parser, ParserState, Pratt, PrattParser, binary, postfix, state::TreeSink, unary},
48    source::{Source, SourceText, TextEdit},
49    tree::{GreenNode, GreenTree, RedNode, RedTree},
50};
51
52pub use triomphe::Arc;