Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.7.4 #111

Merged
merged 1 commit into from
Aug 4, 2024
Merged

0.7.4 #111

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
14 changes: 9 additions & 5 deletions lib/src/grammar/number.dart
Original file line number Diff line number Diff line change
@@ -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<num> number = [
_exp.map(double.parse),
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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"

Expand Down
2 changes: 1 addition & 1 deletion test/cases/standard/expressions_boolean.json
Original file line number Diff line number Diff line change
Expand Up @@ -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]
}, {
Expand Down
1 change: 1 addition & 0 deletions test/helper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,5 @@ const _knownKeys = {
'results',
'selector',
'skip',
'tags',
};
Loading