SYS-REQ-045 Tries to find the end of string Support if string contains escaped quote symbols.
(data []byte)
| 168 | // Tries to find the end of string |
| 169 | // Support if string contains escaped quote symbols. |
| 170 | func stringEnd(data []byte) (int, bool) { |
| 171 | escaped := false |
| 172 | for i, c := range data { |
| 173 | if c == '"' { |
| 174 | if !escaped { |
| 175 | return i + 1, false |
| 176 | } else { |
| 177 | j := i - 1 |
| 178 | for { |
| 179 | if j < 0 || data[j] != '\\' { |
| 180 | return i + 1, true // even number of backslashes |
| 181 | } |
| 182 | j-- |
| 183 | if j < 0 || data[j] != '\\' { |
| 184 | break // odd number of backslashes |
| 185 | } |
| 186 | j-- |
| 187 | |
| 188 | } |
| 189 | } |
| 190 | } else if c == '\\' { |
| 191 | escaped = true |
| 192 | } |
| 193 | } |
| 194 | |
| 195 | return -1, escaped |
| 196 | } |
| 197 | |
| 198 | // SYS-REQ-046 |
| 199 | // Find end of the data structure, array or object. |
no outgoing calls
searching dependent graphs…