 }
 
 
-// true
-print(matches(address:"ablak", pattern:"ablak"))
-
-// false
-print(matches(address:"ablak", pattern:"abrak"))
-
-// true
-print(matches(address:"ablak", pattern:"ab?ak"))
-
-// true
-print(matches(address:"ablak", pattern:"ab*"))
-
-// true
-print(matches(address:"ablak", pattern:"a{blak,jto}"))
-
-// false
-print(matches(address:"ablak", pattern:"a{blak|jto}"))
-
+print("true", matches(address:"ablak", pattern:"ablak"))
+
+print("false", matches(address:"ablak", pattern:"abrak"))
+
+print("true", matches(address:"ablak", pattern:"ab?ak"))
+
+print("true", matches(address:"ablak", pattern:"ab*"))
+print("true", matches(address:"ablak", pattern:"ab*k"))
+
+print("true", matches(address:"ablak", pattern:"a{blak}"))
+print("true", matches(address:"ablak", pattern:"a{blak,jto}"))

            }

            return false
            
//            break
        case "?":
            if si < address.endIndex {
                break
            }
 
            return false
            
//            break
        /*
         * set specification is inclusive, that is [a-z] is a, z and
         * everything in between. this means [z-a] may be interpreted

                        }
                    }
                } else if char == "}" {
                    // print("#2 choice: char = \(char)")

                    // continue normal pattern matching
                    if pi == pattern.endIndex && si == address.endIndex {
                        return true
                    }

                    si = address.index(before: si) // str is incremented again below
                } else if char == address[si] {
                    // print("#3 choice: \(char) == \(address[si])")
                    si = address.index(after: si)
                    if si == address.endIndex && remainder < pattern.endIndex {
                        print("ERROR: address == EOF, pattern != EOF")
                        return false
                    }
                } else { // skip to next comma
                    // print("#4 choice: char = \(char)")

                    // reset string position
                    si = place

                    while pi < pattern.endIndex && pattern[pi] != "," && pattern[pi] != "}" {
                        pi = pattern.index(after: pi)
                    }
                    
                    if pi == pattern.endIndex {
                        print("ERR: UNBALANCED CHOICE")
                        return false
                    }

                    if pattern[pi] == "," {
                        pi = pattern.index(after: pi)
                    } else if pattern[pi] == "}" {
                        return false
                    }
                }

                // --- end of inner switch ---
                char = pattern[pi]
                if pi < pattern.endIndex {
                    pi = pattern.index(after:pi)
                }
            }
        default:
            if char != address[si] {
                return false
            }
        }

        // --- end of outer switch ---
        
        if si < address.endIndex {
            si = address.index(after:si)
        }
        
    }
    
