MCPcopy Create free account
hub / github.com/cogentcore/core / Find

Method Find

parse/parser/rule.go:1696–1706  ·  view source on GitHub ↗

Non-parsing functions Find looks for rules in the tree that contain given string in Rule or Name fields

(find string)

Source from the content-addressed store, hash-verified

1694
1695// Find looks for rules in the tree that contain given string in Rule or Name fields
1696func (pr *Rule) Find(find string) []*Rule {
1697 var res []*Rule
1698 pr.WalkDown(func(k tree.Node) bool {
1699 pri := k.(*Rule)
1700 if strings.Contains(pri.Rule, find) || strings.Contains(pri.Name, find) {
1701 res = append(res, pri)
1702 }
1703 return true
1704 })
1705 return res
1706}
1707
1708// WriteGrammar outputs the parser rules as a formatted grammar in a BNF-like format
1709// it is called recursively

Callers

nothing calls this directly

Calls 2

WalkDownMethod · 0.80
ContainsMethod · 0.45

Tested by

no test coverage detected