Skip to content

Commit

Permalink
Add support for capital letters in hexidecimal literals
Browse files Browse the repository at this point in the history
Fixes #9
  • Loading branch information
dubrowgn committed Jul 15, 2017
1 parent 3c1bb77 commit 173aca5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/scanning.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ impl<'a> Scanner<'a> {
let oct = |c: char| matches!(c, '_' | '0'...'7');
let dec = |c: char| matches!(c, '_' | '0'...'9');
let fdec = |c: char| matches!(c, '_' | '0'...'9' | '.');
let hex = |c: char| matches!(c, '_' | '0'...'9' | 'a'...'f');
let hex = |c: char| matches!(c, '_' | '0'...'9' | 'a'...'f' | 'A'...'F');

let start = self.column;
let mut pred: &Fn(char) -> bool = &fdec;
Expand Down Expand Up @@ -363,10 +363,10 @@ mod tests {

#[test]
fn scan_number() {
let mut s = setup("0b01 0o01234567 0x0123456789abcdef 0123456789 11_11 11.11");
let mut s = setup("0b01 0o01234567 0x0123456789abcdefABCDEF 0123456789 11_11 11.11");
expect(&mut s, TokenType::Number { str: "01".to_string(), prefix: "0b".to_string() });
expect(&mut s, TokenType::Number { str: "01234567".to_string(), prefix: "0o".to_string() });
expect(&mut s, TokenType::Number { str: "0123456789abcdef".to_string(), prefix: "0x".to_string() });
expect(&mut s, TokenType::Number { str: "0123456789abcdefABCDEF".to_string(), prefix: "0x".to_string() });
expect(&mut s, TokenType::Number { str: "0123456789".to_string(), prefix: "".to_string() });
expect(&mut s, TokenType::Number { str: "1111".to_string(), prefix: "".to_string() });
expect(&mut s, TokenType::Number { str: "11.11".to_string(), prefix: "".to_string() });
Expand Down

0 comments on commit 173aca5

Please sign in to comment.