MCPcopy Create free account
hub / github.com/a-h/lexical / parseStringInsensitive

Function parseStringInsensitive

parse/string.go:35–49  ·  view source on GitHub ↗
(pi Input, s string)

Source from the content-addressed store, hash-verified

33}
34
35func parseStringInsensitive(pi Input, s string) Result {
36 name := "stringinsensitive: '" + s + "'"
37
38 advancedBy := 0
39 for _, sr := range s {
40 pr, err := pi.Peek()
41 if !strings.EqualFold(string(pr), string(sr)) {
42 rewind(pi, advancedBy)
43 return Failure(name, err)
44 }
45 pi.Advance()
46 advancedBy++
47 }
48 return Success(name, s, nil)
49}
50
51func rewind(pi Input, times int) (err error) {
52 for i := 0; i < times; i++ {

Callers 1

StringInsensitiveFunction · 0.85

Calls 5

rewindFunction · 0.85
FailureFunction · 0.85
SuccessFunction · 0.85
PeekMethod · 0.65
AdvanceMethod · 0.65

Tested by

no test coverage detected