(pi Input, s string)
| 10 | } |
| 11 | |
| 12 | func parseString(pi Input, s string) Result { |
| 13 | name := "string: '" + s + "'" |
| 14 | |
| 15 | advancedBy := 0 |
| 16 | for _, sr := range s { |
| 17 | pr, err := pi.Peek() |
| 18 | if pr != sr { |
| 19 | rewind(pi, advancedBy) |
| 20 | return Failure(name, err) |
| 21 | } |
| 22 | pi.Advance() |
| 23 | advancedBy++ |
| 24 | } |
| 25 | return Success(name, s, nil) |
| 26 | } |
| 27 | |
| 28 | // StringInsensitive tests whether the string is present, but ignoring string casing. |
| 29 | func StringInsensitive(s string) Function { |