@@ -101,13 +101,13 @@ struct PkgConfigParser {
101101 guard let line = uncommentedLine. chuzzle ( ) else { continue }
102102
103103 if let colonIndex = line. characters. index ( of: " : " ) where
104- line. endIndex == line. characters. location ( after: colonIndex) || line [ line. characters. location ( after: colonIndex) ] == " " {
104+ line. endIndex == line. characters. index ( after: colonIndex) || line [ line. characters. index ( after: colonIndex) ] == " " {
105105 // Found a key-value pair.
106106 try parseKeyValue ( line: line)
107107 } else if let equalsIndex = line. characters. index ( of: " = " ) {
108108 // Found a variable.
109109 let name = line [ line. startIndex..< equalsIndex]
110- let value = line [ line. location ( after: equalsIndex) ..< line. endIndex]
110+ let value = line [ line. index ( after: equalsIndex) ..< line. endIndex]
111111 variables [ name] = try resolveVariables ( value)
112112 } else {
113113 // unexpected thing in the pc file, abort.
@@ -136,7 +136,7 @@ struct PkgConfigParser {
136136 // Look at a char at an index if present.
137137 func peek( idx: Int ) -> Character ? {
138138 guard idx <= depString. characters. count - 1 else { return nil }
139- return depString. characters [ depString. characters. location ( depString. characters. startIndex, offsetBy: idx) ]
139+ return depString. characters [ depString. characters. index ( depString. characters. startIndex, offsetBy: idx) ]
140140 }
141141
142142 // This converts the string which can be seperated by comma or spaces
@@ -189,9 +189,9 @@ struct PkgConfigParser {
189189 // We make sure it of form ${name} otherwise it is not a variable.
190190 func findVariable( _ fragment: String ) -> ( name: String , startIndex: StringIndex , endIndex: StringIndex ) ? {
191191 guard let dollar = fragment. characters. index ( of: " $ " ) else { return nil }
192- guard dollar != fragment. endIndex && fragment. characters [ fragment. location ( after: dollar) ] == " { " else { return nil }
192+ guard dollar != fragment. endIndex && fragment. characters [ fragment. index ( after: dollar) ] == " { " else { return nil }
193193 guard let variableEndIndex = fragment. characters. index ( of: " } " ) else { return nil }
194- return ( fragment [ fragment. location ( dollar, offsetBy: 2 ) ..< variableEndIndex] , dollar, variableEndIndex)
194+ return ( fragment [ fragment. index ( dollar, offsetBy: 2 ) ..< variableEndIndex] , dollar, variableEndIndex)
195195 }
196196
197197 var result = " "
@@ -207,7 +207,7 @@ struct PkgConfigParser {
207207 // Append the value of the variable.
208208 result += variableValue
209209 // Update the fragment with post variable string.
210- fragment = fragment [ fragment. location ( after: variable. endIndex) ..< fragment. characters. endIndex]
210+ fragment = fragment [ fragment. index ( after: variable. endIndex) ..< fragment. characters. endIndex]
211211 } else {
212212 // No variable found, just append rest of the fragment to result.
213213 result += fragment
@@ -221,6 +221,6 @@ struct PkgConfigParser {
221221 guard let colonIndex = line. characters. index ( of: " : " ) else {
222222 return " "
223223 }
224- return line [ line. location ( colonIndex, offsetBy: 2 ) ..< line. endIndex]
224+ return line [ line. index ( colonIndex, offsetBy: 2 ) ..< line. endIndex]
225225 }
226226}
0 commit comments