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

Unified Diff: petitparser/lib/src/core/parsers.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/core/parser.dart ('k') | petitparser/lib/src/core/predicates.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: petitparser/lib/src/core/parsers.dart
diff --git a/petitparser/lib/src/core/parsers.dart b/petitparser/lib/src/core/parsers.dart
deleted file mode 100644
index 57c4bbc6288c4256598d55e51a811f0d2984eb5a..0000000000000000000000000000000000000000
--- a/petitparser/lib/src/core/parsers.dart
+++ /dev/null
@@ -1,95 +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 | « petitparser/lib/src/core/parser.dart ('k') | petitparser/lib/src/core/predicates.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698