Skip to content

Commit 0fd0485

Browse files
BlurrechDevPaul Roskell
and
Paul Roskell
authored
Allow scientific notation without + or - as these are optional. (#31)
1e16 and 1e+!6 are both valid. Co-authored-by: Paul Roskell <[email protected]>
1 parent addc725 commit 0fd0485

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/lib.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1401,13 +1401,14 @@ mod tests {
14011401

14021402
#[test]
14031403
fn it_recognizes_scientific_notation() {
1404-
let input = "SELECT *, 1e-7 as small, 1e+7 as large FROM t";
1404+
let input = "SELECT *, 1e-7 as small, 1e2 as medium, 1e+7 as large FROM t";
14051405
let options = FormatOptions::default();
14061406
let expected = indoc!(
14071407
"
14081408
SELECT
14091409
*,
14101410
1e-7 as small,
1411+
1e2 as medium,
14111412
1e+7 as large
14121413
FROM
14131414
t"

src/tokenizer.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ fn scientific_notation(input: &str) -> IResult<&str, &str> {
393393
recognize(tuple((
394394
alt((decimal_number, digit1)),
395395
tag("e"),
396-
alt((tag("-"), tag("+"))),
396+
alt((tag("-"), tag("+"), tag(""))),
397397
digit1,
398398
)))(input)
399399
}

0 commit comments

Comments
 (0)