diff options
| author | Laurenz <laurmaedje@gmail.com> | 2022-05-31 12:37:05 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2022-05-31 12:37:05 +0200 |
| commit | 9bbebd69ddb4a7d7da98c3a79ff7d0cb187873fd (patch) | |
| tree | 0fc651f43337d65e13cccb2bbe85ab1b79666725 /src/parse | |
| parent | 08a6188123ad0806986fa4f5477b728a07d081cc (diff) | |
Numbered spans
Diffstat (limited to 'src/parse')
| -rw-r--r-- | src/parse/incremental.rs | 4 | ||||
| -rw-r--r-- | src/parse/mod.rs | 3 | ||||
| -rw-r--r-- | src/parse/parser.rs | 3 | ||||
| -rw-r--r-- | src/parse/tokens.rs | 3 |
4 files changed, 9 insertions, 4 deletions
diff --git a/src/parse/incremental.rs b/src/parse/incremental.rs index d81a5a23..e567cb07 100644 --- a/src/parse/incremental.rs +++ b/src/parse/incremental.rs @@ -134,6 +134,7 @@ impl Reparser<'_> { if let SearchState::Contained(pos) = search { let child = &mut node.children_mut()[pos.idx]; let prev_len = child.len(); + let prev_count = child.count(); if let Some(range) = match child { SyntaxNode::Inner(node) => { @@ -142,7 +143,8 @@ impl Reparser<'_> { SyntaxNode::Leaf(_) => None, } { let new_len = child.len(); - node.update_parent(new_len, prev_len); + let new_count = child.count(); + node.update_parent(prev_len, new_len, prev_count, new_count); return Some(range); } diff --git a/src/parse/mod.rs b/src/parse/mod.rs index 98d6470c..fddef04c 100644 --- a/src/parse/mod.rs +++ b/src/parse/mod.rs @@ -11,8 +11,9 @@ pub use tokens::*; use std::collections::HashSet; +use crate::diag::ErrorPos; use crate::syntax::ast::{Associativity, BinOp, UnOp}; -use crate::syntax::{ErrorPos, NodeKind, SyntaxNode}; +use crate::syntax::{NodeKind, SyntaxNode}; use crate::util::EcoString; /// Parse a source file. diff --git a/src/parse/parser.rs b/src/parse/parser.rs index 3d7cac45..722e53ce 100644 --- a/src/parse/parser.rs +++ b/src/parse/parser.rs @@ -3,7 +3,8 @@ use std::mem; use std::ops::Range; use super::{TokenMode, Tokens}; -use crate::syntax::{ErrorPos, InnerNode, NodeData, NodeKind, SyntaxNode}; +use crate::diag::ErrorPos; +use crate::syntax::{InnerNode, NodeData, NodeKind, SyntaxNode}; use crate::util::EcoString; /// A convenient token-based parser. diff --git a/src/parse/tokens.rs b/src/parse/tokens.rs index f095bd09..92155909 100644 --- a/src/parse/tokens.rs +++ b/src/parse/tokens.rs @@ -4,9 +4,10 @@ use unicode_xid::UnicodeXID; use unscanny::Scanner; use super::resolve::{resolve_hex, resolve_raw, resolve_string}; +use crate::diag::ErrorPos; use crate::geom::{AngleUnit, LengthUnit}; use crate::syntax::ast::{MathNode, RawNode, Unit}; -use crate::syntax::{ErrorPos, NodeKind}; +use crate::syntax::NodeKind; use crate::util::EcoString; /// An iterator over the tokens of a string of source code. |
