From be734be7f7ba9fd3612bbbb0b0b5cda6b588cd16 Mon Sep 17 00:00:00 2001 From: f3ath Date: Sat, 3 Aug 2024 21:06:43 -0700 Subject: [PATCH] 0.7.4 --- CHANGELOG.md | 10 ++++++++++ lib/src/grammar/number.dart | 14 +++++++++----- pubspec.yaml | 2 +- test/cases/cts | 2 +- test/cases/standard/expressions_boolean.json | 2 +- test/helper.dart | 1 + 6 files changed, 23 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0fb4df1..5301b6d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,15 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.7.4] - 2024-08-03 +### Changed +- CTS updated + +### Fixed +- Uppercase "E" was not acceptable in floating point numbers +- A digit before the decimal point was not enforced for floating point numbers +- Integer literal bounds were not enforced + ## [0.7.3] - 2024-08-01 ### Changed - Updated CTS @@ -196,6 +205,7 @@ Previously, no modification would be made and no errors/exceptions thrown. ### Added - Basic design draft +[0.7.4]: https://github.com/f3ath/jessie/compare/0.7.3...0.7.4 [0.7.3]: https://github.com/f3ath/jessie/compare/0.7.2...0.7.3 [0.7.2]: https://github.com/f3ath/jessie/compare/0.7.1...0.7.2 [0.7.1]: https://github.com/f3ath/jessie/compare/0.7.0...0.7.1 diff --git a/lib/src/grammar/number.dart b/lib/src/grammar/number.dart index 501634b..35d658b 100644 --- a/lib/src/grammar/number.dart +++ b/lib/src/grammar/number.dart @@ -1,21 +1,25 @@ import 'package:petitparser/petitparser.dart'; +const _intMin = -9007199254740991; +const _intMax = 9007199254740991; + final _digit1 = range('1', '9'); final _integer = (char('0') | (char('-').optional() & _digit1 & digit().star())) - .flatten('an integer number expected'); + .flatten('integer expected'); final _float = - (char('-').optional() & digit().star() & char('.') & digit().plus()) - .flatten('a floating point number expected'); + (char('-').optional() & digit().plus() & char('.') & digit().plus()) + .flatten('floating point expected'); final _exp = ((_float | _integer | string('-0')) & - char('e') & + charIgnoringCase('e') & anyOf('-+').optional() & digit().plus()) .flatten('an exponent number expected'); -final integer = _integer.map(int.parse); +final integer = + _integer.map(int.parse).where((it) => it >= _intMin && it <= _intMax); final Parser number = [ _exp.map(double.parse), diff --git a/pubspec.yaml b/pubspec.yaml index 0e54f58..614ce0d 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: json_path -version: 0.7.3 +version: 0.7.4 description: "Implementation of RFC 9535 - JSONPath: Query Expressions for JSON. Reads and writes values in parsed JSON objects using queries like `$.store.book[2].price`." homepage: "https://github.com/f3ath/jessie" diff --git a/test/cases/cts b/test/cases/cts index c252118..733fe52 160000 --- a/test/cases/cts +++ b/test/cases/cts @@ -1 +1 @@ -Subproject commit c2521186490dfff4577ebfd408c93cf6092a9ef5 +Subproject commit 733fe526ceccb183ed0e3397340f2ee9feec0d67 diff --git a/test/cases/standard/expressions_boolean.json b/test/cases/standard/expressions_boolean.json index 5a71a99..e320f25 100644 --- a/test/cases/standard/expressions_boolean.json +++ b/test/cases/standard/expressions_boolean.json @@ -5,7 +5,7 @@ "document": [-100, 0, 1, 2, 3, 3.14, 4, "4", "1", true, [], {}], "result": [2, 3, 3.14, 4] }, { - "selector": "$[?((@ > 2) || (@ < -.14))]", + "selector": "$[?((@ > 2) || (@ < -0.14))]", "document": [-100, 0, 1, 2, 3, 3.14, 4, "4", "1", true, [], {}], "result": [-100, 3, 3.14, 4] }, { diff --git a/test/helper.dart b/test/helper.dart index de91790..acca817 100644 --- a/test/helper.dart +++ b/test/helper.dart @@ -90,4 +90,5 @@ const _knownKeys = { 'results', 'selector', 'skip', + 'tags', };