Changed \Z to \z to fit with Go's naming

master
Aadhavan Srinivasan 3 days ago
parent ee51e39d59
commit 7431b1a7b2

@ -880,7 +880,7 @@ func thompson(re []postfixNode) (Reg, error) {
stateToAdd.assert = nonwboundAssert
case 'A':
stateToAdd.assert = soiAssert
case 'Z':
case 'z':
stateToAdd.assert = eoiAssert
}
} else { // Lookaround

@ -98,7 +98,7 @@ func newEscapedNode(c rune, inCharClass bool) (postfixNode, error) {
if c == 'B' && inCharClass { // Invalid
return postfixNode{}, fmt.Errorf("word boundaries are not allowed in character class")
}
case 'A', 'Z': // A is start of input, Z is end of input (regardless of RE_MULTILINE)
case 'A', 'z': // A is start of input, z is end of input (regardless of RE_MULTILINE)
if inCharClass {
return postfixNode{}, fmt.Errorf("input boundaries are not allowed in character class")
} else {

@ -446,8 +446,8 @@ var reTests = []struct {
{`\A`, []ReFlag{RE_MULTILINE}, "jkl\n123abc\nxyz", []Group{{0, 0}}},
{`$`, nil, "jkl\n123abc\nxyz", []Group{{14, 14}}},
{`$`, []ReFlag{RE_MULTILINE}, "jkl\n123abc\nxyz", []Group{{3, 3}, {10, 10}, {14, 14}}},
{`\Z`, []ReFlag{RE_MULTILINE}, "jkl\n123abc\nxyz", []Group{{14, 14}}},
{`^abc\Z`, []ReFlag{RE_MULTILINE}, "abc\nabc\nabc", []Group{{8, 11}}},
{`\z`, []ReFlag{RE_MULTILINE}, "jkl\n123abc\nxyz", []Group{{14, 14}}},
{`^abc\z`, []ReFlag{RE_MULTILINE}, "abc\nabc\nabc", []Group{{8, 11}}},
{`a.b`, nil, "a\nb", []Group{}},
{`a.b`, []ReFlag{RE_SINGLE_LINE}, "a\nb", []Group{{0, 3}}},

Loading…
Cancel
Save