@@ -77,5 +77,20 @@ return N{Matched: false, Content: "", Nodes: nil}, s } return N{Matched: true, Content: s[:count], Nodes: nil}, s[count:] } } + +// Returns a parser that accepts the specified string +func String(value string) P { + accept := Accept(len(value)) + return func(s string) (N, string) { + n, r := accept(s) + if !n.Matched { + return n, s + } + if n.Content == value { + return n, r + } + return N{Matched: false, Content: "", Nodes: []N{n}}, s + } +}