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; |