Skip to main content

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_arc_str;
29pub mod serde_range;
30/// Source text management and location tracking.
31pub mod source;
32/// Tree structures for representing kind trees (green and red trees).
33pub mod tree;
34/// Tree traversal and transformation utilities.
35pub mod visitor;
36
37/// Helper utilities for common operations.
38pub mod helpers;
39
40pub use core::range::Range;
41
42pub use crate::{
43    builder::{Builder, BuilderCache},
44    errors::{OakDiagnostics, OakError, OakErrorKind},
45    language::{ElementRole, ElementType, Language, LanguageCategory, TokenRole, TokenType, UniversalElementRole, UniversalTokenRole},
46    lexer::{LexOutput, Lexer, LexerCache, LexerState, Token, TokenStream, Tokens},
47    memory::arena::SyntaxArena,
48    parser::{Associativity, OperatorInfo, ParseCache, ParseOutput, ParseSession, Parser, ParserState, Pratt, PrattParser, binary, parse, parse_one_pass, postfix, state::TreeSink, unary},
49    source::{Source, SourceText, TextEdit},
50    tree::{GreenNode, GreenTree, RedLeaf, RedNode, RedTree},
51};
52
53pub use triomphe::Arc;