Add tests for float access macro call inputs

This commit is contained in:
Lukas Wirth 2023-02-07 17:12:24 +01:00
parent f6539b139e
commit e59487de38
5 changed files with 58 additions and 37 deletions

View file

@ -7,7 +7,12 @@ use crate::{Leaf, Subtree, TokenTree};
struct EntryId(usize);
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
struct EntryPtr(EntryId, usize);
struct EntryPtr(
/// The index of the buffer containing the entry.
EntryId,
/// The index of the entry within the buffer.
usize,
);
/// Internal type which is used instead of `TokenTree` to represent a token tree
/// within a `TokenBuffer`.
@ -229,7 +234,11 @@ impl<'a, Span> Cursor<'a, Span> {
Some(&Entry::Subtree(_, _, entry_id)) => {
Cursor::create(self.buffer, EntryPtr(entry_id, 0))
}
_ => self.bump(),
Some(Entry::End(exit)) => match exit {
Some(exit) => Cursor::create(self.buffer, *exit),
None => self,
},
_ => Cursor::create(self.buffer, EntryPtr(self.ptr.0, self.ptr.1 + 1)),
}
}