                         if find(HEXDIG, c) {
                             pctEncoded += c
                             result += pctEncoded
-                            state = .ScanningLiterals
+                            state = .ScanningLiteral
                             pctEncoded = ""
 
                         } else {
-                            errors[index] = URITemplateError.MalformedPctEncodedInLiterals
+                            syntaxErrors += (URITemplateError.MalformedPctEncodedInLiteral, index)
                             result = appendLiteralString(pctEncoded, result)
                             result = appendLiteralCharacter(c, result)
-                            state = .ScanningLiterals
+                            state = .ScanningLiteral
                             pctEncoded = ""
                         }
 

            static let HEXDIG = "0123456789abcdefABCDEF"
            static let RESERVED = ":/?#[]@!$&'()*+,;="
            static let UNRESERVED = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~" // 66
        }

        let BehaviorTable = ClassVariable.BehaviorTable
        let HEXDIG = ClassVariable.HEXDIG
        let RESERVED = ClassVariable.RESERVED
        let UNRESERVED = ClassVariable.UNRESERVED


        // Pct-encoded isn't taken into account
        func appendLiteralCharacter(character: Character, toString: String) -> String {

                        if find(HEXDIG, c) {
                            pctEncoded += c
                        } else {
                            syntaxErrors += (URITemplateError.MalformedPctEncodedInLiteral, index)
                            result = appendLiteralString(pctEncoded, result)
                            result = appendLiteralCharacter(c, result)
                            state = .ScanningLiteral
                            pctEncoded = ""
                        }

