From e3548f73f532cb4bfebf8bb0f259cd47e3206447 Mon Sep 17 00:00:00 2001 From: Evin Sellin Date: Mon, 16 May 2022 12:58:06 -0700 Subject: [PATCH 1/2] Allow numbers with trailing dots --- js/src/lexer.ts | 2 +- shared/testdata.json | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/js/src/lexer.ts b/js/src/lexer.ts index c14e0da7..07449015 100644 --- a/js/src/lexer.ts +++ b/js/src/lexer.ts @@ -27,7 +27,7 @@ const vaccumsWhitespace = (token: string, direction: "l" | "r") => { const refStarter = /[a-zA-Z_]/; const refContinuer = /[a-zA-Z_0-9]/; const numStarter = /[0-9]/; -const numIsValid = /^(0|([1-9][0-9]*))(\.[0-9]+)?([eE][+-]?[0-9]+)?/; +const numIsValid = /^(0|([1-9][0-9]*))(\.[0-9]*)?([eE][+-]?[0-9]+)?/; const whitespace = /\s/; export function lex(raw: string): LexToken[] { diff --git a/shared/testdata.json b/shared/testdata.json index 27917218..70865522 100644 --- a/shared/testdata.json +++ b/shared/testdata.json @@ -186,7 +186,6 @@ }, { "it": "parses numbers which end with a decimal point", - "skip": ["js"], "assertions": [ { "query": "0.", @@ -202,6 +201,11 @@ "query": "(5.)", "data": null, "expected": 5 + }, + { + "query": "-9.e2", + "data": null, + "expected": -900 } ] }, From d01a64e4f341eccd74988805f5b133a8f6441cfe Mon Sep 17 00:00:00 2001 From: Evin Sellin Date: Mon, 16 May 2022 13:17:39 -0700 Subject: [PATCH 2/2] add to changelog --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ca9d9108..0951c54a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,9 @@ Format [Keep A ChangeLog](https://keepachangelog.com/en/1.0.0/) ### Changed - https://github.com/evinism/mistql/pull/150 Modified JS implementation `#index` and `#split` functions to match the expected unicode behavior as established above. +### Fixed +- https://github.com/evinism/mistql/pull/152 Allowed numbers to end in bare decimal points + ## [0.4.9] 2022-05-05 ### Added