aboutsummaryrefslogtreecommitdiff
path: root/internal/cond/types.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/cond/types.go')
-rw-r--r--internal/cond/types.go12
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{