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

Function parseString

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

Source from the content-addressed store, hash-verified

10}
11
12func 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.
29func StringInsensitive(s string) Function {

Callers 1

StringFunction · 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