Conditional ensures that the present of First ensures the present of Second.
| 11 | |
| 12 | // Conditional ensures that the present of First ensures the present of Second. |
| 13 | type Conditional struct { |
| 14 | Definition `mapstructure:",squash"` |
| 15 | Exceptions []string |
| 16 | patterns []*regexp2.Regexp |
| 17 | First string |
| 18 | Second string |
| 19 | exceptRe *regexp2.Regexp |
| 20 | phraseRe *regexp2.Regexp |
| 21 | Ignorecase bool |
| 22 | Vocab bool |
| 23 | |
| 24 | // secondHasGroup records whether `Second` has a capture group. When it |
| 25 | // does, a `First` match is allowed only if its value was captured by a |
| 26 | // `Second` match (e.g. an acronym defined as `... (WHO)`). When it doesn't, |
| 27 | // the rule is a plain presence check: any `First` requires `Second` to |
| 28 | // appear somewhere in the same block. See #1048. |
| 29 | secondHasGroup bool |
| 30 | } |
| 31 | |
| 32 | // hasCaptureGroup reports whether `pattern` contains a capturing group -- an |
| 33 | // unescaped `(` that doesn't begin a non-capturing/extension group `(?...)`. |
nothing calls this directly
no outgoing calls
no test coverage detected