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