diff --git a/src/protocol/parser/tokens.rs b/src/protocol/parser/tokens.rs index 72c019ae259a40e7a4d0e92e0e6b4ea93e8183f8..d64b9572963b0fd63ea7ee850c2d4bae92e39f1a 100644 --- a/src/protocol/parser/tokens.rs +++ b/src/protocol/parser/tokens.rs @@ -193,42 +193,9 @@ pub struct TokenMarker { pub handled: bool, } -/// The kind of token ranges that are specially parsed by the tokenizer. -#[derive(Debug, Clone, Copy, PartialEq, Eq)] -pub enum TokenRangeKind { - Module, - Pragma, - Import, - Definition, - Code, -} - -pub const NO_RELATION: i32 = -1; -pub const NO_SIBLING: i32 = NO_RELATION; - -/// A range of tokens with a specific meaning. Such a range is part of a tree -/// where each parent tree envelops all of its children. -#[derive(Debug)] -pub struct TokenRange { - // Index of parent in `TokenBuffer.ranges`, does not have a parent if the - // range kind is Module, in that case the parent index is -1. - pub parent_idx: i32, - pub range_kind: TokenRangeKind, - pub curly_depth: u32, - // Offsets into `TokenBuffer.ranges`: the tokens belonging to this range. - pub start: u32, // first token (inclusive index) - pub end: u32, // last token (exclusive index) - // Child ranges - pub num_child_ranges: u32, // Number of subranges - pub first_child_idx: i32, // First subrange (or -1 if no subranges) - pub last_child_idx: i32, // Last subrange (or -1 if no subranges) - pub next_sibling_idx: i32, // Next subrange (or -1 if no next subrange) -} - pub struct TokenBuffer { pub tokens: Vec, pub markers: Vec, - pub ranges: Vec, } impl TokenBuffer { @@ -236,7 +203,6 @@ impl TokenBuffer { return Self{ tokens: Vec::new(), markers: Vec::new(), - ranges: Vec::new() }; }