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

Unified Diff: packages/petitparser/lib/src/petitparser/parsers.dart

Issue 2989763002: Update charted to 0.4.8 and roll (Closed)
Patch Set: Removed Cutch from list of reviewers Created 3 years, 5 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/parsers.dart
diff --git a/packages/petitparser/lib/src/petitparser/parsers.dart b/packages/petitparser/lib/src/petitparser/parsers.dart
deleted file mode 100644
index 8cc02d13be2342a6962affeac5dbf5e8eaba0e13..0000000000000000000000000000000000000000
--- a/packages/petitparser/lib/src/petitparser/parsers.dart
+++ /dev/null
@@ -1,81 +0,0 @@
-part of petitparser;
-
-/// Returns a parser that consumes nothing and succeeds.
-///
-/// For example, `char('a').or(epsilon())` is equivalent to
-/// `char('a').optional()`.
-Parser epsilon([result]) => new EpsilonParser(result);
-
-/// A parser that consumes nothing and succeeds.
-class EpsilonParser extends Parser {
- final _result;
-
- EpsilonParser(this._result);
-
- @override
- Result parseOn(Context context) => context.success(_result);
-
- @override
- Parser copy() => new EpsilonParser(_result);
-
- @override
- bool hasEqualProperties(Parser other) {
- return other is EpsilonParser
- && super.hasEqualProperties(other)
- && _result == other._result;
- }
-}
-
-/// Returns a parser that consumes nothing and fails.
-///
-/// For example, `failure()` always fails, no matter what input it is given.
-Parser failure([String message = 'unable to parse']) {
- return new FailureParser(message);
-}
-
-/// A parser that consumes nothing and fails.
-class FailureParser extends Parser {
- final String _message;
-
- FailureParser(this._message);
-
- @override
- Result parseOn(Context context) => context.failure(_message);
-
- @override
- String toString() => '${super.toString()}[$_message]';
-
- @override
- Parser copy() => new FailureParser(_message);
-
- @override
- bool hasEqualProperties(Parser other) {
- return other is FailureParser
- && super.hasEqualProperties(other)
- && _message == other._message;
- }
-}
-
-/// Returns a parser that is not defined, but that can be set at a later
-/// point in time.
-///
-/// For example, the following code sets up a parser that points to itself
-/// and that accepts a sequence of a's ended with the letter b.
-///
-/// var p = undefined();
-/// p.set(char('a').seq(p).or(char('b')));
-SettableParser undefined([String message = 'undefined parser']) {
- return failure(message).settable();
-}
-
-/// A parser that is not defined, but that can be set at a later
-/// point in time.
-class SettableParser extends DelegateParser {
- SettableParser(parser) : super(parser);
-
- /// Sets the receiver to delegate to [parser].
- void set(Parser parser) => replace(children[0], parser);
-
- @override
- Parser copy() => new SettableParser(_delegate);
-}
« no previous file with comments | « packages/petitparser/lib/src/petitparser/parser.dart ('k') | packages/petitparser/lib/src/petitparser/predicates.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698