File tree Expand file tree Collapse file tree 3 files changed +17
-4
lines changed
Expand file tree Collapse file tree 3 files changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -1363,8 +1363,12 @@ def _scan_number(self) -> None:
13631363 decimal = True
13641364 self ._advance ()
13651365 elif self ._peek in ("-" , "+" ) and scientific == 1 :
1366- scientific += 1
1367- self ._advance ()
1366+ # Only consume +/- if followed by a digit
1367+ if self ._current + 1 < self .size and self .sql [self ._current + 1 ].isdigit ():
1368+ scientific += 1
1369+ self ._advance ()
1370+ else :
1371+ return self ._add (TokenType .NUMBER )
13681372 elif self ._peek .upper () == "E" and not scientific :
13691373 scientific += 1
13701374 self ._advance ()
Original file line number Diff line number Diff line change @@ -513,8 +513,13 @@ impl<'a> TokenizerState<'a> {
513513 decimal = true ;
514514 self . advance ( 1 ) ?;
515515 } else if ( self . peek_char == '-' || self . peek_char == '+' ) && scientific == 1 {
516- scientific += 1 ;
517- self . advance ( 1 ) ?;
516+ // Only consume +/- if followed by a digit
517+ if self . current + 1 < self . size && self . sql [ self . current + 1 ] . is_ascii_digit ( ) {
518+ scientific += 1 ;
519+ self . advance ( 1 ) ?;
520+ } else {
521+ return self . add ( self . token_types . number , None ) ;
522+ }
518523 } else if self . peek_char . to_ascii_uppercase ( ) == 'E' && scientific == 0 {
519524 scientific += 1 ;
520525 self . advance ( 1 ) ?;
Original file line number Diff line number Diff line change @@ -369,6 +369,10 @@ def test_duckdb(self):
369369 parse_one ("a // b" , read = "duckdb" ).assert_is (exp .IntDiv ).sql (dialect = "duckdb" ), "a // b"
370370 )
371371
372+ self .validate_identity (
373+ "SELECT tbl.x*1e4+tbl.y FROM tbl" ,
374+ "SELECT tbl.x * 1e4 + tbl.y FROM tbl" ,
375+ )
372376 self .validate_identity ("DAYNAME(x)" )
373377 self .validate_identity ("MONTHNAME(x)" )
374378 self .validate_identity (
You can’t perform that action at this time.
0 commit comments