Changed \Z to \z to fit with Go's naming
This commit is contained in:
@@ -880,7 +880,7 @@ func thompson(re []postfixNode) (Reg, error) {
|
|||||||
stateToAdd.assert = nonwboundAssert
|
stateToAdd.assert = nonwboundAssert
|
||||||
case 'A':
|
case 'A':
|
||||||
stateToAdd.assert = soiAssert
|
stateToAdd.assert = soiAssert
|
||||||
case 'Z':
|
case 'z':
|
||||||
stateToAdd.assert = eoiAssert
|
stateToAdd.assert = eoiAssert
|
||||||
}
|
}
|
||||||
} else { // Lookaround
|
} else { // Lookaround
|
||||||
|
@@ -98,7 +98,7 @@ func newEscapedNode(c rune, inCharClass bool) (postfixNode, error) {
|
|||||||
if c == 'B' && inCharClass { // Invalid
|
if c == 'B' && inCharClass { // Invalid
|
||||||
return postfixNode{}, fmt.Errorf("word boundaries are not allowed in character class")
|
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 {
|
if inCharClass {
|
||||||
return postfixNode{}, fmt.Errorf("input boundaries are not allowed in character class")
|
return postfixNode{}, fmt.Errorf("input boundaries are not allowed in character class")
|
||||||
} else {
|
} else {
|
||||||
|
@@ -446,8 +446,8 @@ var reTests = []struct {
|
|||||||
{`\A`, []ReFlag{RE_MULTILINE}, "jkl\n123abc\nxyz", []Group{{0, 0}}},
|
{`\A`, []ReFlag{RE_MULTILINE}, "jkl\n123abc\nxyz", []Group{{0, 0}}},
|
||||||
{`$`, nil, "jkl\n123abc\nxyz", []Group{{14, 14}}},
|
{`$`, nil, "jkl\n123abc\nxyz", []Group{{14, 14}}},
|
||||||
{`$`, []ReFlag{RE_MULTILINE}, "jkl\n123abc\nxyz", []Group{{3, 3}, {10, 10}, {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}}},
|
{`\z`, []ReFlag{RE_MULTILINE}, "jkl\n123abc\nxyz", []Group{{14, 14}}},
|
||||||
{`^abc\Z`, []ReFlag{RE_MULTILINE}, "abc\nabc\nabc", []Group{{8, 11}}},
|
{`^abc\z`, []ReFlag{RE_MULTILINE}, "abc\nabc\nabc", []Group{{8, 11}}},
|
||||||
|
|
||||||
{`a.b`, nil, "a\nb", []Group{}},
|
{`a.b`, nil, "a\nb", []Group{}},
|
||||||
{`a.b`, []ReFlag{RE_SINGLE_LINE}, "a\nb", []Group{{0, 3}}},
|
{`a.b`, []ReFlag{RE_SINGLE_LINE}, "a\nb", []Group{{0, 3}}},
|
||||||
|
Reference in New Issue
Block a user