 import Foundation
 import LlamaKit
 
+/// Anything that can be parsed from an NSScanner.
+public protocol Scannable {
+	/// Attempts to parse an instance of the receiver from the given scanner.
+	///
+	/// If parsing fails, the scanner will be left at the first invalid
+	/// character (with any partially valid input already consumed).
+	class func fromScanner(scanner: NSScanner) -> Result<Self>
+}
+
 /// Represents a Cartfile, which is a specification of a project's dependencies
 /// and any other settings Carthage needs to build it.
 public struct Cartfile {


	/// The version(s) that are required to satisfy this dependency.
	public var version: VersionSpecifier

	/// Attempts to parse a Dependency specification.
	public static func fromScanner(scanner: NSScanner) -> Result<Dependency> {
		if !scanner.scanString("github", intoString: nil) {

			return scanVersion().map { CompatibleWith($0) }
		} else {
			return success(Any)
		}
	}
}
