Add two useful assertions.
This commit is contained in:
parent
285fa7ecd0
commit
5bbbee5ba7
1 changed files with 2 additions and 0 deletions
|
@ -524,6 +524,7 @@ fn parse_tt_inner<'root, 'tt>(
|
||||||
// then we could be at the end of a sequence or at the beginning of the next
|
// then we could be at the end of a sequence or at the beginning of the next
|
||||||
// repetition.
|
// repetition.
|
||||||
if let Some(repetition) = &item.repetition {
|
if let Some(repetition) = &item.repetition {
|
||||||
|
debug_assert!(idx <= len + 1);
|
||||||
debug_assert!(matches!(item.top_elts, Tt(TokenTree::Sequence(..))));
|
debug_assert!(matches!(item.top_elts, Tt(TokenTree::Sequence(..))));
|
||||||
|
|
||||||
// At this point, regardless of whether there is a separator, we should add all
|
// At this point, regardless of whether there is a separator, we should add all
|
||||||
|
@ -569,6 +570,7 @@ fn parse_tt_inner<'root, 'tt>(
|
||||||
} else {
|
} else {
|
||||||
// If we are not in a repetition, then being at the end of a matcher means that we
|
// If we are not in a repetition, then being at the end of a matcher means that we
|
||||||
// have reached the potential end of the input.
|
// have reached the potential end of the input.
|
||||||
|
debug_assert_eq!(idx, len);
|
||||||
eof_items = match eof_items {
|
eof_items = match eof_items {
|
||||||
EofItems::None => EofItems::One(item),
|
EofItems::None => EofItems::One(item),
|
||||||
EofItems::One(_) | EofItems::Multiple => EofItems::Multiple,
|
EofItems::One(_) | EofItems::Multiple => EofItems::Multiple,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue