code: func (c *Compiler) GetRulesWithPrefix(ref Ref) (rules []*Rule) {
  
  	node := c.RuleTree
  
  	for _, x := range ref {
  		if node = node.Child(x.Value); node == nil {
  			return nil
  		}
  	}
  
  	var acc func(node *TreeNode)
  
  	acc = func(node *TreeNode) {
  		rules = append(rules, extractRules(node.Values)...)
  		for _, child := range node.Children {
  			if child.Hide {
  				continue
  			}
  			acc(child)
  		}
  	}
  
  	acc(node)
  
  	return rules
  }
docs: // GetRulesWithPrefix returns a slice of rules that share the prefix ref.
  //
  // E.g., given the following module:
  //
  //  package a.b.c
  //
  //  p[x] = y { ... }  # rule1
  //  p[k] = v { ... }  # rule2
  //  q { ... }         # rule3
  //
  // The following calls yield the rules on the right.
  //
  //  GetRulesWithPrefix("data.a.b.c.p")   => [rule1, rule2]
  //  GetRulesWithPrefix("data.a.b.c.p.a") => nil
  //  GetRulesWithPrefix("data.a.b.c")     => [rule1, rule2, rule3]