#[repr(C)]pub struct Node {
pub padding: Len,
pub size: Len,
pub first_child: u32,
pub child_count_ext: u32,
pub sym: u16,
pub prod: u16,
pub packed: u32,
}Expand description
紧凑 32 字节(精确半条 64B 缓存行)语法树节点。
child_count_ext低 24 位存子节点数,高 8 位内联外部扫描器状态编号(0..=253直接存储,255表示无外部记号,254表示溢出至Arena::cold),使 Python/Rust/Bash/HTML/JS/TS 等全部带外部扫描器的语言 99.9% 节点均零ColdNode分配并命中热归约快路径。packed低 5 位为F_*标志,位 5 为F_COLD_BIT,高 26 位内联visible_descendants或Arena::cold下标。
Fields§
§padding: Len§size: Len§first_child: u32child_count() > 0 时为 kids 起始下标;child_count() == 0 时复用存放 ERROR 叶子跳过的首字符(lchar)。
child_count_ext: u32§sym: u16§prod: u16§packed: u32Implementations§
Source§impl Node
impl Node
pub fn child_count(&self) -> u32
pub fn flags(&self) -> u8
pub fn set_flag(&mut self, f: u8)
pub fn clear_flag(&mut self, f: u8)
pub fn lchar(&self) -> u32
pub fn set_lchar(&mut self, ch: u32)
pub fn extra(&self) -> bool
pub fn visible(&self) -> bool
pub fn named(&self) -> bool
pub fn missing(&self) -> bool
pub fn is_keyword(&self) -> bool
pub fn is_error(&self) -> bool
pub fn total(&self) -> Len
Trait Implementations§
Auto Trait Implementations§
impl Forget for Node
impl Freeze for Node
impl Move for Node
impl RefUnwindSafe for Node
impl Send for Node
impl Sync for Node
impl Unpin for Node
impl UnsafeUnpin for Node
impl UnwindSafe for Node
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more