Diff

Differences From Artifact [b38eeb1414]:

To Artifact [6601f36901]:


75
76
77
78
79
80
81















75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96







+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
	return func(s string) (N, string) {
		if len(s) < count {
			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
	}
}