diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index f5b6092..3b9e24c 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -16,3 +16,4 @@ This document will **NOT** be updated for you, but feel free to update it whenev --- **Chloe** ([@akiramusic000](https://github.com/akiramusic000)) - Lead Developer +**Yichi Zhang** ([@YichiZhang0613](https://github.com/YichiZhang0613)) \ No newline at end of file diff --git a/tackc_lib/src/parser.rs b/tackc_lib/src/parser.rs index 12b9026..cc7faec 100644 --- a/tackc_lib/src/parser.rs +++ b/tackc_lib/src/parser.rs @@ -1079,8 +1079,8 @@ impl<'src, 'a> Parser<'src, 'a> { if !mode.normal() || self .peek() - .filter(|t| t.kind == TokenKind::LBrace) - .is_none() + .as_ref() + .is_none_or(|t| t.kind != TokenKind::LBrace) { return self.global_ident(recursion); } diff --git a/tackc_lib/src/span.rs b/tackc_lib/src/span.rs index 5538a2e..275c1a0 100644 --- a/tackc_lib/src/span.rs +++ b/tackc_lib/src/span.rs @@ -40,12 +40,12 @@ impl Span { /// This function will panic if the input string's length is greater than [`SpanValue::MAX`]. pub fn eof(string: &str) -> Self { assert!( - string.len() < SpanValue::MAX as usize, - "Length of `Span::eof` input must be less than `SpanValue::MAX!`" + string.len() <= SpanValue::MAX as usize, + "Length of `Span::eof` input must be less than or equal to `SpanValue::MAX!`" ); Self { - // Since `string.len() < SpanValue::MAX`, try_into() will return `Ok`. + // Since `string.len() <= SpanValue::MAX`, try_into() will return `Ok`. start: string.len().try_into().expect_unreachable(), // CHECKED(Chloe) end: string.len().try_into().expect_unreachable(), // CHECKED(Chloe) } @@ -57,13 +57,13 @@ impl Span { /// This function will panic if the input string's length is greater than [`SpanValue::MAX`]. pub fn full(string: &str) -> Self { assert!( - string.len() < SpanValue::MAX as usize, - "Length of `Span::full` input must be less than `SpanValue::MAX!`" + string.len() <= SpanValue::MAX as usize, + "Length of `Span::full` input must be less than or equal to `SpanValue::MAX!`" ); Self { start: 0, - // Since `string.len() < SpanValue::MAX`, try_into() will return `Ok`. + // Since `string.len() <= SpanValue::MAX`, try_into() will return `Ok`. end: string.len().try_into().expect_unreachable(), // CHECKED(Chloe) } }