func parse()

in Cyborg/VectorDrawableParser.swift [576:601]


    func parse(element _: String, attributes: [(XMLString, XMLString)]) -> ParseError? {
        for (key, value) in attributes {
            if let property = ClipPathProperty(rawValue: String(withoutCopying: key)) {
                switch property {
                case .name: name = String(withoutCopying: value)
                case .pathData:
                    let parsers = allDrawingCommands
                    switch consumeAll(using: parsers)(value, 0) {
                    case .ok(let result, _):
                        commands = result
                    case .error(let error):
                        let baseError = "Error parsing the <android:clipPath> tag: "
                        return baseError + error.message
                    }
                case .fillType:
                    fillType = CAShapeLayerFillRule(rawValue: String(copying: value))
                case .fillColor, .strokeColor:
                    // TODO: determine whether this needs to be handled
                    break
                }
            } else {
                return "Key \"\(key)\" is not a valid property of ClipPath."
            }
        }
        return nil
    }