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

Unified Diff: packages/petitparser/lib/src/petitparser/predicates.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
Index: packages/petitparser/lib/src/petitparser/predicates.dart
diff --git a/petitparser/lib/src/core/predicates.dart b/packages/petitparser/lib/src/petitparser/predicates.dart
similarity index 68%
rename from petitparser/lib/src/core/predicates.dart
rename to packages/petitparser/lib/src/petitparser/predicates.dart
index 36c58a13b2bafe84c99539aff6ad2afcbcfbb426..d5a750e0e988331f19773a97fe23f842a9c0b41e 100644
--- a/petitparser/lib/src/core/predicates.dart
+++ b/packages/petitparser/lib/src/petitparser/predicates.dart
@@ -1,18 +1,14 @@
part of petitparser;
-/**
- * Returns a parser that accepts any input element.
- *
- * For example, `any()` succeeds and consumes any given letter. It only
- * fails for an empty input.
- */
+/// Returns a parser that accepts any input element.
+///
+/// For example, `any()` succeeds and consumes any given letter. It only
+/// fails for an empty input.
Parser any([String message = 'input expected']) {
return new AnyParser(message);
}
-/**
- * A parser that accepts any input element.
- */
+/// A parser that accepts any input element.
class AnyParser extends Parser {
final String _message;
@@ -38,34 +34,28 @@ class AnyParser extends Parser {
}
}
-/**
- * Returns a parser that accepts any of the [elements].
- *
- * For example, `anyIn('ab')` succeeds and consumes either the letter
- * `'a'` or the letter `'b'`. For any other input the parser fails.
- */
+/// Returns a parser that accepts any of the [elements].
+///
+/// For example, `anyIn('ab')` succeeds and consumes either the letter
+/// `'a'` or the letter `'b'`. For any other input the parser fails.
Parser anyIn(elements, [String message]) {
return predicate(1, (each) => elements.indexOf(each) >= 0,
message != null ? message : 'any of $elements expected');
}
-/**
- * Returns a parser that accepts the string [element].
- *
- * For example, `string('foo')` succeeds and consumes the input string
- * `'foo'`. Fails for any other input.
- */
+/// Returns a parser that accepts the string [element].
+///
+/// For example, `string('foo')` succeeds and consumes the input string
+/// `'foo'`. Fails for any other input.
Parser string(String element, [String message]) {
return predicate(element.length, (String each) => element == each,
message != null ? message : '$element expected');
}
-/**
- * Returns a parser that accepts the string [element] ignoring the case.
- *
- * For example, `stringIgnoreCase('foo')` succeeds and consumes the input
- * string `'Foo'` or `'FOO'`. Fails for any other input.
- */
+/// Returns a parser that accepts the string [element] ignoring the case.
+///
+/// For example, `stringIgnoreCase('foo')` succeeds and consumes the input
+/// string `'Foo'` or `'FOO'`. Fails for any other input.
Parser stringIgnoreCase(String element, [String message]) {
final lowerElement = element.toLowerCase();
return predicate(element.length,
@@ -73,23 +63,17 @@ Parser stringIgnoreCase(String element, [String message]) {
message != null ? message : '$element expected');
}
-/**
- * A generic predicate function returning [true] or [false] for a given
- * [input] argument.
- */
+/// A generic predicate function returning [true] or [false] for a given
+/// [input] argument.
typedef bool Predicate(input);
-/**
- * Returns a parser that reads input of the specified [length], accepts
- * it if the [predicate] matches, or fails with the given [message].
- */
+/// Returns a parser that reads input of the specified [length], accepts
+/// it if the [predicate] matches, or fails with the given [message].
Parser predicate(int length, Predicate predicate, String message) {
return new PredicateParser(length, predicate, message);
}
-/**
- * A parser for a literal satisfying a predicate.
- */
+/// A parser for a literal satisfying a predicate.
class PredicateParser extends Parser {
final int _length;
final Predicate _predicate;
« no previous file with comments | « packages/petitparser/lib/src/petitparser/parsers.dart ('k') | packages/petitparser/lib/src/petitparser/repeaters.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698