()
| 945 | } |
| 946 | |
| 947 | func (p *parser) scanPythonNamedBackref() (*RegexNode, error) { |
| 948 | p.moveRight(3) |
| 949 | if p.charsRight() == 0 { |
| 950 | return nil, p.getErr(ErrMalformedNameRef) |
| 951 | } |
| 952 | |
| 953 | ch := p.rightChar(0) |
| 954 | if !p.isGroupNameStartChar(ch) { |
| 955 | return nil, p.getErr(ErrInvalidGroupName) |
| 956 | } |
| 957 | |
| 958 | capname, err := p.scanCapname() |
| 959 | if err != nil { |
| 960 | return nil, err |
| 961 | } |
| 962 | |
| 963 | if capname == "" || p.charsRight() == 0 || p.moveRightGetChar() != ')' { |
| 964 | return nil, p.getErr(ErrMalformedNameRef) |
| 965 | } |
| 966 | |
| 967 | if !p.isCaptureName(capname) { |
| 968 | return nil, p.getErr(ErrUndefinedNameRef, capname) |
| 969 | } |
| 970 | |
| 971 | return newRegexNodeM(NtRef, p.options, p.captureSlotFromName(capname)), nil |
| 972 | } |
| 973 | |
| 974 | // scanGroupOpen scans chars following a '(' (not counting the '('), and returns |
| 975 | // a RegexNode for the type of group scanned, or nil if the group |
no test coverage detected