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(portable_simd)] // Enables SIMD acceleration for high-performance lexing and parsing
9#![feature(slice_ptr_get)] // Provides ergonomic access to raw pointers within slices
10#![feature(trusted_len)] // Optimizes iterator performance by trusting length hints in core structures
11#![warn(missing_docs)]
12#![doc(html_logo_url = "https://raw.githubusercontent.com/ygg-lang/oaks/refs/heads/dev/documents/logo.svg")]
13#![doc(html_favicon_url = "https://raw.githubusercontent.com/ygg-lang/oaks/refs/heads/dev/documents/logo.svg")]
14// #![feature(nonnull_slice_from_raw_parts)] // Essential for creating raw slices in `SyntaxArena` without null checks
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;
28#[cfg(feature = "serde")]
29pub mod serde_arc_str;
30#[cfg(feature = "serde")]
31pub mod serde_range;
32/// Source text management and location tracking.
33pub mod source;
34/// Tree structures for representing kind trees (green and red trees).
35pub mod tree;
36/// Tree traversal and transformation utilities.
37pub mod visitor;
38
39/// Helper utilities for common operations.
40pub mod helpers;
41
42pub use core::range::Range;
43
44pub use crate::{
45    builder::{Builder, BuilderCache},
46    errors::{OakDiagnostics, OakError, OakErrorKind},
47    language::{ElementRole, ElementType, Language, LanguageCategory, TokenRole, TokenType, UniversalElementRole, UniversalTokenRole},
48    lexer::{LexOutput, Lexer, LexerCache, LexerState, NoLexerCache, Token, TokenStream, Tokens},
49    memory::arena::SyntaxArena,
50    parser::{Associativity, OperatorInfo, ParseCache, ParseOutput, ParseSession, Parser, ParserState, Pratt, PrattParser, binary, parse, parse_one_pass, postfix, state::TreeSink, unary},
51    source::{Source, SourceText, TextEdit},
52    tree::{GreenNode, GreenTree, RedLeaf, RedNode, RedTree},
53};
54
55pub use triomphe::Arc;