diff --git a/crates/typos-cli/tests/cmd/false-positives.toml b/crates/typos-cli/tests/cmd/false-positives.toml index 276faf9a..324f41d7 100644 --- a/crates/typos-cli/tests/cmd/false-positives.toml +++ b/crates/typos-cli/tests/cmd/false-positives.toml @@ -1,11 +1,4 @@ bin.name = "typos" stdin = "" -stdout = """ -error: `afe` should be `safe` - ╭▸ ./sample.cpp:2:18 - │ -2 │ uint8 i = 0x1afe23456UL; - ╰╴ ━━━ -""" +stdout = "" stderr = "" -status.code = 2 diff --git a/crates/typos/src/tokens.rs b/crates/typos/src/tokens.rs index a87a4834..19f5326a 100644 --- a/crates/typos/src/tokens.rs +++ b/crates/typos/src/tokens.rs @@ -281,7 +281,13 @@ mod parser { ::Slice: AsBStr + SliceLen + Default, ::Token: AsChar + Copy, { - ('0', alt(('x', 'X')), take_while(1.., is_hex_digit_with_sep)) + ( + '0', + alt(('x', 'X')), + take_while(1.., is_hex_digit_with_sep), + take_while(0.., is_xid_continue) + .verify(|s: &::Slice| std::str::from_utf8(s.as_bstr()).is_ok()), + ) .take() .parse_next(input) } @@ -1270,11 +1276,6 @@ mod test { case: None, offset: 0, }, - Identifier { - token: "0x1afe23456UL", - case: None, - offset: 17, - }, Identifier { token: "World", case: None, @@ -1294,11 +1295,6 @@ mod test { case: None, offset: 0, }, - Identifier { - token: "0x1afe23456UL", - case: None, - offset: 17, - }, Identifier { token: "World", case: None,