diff --git a/examples/a.talc b/examples/a.talc new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/examples/a.talc @@ -0,0 +1 @@ + diff --git a/talc-lang/src/parser/lexer.rs b/talc-lang/src/parser/lexer.rs index f0dad76..ecc178b 100644 --- a/talc-lang/src/parser/lexer.rs +++ b/talc-lang/src/parser/lexer.rs @@ -373,9 +373,6 @@ impl<'s> Lexer<'s> { fn next_number(&mut self) -> Result> { if self.next()? == '0' { - while self.peek()? == '_' { - self.next()?; - } match self.peek()? { 'x' => { self.next()?; @@ -393,7 +390,7 @@ impl<'s> Lexer<'s> { self.next()?; return self.next_int_base(2) } - '0'..='9' | '.' | 'e' | 'i' => (), + '0'..='9' | '_' | '.' | 'e' | 'i' => (), c if is_xid_start(c) => return self.unexpected(), _ => return self.emit(K::Integer), } diff --git a/talc-lang/src/parser/util.rs b/talc-lang/src/parser/util.rs index 08cfb83..576dacb 100644 --- a/talc-lang/src/parser/util.rs +++ b/talc-lang/src/parser/util.rs @@ -148,7 +148,7 @@ pub fn parse_int<'a, S: Into<&'a LStr>>(f: S, radix: u32) -> Result>(f: S) -> Result { let f = f.into(); - match f.chars().nth(2) { + match f.chars().nth(1) { Some('x') => parse_int(&f[2..], 16), Some('o') => parse_int(&f[2..], 8), Some('s') => parse_int(&f[2..], 6),