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

Unified Diff: packages/petitparser/lib/src/petitparser/context.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/context.dart
diff --git a/petitparser/lib/src/core/context.dart b/packages/petitparser/lib/src/petitparser/context.dart
similarity index 62%
rename from petitparser/lib/src/core/context.dart
rename to packages/petitparser/lib/src/petitparser/context.dart
index f9cac843322ec866363b1f036ef2c211e5c76fb1..8594515a5fdf04b7f5848de94c4dc0d395cfe114 100644
--- a/petitparser/lib/src/core/context.dart
+++ b/packages/petitparser/lib/src/petitparser/context.dart
@@ -1,76 +1,50 @@
part of petitparser;
-/**
- * An immutable parse context.
- */
+/// An immutable parse context.
class Context {
const Context(this.buffer, this.position);
- /**
- * The buffer we are working on.
- */
+ /// The buffer we are working on.
final buffer;
- /**
- * The current position in the buffer.
- */
+ /// The current position in the buffer.
final int position;
- /**
- * Returns a result indicating a parse success.
- */
+ /// Returns a result indicating a parse success.
Result success(result, [int position]) {
return new Success(buffer, position == null ? this.position : position, result);
}
- /**
- * Returns a result indicating a parse failure.
- */
+ /// Returns a result indicating a parse failure.
Result failure(String message, [int position]) {
return new Failure(buffer, position == null ? this.position : position, message);
}
- /**
- * Returns a human readable string of the current context.
- */
+ /// Returns a human readable string of the current context.
String toString() => 'Context[${toPositionString()}]';
- /**
- * Returns the line:column if the input is a string, otherwise the position.
- */
+ /// Returns the line:column if the input is a string, otherwise the position.
String toPositionString() => Token.positionString(buffer, position);
}
-/**
- * An immutable parse result.
- */
+/// An immutable parse result.
abstract class Result extends Context {
const Result(buffer, position) : super(buffer, position);
- /**
- * Returns [true] if this result indicates a parse success.
- */
+ /// Returns [true] if this result indicates a parse success.
bool get isSuccess => false;
- /**
- * Returns [true] if this result indicates a parse failure.
- */
+ /// Returns [true] if this result indicates a parse failure.
bool get isFailure => false;
- /**
- * Returns the parse result of the current context.
- */
+ /// Returns the parse result of the current context.
get value;
- /**
- * Returns the parse message of the current context.
- */
+ /// Returns the parse message of the current context.
String get message;
}
-/**
- * An immutable parse result in case of a successful parse.
- */
+/// An immutable parse result in case of a successful parse.
class Success extends Result {
const Success(buffer, position, this.value) : super(buffer, position);
@@ -87,9 +61,7 @@ class Success extends Result {
String toString() => 'Success[${toPositionString()}]: $value';
}
-/**
- * An immutable parse result in case of a failed parse.
- */
+/// An immutable parse result in case of a failed parse.
class Failure extends Result {
const Failure(buffer, position, this.message) : super(buffer, position);
@@ -106,9 +78,7 @@ class Failure extends Result {
String toString() => 'Failure[${toPositionString()}]: $message';
}
-/**
- * An exception raised in case of a parse error.
- */
+/// An exception raised in case of a parse error.
class ParserError extends Error {
final Failure failure;
« no previous file with comments | « packages/petitparser/lib/src/petitparser/composite.dart ('k') | packages/petitparser/lib/src/petitparser/definition.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698