 		}
 	}
 
-	public var index: I {
+	public var sourcePos: SourcePos<I> {
 		switch self {
-		case let .Branch(_, i, _):
-			return i
+		case let .Branch(_, sourcePos, _):
+			return sourcePos
 		}
 	}
 

	}

	private func describe(n: Int) -> String {
		let description = String(count: n, repeatedValue: "\t" as Character) + "\(index): \(reason)"
		if children.count > 0 {
			return description + "\n" + children.lazy.map { $0.describe(n + 1) }.joinWithSeparator("\n")
		}


/// A composite error.
public enum Error<I: ForwardIndexType>: CustomStringConvertible {
	indirect case Branch(String, SourcePos<I>, [Error])

	/// Constructs a leaf error, e.g. for terminal parsers.
	public static func leaf(reason: String, _ sourcePos: SourcePos<I>) -> Error {
		return .Branch(reason, sourcePos, [])
	}

	public static func withReason(reason: String, _ sourcePos: SourcePos<I>) -> (Error, Error) -> Error {
		return { Error(reason: reason, sourcePos: sourcePos, children: [$0, $1]) }
	}

	public init(reason: String, sourcePos: SourcePos<I>, children: [Error]) {
		self = .Branch(reason, sourcePos, children)
	}


