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 {
51
51
{
52
52
type : TokenType . NUMBER ,
53
53
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,
55
55
} ,
56
56
// RESERVED_PHRASE is matched before all other keyword tokens
57
57
// 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) {
279
279
tbl;
280
280
` ) ;
281
281
} ) ;
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
+ } ) ;
282
297
}
You can’t perform that action at this time.
0 commit comments