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

Side by Side Diff: packages/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 unified diff | Download patch
OLDNEW
1 part of reflection; 1 part of petitparser.reflection;
2 2
3 /** 3 /// Returns a lazy iterable over all parsers reachable from a [root].
4 * Returns a lazy iterable over all parsers reachable from a [root]. 4 ///
5 * 5 /// For example, the following code prints the two parsers of the
6 * For example, the following code prints the two parsers of the 6 /// defined grammar:
7 * defined grammar: 7 ///
8 * 8 /// var parser = range('0', '9').star();
9 * var parser = range('0', '9').star(); 9 /// allParser(parser).forEach((each) {
10 * allParser(parser).forEach((each) { 10 /// print(each);
11 * print(each); 11 /// });
12 * }); 12 ///
13 *
14 */
15 Iterable<Parser> allParser(Parser root) => new _ParserIterable(root); 13 Iterable<Parser> allParser(Parser root) => new _ParserIterable(root);
16 14
17 class _ParserIterable extends IterableBase<Parser> { 15 class _ParserIterable extends IterableBase<Parser> {
18 final Parser root; 16 final Parser root;
19 17
20 _ParserIterable(this.root); 18 _ParserIterable(this.root);
21 19
22 @override 20 @override
23 Iterator<Parser> get iterator => new _ParserIterator([root]); 21 Iterator<Parser> get iterator => new _ParserIterator([root]);
24 } 22 }
(...skipping 18 matching lines...) Expand all
43 current = todo.removeLast(); 41 current = todo.removeLast();
44 for (var parser in current.children) { 42 for (var parser in current.children) {
45 if (!seen.contains(parser)) { 43 if (!seen.contains(parser)) {
46 todo.add(parser); 44 todo.add(parser);
47 seen.add(parser); 45 seen.add(parser);
48 } 46 }
49 } 47 }
50 return true; 48 return true;
51 } 49 }
52 } 50 }
OLDNEW
« no previous file with comments | « packages/petitparser/lib/src/petitparser/token.dart ('k') | packages/petitparser/lib/src/reflection/optimize.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698