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