     }
 
     mutating func parseValue() -> Result {
-        while let c = head() {
-            switch c {
+        while loc < input.count {
+            switch input[loc] {
             case Literal.SPACE, Literal.TAB, Literal.RETURN, Literal.NEWLINE:
                 ++loc
 

        while loc < input.count {
            skipWhitespace()

            if head() == Literal.RIGHT_BRACKET {
                ++loc
                return .Ok(.Array(items))
            }

            if !items.isEmpty {
                if head() == Literal.COMMA {
                    ++loc
                } else {
                    return makeParseError("invalid array at position \(start) - missing `,` between elements")

            }

            skipWhitespace()
            if loc < input.count && input[loc] == Literal.COLON {
                ++loc
            } else {
                return makeParseError("invalid object at position \(start) - missing `:` between key and value")
