File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed
Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ export default class Tokenizer {
5151 {
5252 type : TokenType . NUMBER ,
5353 regex :
54- / (?: 0 x [ 0 - 9 a - f A - F ] + | 0 b [ 0 1 ] + | (?: - \s * ) ? [ 0 - 9 ] + (?: \. [ 0 - 9 ] * ) ? (?: [ e E ] [ - + ] ? [ 0 - 9 ] + (?: \. [ 0 - 9 ] + ) ? ) ? ) (? ! [ \w \p{ Alphabetic} ] ) / uy,
54+ / (?: 0 x [ 0 - 9 a - f A - F ] + | 0 b [ 0 1 ] + | (?: - \s * ) ? (?: [ 0 - 9 ] * \. [ 0 - 9 ] + | [ 0 - 9 ] + (?: \. [ 0 - 9 ] * ) ? ) (?: [ e E ] [ - + ] ? [ 0 - 9 ] + (?: \. [ 0 - 9 ] + ) ? ) ? ) (? ! [ \w \p{ Alphabetic} ] ) / uy,
5555 } ,
5656 // RESERVED_PHRASE is matched before all other keyword tokens
5757 // to e.g. prioritize matching "TIMESTAMP WITH TIME ZONE" phrase over "WITH" clause.
Original file line number Diff line number Diff line change @@ -279,4 +279,19 @@ export default function behavesLikeSqlFormatter(format: FormatFn) {
279279 tbl;
280280 ` ) ;
281281 } ) ;
282+
283+ it ( 'supports decimal values without leading digits' , ( ) => {
284+ const result = format ( `
285+ SELECT employee_id FROM employees WHERE salary > .456 * 1000000 AND bonus < .0000239 * salary;
286+ ` ) ;
287+ expect ( result ) . toBe ( dedent `
288+ SELECT
289+ employee_id
290+ FROM
291+ employees
292+ WHERE
293+ salary > .456 * 1000000
294+ AND bonus < .0000239 * salary;
295+ ` ) ;
296+ } ) ;
282297}
You can’t perform that action at this time.
0 commit comments