Skip to content

Commit

Permalink
v0.6.5 (#79)
Browse files Browse the repository at this point in the history
  • Loading branch information
f3ath authored Sep 12, 2023
1 parent 9eebd16 commit 1c8a847
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 9 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ 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.6.5] - 2023-09-11
### Fixed
- Certain numbers were not parsed correctly

## [0.6.4] - 2023-08-26
### Changed
- Bump dependencies versions
Expand Down Expand Up @@ -168,6 +172,7 @@ Previously, no modification would be made and no errors/exceptions thrown.
### Added
- Basic design draft

[0.6.5]: https://github.com/f3ath/jessie/compare/0.6.4...0.6.5
[0.6.4]: https://github.com/f3ath/jessie/compare/0.6.3...0.6.4
[0.6.3]: https://github.com/f3ath/jessie/compare/0.6.2...0.6.3
[0.6.2]: https://github.com/f3ath/jessie/compare/0.6.1...0.6.2
Expand Down
25 changes: 18 additions & 7 deletions lib/src/grammar/number.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,24 @@ import 'package:petitparser/petitparser.dart';

final _digit1 = range('1', '9');

final integer = (char('0') | (char('-').optional() & _digit1 & digit().star()))
.flatten('an integer number expected')
.map(int.parse);
final _integer = (char('0') | (char('-').optional() & _digit1 & digit().star()))
.flatten('an integer number expected');

final float =
final _float =
(char('-').optional() & digit().star() & char('.') & digit().plus())
.flatten('a floating point number expected')
.map(double.parse);
.flatten('a floating point number expected');

final Parser<num> number = [float, integer].toChoiceParser();
final _exp = ((_float | _integer | string('-0')) &
char('e') &
anyOf('-+').optional() &
digit().plus())
.flatten('an exponent number expected');

final integer = _integer.map(int.parse);

final Parser<num> number = [
_exp.map(double.parse),
_float.map(double.parse),
string('-0').map((_) => 0),
integer,
].toChoiceParser();
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.6.4
version: 0.6.5
description: Implementation of JSONPath expressions like "$.store.book[2].price". Reads and writes values in parsed JSON objects.
homepage: "https://github.com/f3ath/jessie"

Expand Down
2 changes: 1 addition & 1 deletion test/cases/cts

0 comments on commit 1c8a847

Please sign in to comment.