Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Unified Diff: petitparser/lib/src/reflection/iterable.dart

Issue 1400473008: Roll Observatory packages and add a roll script (Closed) Base URL: git@github.com:dart-lang/observatory_pub_packages.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « petitparser/lib/src/lisp/standard.dart ('k') | petitparser/lib/src/reflection/optimize.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: petitparser/lib/src/reflection/iterable.dart
diff --git a/petitparser/lib/src/reflection/iterable.dart b/petitparser/lib/src/reflection/iterable.dart
deleted file mode 100644
index b6579ffffcf1f645a1d95b4b077afacf20eb1534..0000000000000000000000000000000000000000
--- a/petitparser/lib/src/reflection/iterable.dart
+++ /dev/null
@@ -1,52 +0,0 @@
-part of reflection;
-
-/**
- * Returns a lazy iterable over all parsers reachable from a [root].
- *
- * For example, the following code prints the two parsers of the
- * defined grammar:
- *
- * var parser = range('0', '9').star();
- * allParser(parser).forEach((each) {
- * print(each);
- * });
- *
- */
-Iterable<Parser> allParser(Parser root) => new _ParserIterable(root);
-
-class _ParserIterable extends IterableBase<Parser> {
- final Parser root;
-
- _ParserIterable(this.root);
-
- @override
- Iterator<Parser> get iterator => new _ParserIterator([root]);
-}
-
-class _ParserIterator implements Iterator<Parser> {
- final List<Parser> todo;
- final Set<Parser> seen;
-
- _ParserIterator(Iterable<Parser> roots)
- : todo = new List.from(roots),
- seen = new Set.from(roots);
-
- @override
- Parser current;
-
- @override
- bool moveNext() {
- if (todo.isEmpty) {
- current = null;
- return false;
- }
- current = todo.removeLast();
- for (var parser in current.children) {
- if (!seen.contains(parser)) {
- todo.add(parser);
- seen.add(parser);
- }
- }
- return true;
- }
-}
« no previous file with comments | « petitparser/lib/src/lisp/standard.dart ('k') | petitparser/lib/src/reflection/optimize.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698