Handle f32 as a part of UUID (#4611)

Co-authored-by: Mees Delzenne <mees.delzenne@gmail.com>
This commit is contained in:
Dmitrii Blaginin 2024-08-28 13:03:49 +01:00 committed by GitHub
parent 6fbf84782f
commit ffbdcb3d3f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 8 additions and 3 deletions

View file

@ -5,7 +5,7 @@ use crate::{
mac::{expected_whitespace, unexpected},
ParseError, ParseErrorKind, ParseResult, Parser,
},
token::{t, DurationSuffix, NumberSuffix, TokenKind},
token::{t, DurationSuffix, NumberSuffix, TokenKind, VectorTypeKind},
},
};
@ -92,7 +92,9 @@ impl Parser<'_> {
| TokenKind::NumberSuffix(NumberSuffix::Float) => {
cur = self.pop_peek();
}
TokenKind::Language(_) | TokenKind::Keyword(_) => {
TokenKind::Language(_)
| TokenKind::Keyword(_)
| TokenKind::VectorType(VectorTypeKind::F64 | VectorTypeKind::F32) => {
// there are some keywords and languages keywords which could be part of the
// hex section.
if !self.span_bytes(next.span).iter().all(|x| x.is_ascii_hexdigit()) {
@ -166,6 +168,7 @@ mod test {
assert_uuid_parses("d0531951-20ec-4575-bb68-3e6b49d813fa");
assert_uuid_parses("e0531951-20ec-4575-bb68-3e6b49d813fa");
assert_uuid_parses("a0531951-20ec-4575-bb68-3e6b49d813fa");
assert_uuid_parses("b98839b9-0471-4dbb-aae0-14780e848f32");
}
#[test]

View file

@ -87,6 +87,7 @@ impl Parser<'_> {
TokenKind::Exponent
| TokenKind::NumberSuffix(_)
| TokenKind::DurationSuffix(_)
| TokenKind::VectorType(_)
| TokenKind::DatetimeChars(_) => self.glue_ident(false),
TokenKind::Digits => self.glue_numeric(),
t!("\"") | t!("'") => {
@ -128,7 +129,7 @@ impl Parser<'_> {
self.span_str(start.span).to_owned()
}
TokenKind::DatetimeChars(_) => {
TokenKind::DatetimeChars(_) | TokenKind::VectorType(_) => {
self.pop_peek();
self.span_str(start.span).to_owned()

View file

@ -456,6 +456,7 @@ impl TokenKind {
| TokenKind::Language(_)
| TokenKind::Algorithm(_)
| TokenKind::DatetimeChars(_)
| TokenKind::VectorType(_)
| TokenKind::Distance(_),
)
}