aboutsummaryrefslogtreecommitdiff
path: root/src/tokenizer.rs
diff options
context:
space:
mode:
authorMartin Fischer <martin@push-f.com>2023-08-17 08:04:21 +0200
committerMartin Fischer <martin@push-f.com>2023-08-19 11:41:22 +0200
commit91074b6e7e6e8463f15ca26bc39e70b80f954227 (patch)
tree7db7159df67faed9c5a7954a07a064cadcb0497e /src/tokenizer.rs
parent0f2d667eb08762b744ef5a18d6c09f99c9c1b8bb (diff)
refactor!: make Position generic over offset type
Previously Span was generic over R just so that it could provide the method: fn from_reader(reader: &R) -> Self; and properly implementing that method again relied on R implementing the Position trait: impl<P: Position> Span<P> for Range<usize> { .. } which was a very roundabout and awkward way of doing things. It makes much more sense to make the Position trait generic over the return type of its method (which previously always had to be usize). Which lets us provide a blanket implementation: impl<R: Reader> Position<NoopOffset> for R { .. }
Diffstat (limited to 'src/tokenizer.rs')
-rw-r--r--src/tokenizer.rs1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/tokenizer.rs b/src/tokenizer.rs
index 7768ee4..7b8b1ce 100644
--- a/src/tokenizer.rs
+++ b/src/tokenizer.rs
@@ -1,5 +1,6 @@
use crate::machine;
use crate::reader::{IntoReader, Reader};
+use crate::spans::Position;
use crate::utils::{
control_pat, noncharacter_pat, surrogate_pat, ControlToken, State as InternalState,
};