feat: allow underscores in integers
This commit is contained in:
parent
527737f020
commit
936f557536
2 changed files with 6 additions and 0 deletions
|
@ -87,6 +87,7 @@ mod test {
|
||||||
#[rstest]
|
#[rstest]
|
||||||
// Raw values
|
// Raw values
|
||||||
#[case("1", "1")]
|
#[case("1", "1")]
|
||||||
|
#[case("1_000", "1000")]
|
||||||
#[case("\"uwu\"", "uwu")]
|
#[case("\"uwu\"", "uwu")]
|
||||||
#[case(":owo", ":owo")]
|
#[case(":owo", ":owo")]
|
||||||
#[case("()", "()")]
|
#[case("()", "()")]
|
||||||
|
|
|
@ -173,6 +173,11 @@ fn read_int(input: &mut Peekable<Chars>, first: char) -> Token {
|
||||||
let mut raw_int = vec![first];
|
let mut raw_int = vec![first];
|
||||||
|
|
||||||
while let Some(c) = input.peek() {
|
while let Some(c) = input.peek() {
|
||||||
|
if *c == '_' {
|
||||||
|
input.next();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if !c.is_ascii_digit() {
|
if !c.is_ascii_digit() {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue