diff options
| author | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-09-12 12:58:14 +0200 |
|---|---|---|
| committer | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-09-12 12:58:14 +0200 |
| commit | 24a84671ace373ae331fa83a1ff484990f4dff0e (patch) | |
| tree | a6b6e3949d7dd241f1d13e079dfb982d758c89a2 /internal/cond/types.go | |
| parent | 3b36a48b7ce5a53a9366f3b31f94311f178e2553 (diff) | |
| download | krino-24a84671ace373ae331fa83a1ff484990f4dff0e.tar.gz krino-24a84671ace373ae331fa83a1ff484990f4dff0e.zip | |
krino: planning — chains, placeholders, conflicts, JSON
Diffstat (limited to 'internal/cond/types.go')
| -rw-r--r-- | internal/cond/types.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/internal/cond/types.go b/internal/cond/types.go index 81c2f45..9455f63 100644 --- a/internal/cond/types.go +++ b/internal/cond/types.go @@ -93,6 +93,18 @@ type node struct { dirs []string } +// NameGroups returns the number of capture groups of every name test in the +// condition that can ever supply captures, in compile order: a name test +// nested inside and/or counts however deep, but one inside a not does not +// (B1) - it can never be the source of Result.Captures, so it must not be +// asked to justify a rule's use of {N} either. Empty when the rule has no +// such name test. +func (c *Cond) NameGroups() []int { + var out []int + collectNameGroups(c.root, &out) + return out +} + // groups maps a (type ...) group name to the extensions it expands to, // spec Appendix A. var groups = map[string][]string{ |
