From 4774e6b1351a4fb013b592af2e297375c5448d34 Mon Sep 17 00:00:00 2001 From: thomashii Date: Sat, 11 Sep 2021 22:05:50 +0800 Subject: [PATCH] Updated combinator --- packages/code_buffer/CHANGELOG.md | 4 ++++ packages/code_buffer/README.md | 2 +- packages/code_buffer/pubspec.yaml | 2 +- packages/combinator/CHANGELOG.md | 3 ++- packages/combinator/README.md | 2 ++ packages/combinator/example/basic_auth.dart | 4 ++-- packages/combinator/example/calculator.dart | 4 ++-- packages/combinator/example/delimiter.dart | 2 +- packages/combinator/example/json.dart | 6 +++--- packages/combinator/example/main.dart | 2 +- packages/combinator/example/query_string.dart | 2 +- packages/combinator/example/sexp.dart | 2 +- packages/combinator/example/tuple.dart | 2 +- packages/combinator/lib/src/combinator/any.dart | 2 +- packages/combinator/lib/src/combinator/combinator.dart | 2 +- packages/combinator/lib/src/combinator/longest.dart | 8 ++++++-- packages/combinator/lib/src/combinator/repeat.dart | 4 +++- packages/combinator/test/list_test.dart | 2 +- packages/combinator/test/match_test.dart | 2 +- packages/combinator/test/misc_test.dart | 2 +- packages/combinator/test/value_test.dart | 2 +- packages/pub_sub/CHANGELOG.md | 4 ++++ packages/pub_sub/README.md | 5 +++-- packages/pub_sub/pubspec.yaml | 2 +- 24 files changed, 45 insertions(+), 27 deletions(-) diff --git a/packages/code_buffer/CHANGELOG.md b/packages/code_buffer/CHANGELOG.md index 7d179c3..fd1e5f8 100644 --- a/packages/code_buffer/CHANGELOG.md +++ b/packages/code_buffer/CHANGELOG.md @@ -1,5 +1,9 @@ # Change Log +## 3.0.1 + +* Updated README + ## 3.0.0 * Upgraded from `pendantic` to `lints` linter diff --git a/packages/code_buffer/README.md b/packages/code_buffer/README.md index f79dfb1..b779eab 100644 --- a/packages/code_buffer/README.md +++ b/packages/code_buffer/README.md @@ -1,6 +1,6 @@ # Belatuk Code Buffer -[![version](https://img.shields.io/badge/pub-v3.0.0-brightgreen)](https://pub.dartlang.org/packages/belatuk_code_buffer) +[![version](https://img.shields.io/badge/pub-v3.0.1-brightgreen)](https://pub.dartlang.org/packages/belatuk_code_buffer) [![Null Safety](https://img.shields.io/badge/null-safety-brightgreen)](https://dart.dev/null-safety) [![License](https://img.shields.io/github/license/dart-backend/belatuk-common-utilities)](https://github.com/dart-backend/belatuk-common-utilities/packages/code_buffer/LICENSE) diff --git a/packages/code_buffer/pubspec.yaml b/packages/code_buffer/pubspec.yaml index 93d25b2..8a3e2a1 100644 --- a/packages/code_buffer/pubspec.yaml +++ b/packages/code_buffer/pubspec.yaml @@ -1,5 +1,5 @@ name: belatuk_code_buffer -version: 3.0.0 +version: 3.0.1 description: An advanced StringBuffer geared toward generating code, and source maps. homepage: https://github.com/dart-backend/belatuk-common-utilities/tree/main/packages/code_buffer environment: diff --git a/packages/combinator/CHANGELOG.md b/packages/combinator/CHANGELOG.md index 60bcaaa..7d0f656 100644 --- a/packages/combinator/CHANGELOG.md +++ b/packages/combinator/CHANGELOG.md @@ -4,10 +4,11 @@ * Upgraded from `pendantic` to `lints` linter * Published as `belatuk_combinator` package +* Resolved static analysis warnings ## 2.0.2 -* Resolve static analysis warnings +* Resolved static analysis warnings ## 2.0.1 diff --git a/packages/combinator/README.md b/packages/combinator/README.md index 23ec825..f1e543c 100644 --- a/packages/combinator/README.md +++ b/packages/combinator/README.md @@ -4,6 +4,8 @@ [![Null Safety](https://img.shields.io/badge/null-safety-brightgreen)](https://dart.dev/null-safety) [![License](https://img.shields.io/github/license/dart-backend/belatuk-common-utilities)](https://github.com/dart-backend/belatuk-common-utilities/packages/combinator/LICENSE) +**Replacement of `package:combinator` with breaking changes to support NNBD.** + Packrat parser combinators that support static typing, generics, file spans, memoization, and more. **RECOMMENDED:** diff --git a/packages/combinator/example/basic_auth.dart b/packages/combinator/example/basic_auth.dart index 3f12808..5e9117a 100644 --- a/packages/combinator/example/basic_auth.dart +++ b/packages/combinator/example/basic_auth.dart @@ -2,7 +2,7 @@ import 'dart:convert'; import 'dart:io'; -import 'package:angel3_combinator/belatuk_combinator.dart'; +import 'package:belatuk_combinator/belatuk_combinator.dart'; import 'package:string_scanner/string_scanner.dart'; /// Parse a part of a decoded Basic auth string. @@ -33,7 +33,7 @@ final Parser credentialString = match?>( return credentials.parse(scanner).value; }); -final Parser basic = match('Basic').space(); +final Parser basic = match('Basic').space(); final Parser basicAuth = basic.then(credentialString).index(1); diff --git a/packages/combinator/example/calculator.dart b/packages/combinator/example/calculator.dart index 2f99afc..8cbe59a 100644 --- a/packages/combinator/example/calculator.dart +++ b/packages/combinator/example/calculator.dart @@ -1,6 +1,6 @@ import 'dart:math'; import 'dart:io'; -import 'package:angel3_combinator/belatuk_combinator.dart'; +import 'package:belatuk_combinator/belatuk_combinator.dart'; import 'package:string_scanner/string_scanner.dart'; /// Note: This grammar does not handle precedence, for the sake of simplicity. @@ -22,7 +22,7 @@ Parser calculatorGrammar() { alternatives.add( chain([ expr.space(), - match(op).space() as Parser, + match(op).space() as Parser, expr.space(), ]).map((r) => f(r.value![0], r.value![2])), ); diff --git a/packages/combinator/example/delimiter.dart b/packages/combinator/example/delimiter.dart index 6876a55..14e5651 100644 --- a/packages/combinator/example/delimiter.dart +++ b/packages/combinator/example/delimiter.dart @@ -1,5 +1,5 @@ import 'dart:io'; -import 'package:angel3_combinator/belatuk_combinator.dart'; +import 'package:belatuk_combinator/belatuk_combinator.dart'; import 'package:string_scanner/string_scanner.dart'; final Parser id = diff --git a/packages/combinator/example/json.dart b/packages/combinator/example/json.dart index 90f038f..cca5dc0 100644 --- a/packages/combinator/example/json.dart +++ b/packages/combinator/example/json.dart @@ -1,5 +1,5 @@ import 'dart:io'; -import 'package:angel3_combinator/belatuk_combinator.dart'; +import 'package:belatuk_combinator/belatuk_combinator.dart'; import 'package:string_scanner/string_scanner.dart'; Parser jsonGrammar() { @@ -51,13 +51,13 @@ Parser jsonGrammar() { } void main() { - var JSON = jsonGrammar(); + var json = jsonGrammar(); while (true) { stdout.write('Enter some JSON: '); var line = stdin.readLineSync()!; var scanner = SpanScanner(line, sourceUrl: 'stdin'); - var result = JSON.parse(scanner); + var result = json.parse(scanner); if (!result.successful) { for (var error in result.errors) { diff --git a/packages/combinator/example/main.dart b/packages/combinator/example/main.dart index ff07b89..ee925aa 100644 --- a/packages/combinator/example/main.dart +++ b/packages/combinator/example/main.dart @@ -1,5 +1,5 @@ import 'dart:io'; -import 'package:angel3_combinator/belatuk_combinator.dart'; +import 'package:belatuk_combinator/belatuk_combinator.dart'; import 'package:string_scanner/string_scanner.dart'; final Parser minus = match('-'); diff --git a/packages/combinator/example/query_string.dart b/packages/combinator/example/query_string.dart index d2525bc..58f3efc 100644 --- a/packages/combinator/example/query_string.dart +++ b/packages/combinator/example/query_string.dart @@ -1,7 +1,7 @@ // For some reason, this cannot be run in checked mode??? import 'dart:io'; -import 'package:angel3_combinator/belatuk_combinator.dart'; +import 'package:belatuk_combinator/belatuk_combinator.dart'; import 'package:string_scanner/string_scanner.dart'; final Parser key = diff --git a/packages/combinator/example/sexp.dart b/packages/combinator/example/sexp.dart index 93cb98e..16063fc 100644 --- a/packages/combinator/example/sexp.dart +++ b/packages/combinator/example/sexp.dart @@ -1,7 +1,7 @@ import 'dart:collection'; import 'dart:io'; import 'dart:math'; -import 'package:angel3_combinator/belatuk_combinator.dart'; +import 'package:belatuk_combinator/belatuk_combinator.dart'; import 'package:string_scanner/string_scanner.dart'; import 'package:tuple/tuple.dart'; diff --git a/packages/combinator/example/tuple.dart b/packages/combinator/example/tuple.dart index 68e4032..368abc7 100644 --- a/packages/combinator/example/tuple.dart +++ b/packages/combinator/example/tuple.dart @@ -1,4 +1,4 @@ -import 'package:angel3_combinator/belatuk_combinator.dart'; +import 'package:belatuk_combinator/belatuk_combinator.dart'; import 'package:string_scanner/string_scanner.dart'; void main() { diff --git a/packages/combinator/lib/src/combinator/any.dart b/packages/combinator/lib/src/combinator/any.dart index 45bc107..47fe49e 100644 --- a/packages/combinator/lib/src/combinator/any.dart +++ b/packages/combinator/lib/src/combinator/any.dart @@ -15,7 +15,7 @@ Parser any(Iterable> parsers, class _Any extends Parser { final Iterable> parsers; final bool backtrack; - final errorMessage; + final dynamic errorMessage; final SyntaxErrorSeverity severity; _Any(this.parsers, this.backtrack, this.errorMessage, this.severity); diff --git a/packages/combinator/lib/src/combinator/combinator.dart b/packages/combinator/lib/src/combinator/combinator.dart index 717365a..b3b7c72 100644 --- a/packages/combinator/lib/src/combinator/combinator.dart +++ b/packages/combinator/lib/src/combinator/combinator.dart @@ -2,7 +2,7 @@ library lex.src.combinator; import 'dart:collection'; -import 'package:angel3_code_buffer/angel3_code_buffer.dart'; +import 'package:belatuk_code_buffer/belatuk_code_buffer.dart'; import 'package:matcher/matcher.dart'; import 'package:source_span/source_span.dart'; import 'package:string_scanner/string_scanner.dart'; diff --git a/packages/combinator/lib/src/combinator/longest.dart b/packages/combinator/lib/src/combinator/longest.dart index 36d9652..94c7340 100644 --- a/packages/combinator/lib/src/combinator/longest.dart +++ b/packages/combinator/lib/src/combinator/longest.dart @@ -34,7 +34,9 @@ class _Longest extends Parser { if (result.successful && result.span != null) { results.add(result); - } else if (parser is _Alt) errors.addAll(result.errors); + } else if (parser is _Alt) { + errors.addAll(result.errors); + } args.scanner.position = replay; } @@ -70,7 +72,9 @@ class _Longest extends Parser { if (result.successful) { results.add(result); - } else if (parser is _Alt) errors.addAll(result.errors); + } else if (parser is _Alt) { + errors.addAll(result.errors); + } args.scanner.position = replay; } diff --git a/packages/combinator/lib/src/combinator/repeat.dart b/packages/combinator/lib/src/combinator/repeat.dart index 13dd9f2..3e159ad 100644 --- a/packages/combinator/lib/src/combinator/repeat.dart +++ b/packages/combinator/lib/src/combinator/repeat.dart @@ -28,7 +28,9 @@ class _Repeat extends ListParser { results.add(result.value!); } replay = args.scanner.position; - } else if (backtrack) args.scanner.position = replay; + } else if (backtrack) { + args.scanner.position = replay; + } if (result.span != null) { spans.add(result.span!); diff --git a/packages/combinator/test/list_test.dart b/packages/combinator/test/list_test.dart index 636c322..7e8308d 100644 --- a/packages/combinator/test/list_test.dart +++ b/packages/combinator/test/list_test.dart @@ -1,4 +1,4 @@ -import 'package:angel3_combinator/belatuk_combinator.dart'; +import 'package:belatuk_combinator/belatuk_combinator.dart'; import 'package:test/test.dart'; import 'common.dart'; diff --git a/packages/combinator/test/match_test.dart b/packages/combinator/test/match_test.dart index 6fb55e8..109bc28 100644 --- a/packages/combinator/test/match_test.dart +++ b/packages/combinator/test/match_test.dart @@ -1,4 +1,4 @@ -import 'package:angel3_combinator/belatuk_combinator.dart'; +import 'package:belatuk_combinator/belatuk_combinator.dart'; import 'package:test/test.dart'; import 'common.dart'; diff --git a/packages/combinator/test/misc_test.dart b/packages/combinator/test/misc_test.dart index 7b08e77..1487824 100644 --- a/packages/combinator/test/misc_test.dart +++ b/packages/combinator/test/misc_test.dart @@ -1,4 +1,4 @@ -import 'package:angel3_combinator/belatuk_combinator.dart'; +import 'package:belatuk_combinator/belatuk_combinator.dart'; import 'package:matcher/matcher.dart'; import 'package:test/test.dart'; import 'common.dart'; diff --git a/packages/combinator/test/value_test.dart b/packages/combinator/test/value_test.dart index 5bd8645..2a8f723 100644 --- a/packages/combinator/test/value_test.dart +++ b/packages/combinator/test/value_test.dart @@ -1,4 +1,4 @@ -import 'package:angel3_combinator/belatuk_combinator.dart'; +import 'package:belatuk_combinator/belatuk_combinator.dart'; import 'package:test/test.dart'; import 'common.dart'; diff --git a/packages/pub_sub/CHANGELOG.md b/packages/pub_sub/CHANGELOG.md index ce8548b..9eeeb3a 100644 --- a/packages/pub_sub/CHANGELOG.md +++ b/packages/pub_sub/CHANGELOG.md @@ -1,5 +1,9 @@ # Change Log +## 4.0.1 + +* Updated README + ## 4.0.0 * Upgraded from `pendantic` to `lints` linter diff --git a/packages/pub_sub/README.md b/packages/pub_sub/README.md index 3a835df..4c1d78b 100644 --- a/packages/pub_sub/README.md +++ b/packages/pub_sub/README.md @@ -1,8 +1,9 @@ # Belatuk Pub Sub -[![version](https://img.shields.io/badge/pub-v4.0.0-brightgreen)](https://pub.dartlang.org/packages/belatuk_pub_sub) +[![version](https://img.shields.io/badge/pub-v4.0.1-brightgreen)](https://pub.dartlang.org/packages/belatuk_pub_sub) [![Null Safety](https://img.shields.io/badge/null-safety-brightgreen)](https://dart.dev/null-safety) -[![License](https://img.shields.io/github/license/dart-backend/belatuk-common-utilities)](https://github.com/dart-backend/belatuk-common-utilities/packages/pub_sub/LICENSE) + +**Replacement of `package:pub_sub` with breaking changes to support NNBD.** Keep application instances in sync with a simple pub/sub API. diff --git a/packages/pub_sub/pubspec.yaml b/packages/pub_sub/pubspec.yaml index 963f3f2..05b5902 100644 --- a/packages/pub_sub/pubspec.yaml +++ b/packages/pub_sub/pubspec.yaml @@ -1,5 +1,5 @@ name: belatuk_pub_sub -version: 4.0.0 +version: 4.0.1 description: Keep application instances in sync with a simple pub/sub API. homepage: https://github.com/dart-backend/belatuk-common-utilities/tree/main/packages/pub_sub environment: