code: def _expose_rule_functions(self, expose_all_rules=False):
          
  
          def make_parse_rule_function(rule_name):
              "builds a wrapper function that parses a string with the specified rule"
  
              def rule_fxn(s):
                  try:
                      return self._grammar(s).__getattr__(rule_name)()
                  except ometa.runtime.ParseError as exc:
                      raise HGVSParseError("{s}: char {exc.position}: {reason}".format(
                          s=s, exc=exc, reason=exc.formatReason()))
  
              rule_fxn.__doc__ = "parse string s using `%s' rule" % rule_name
              return rule_fxn
  
          exposed_rule_re = re.compile(r"hgvs_(variant|position)|(c|g|m|n|p|r)"
                                       r"_(edit|hgvs_position|interval|pos|posedit|variant)")
          exposed_rules = [
              m.replace("rule_", "") for m in dir(self._grammar._grammarClass)
              if m.startswith("rule_")
          ]
          if not expose_all_rules:
              exposed_rules = [
                  rule_name for rule_name in exposed_rules if exposed_rule_re.match(rule_name)
              ]
          for rule_name in exposed_rules:
              att_name = "parse_" + rule_name
              rule_fxn = make_parse_rule_function(rule_name)
              self.__setattr__(att_name, rule_fxn)
          self._logger.debug("Exposed {n} rules ({rules})".format(
              n=len(exposed_rules), rules=", ".join(exposed_rules)))
docs: add parse functions for public grammar rules
  
          Defines a function for each public grammar rule, based on
          introspecting the grammar. For example, the `c_interval` rule
          is exposed as a method `parse_c_interval` and used like this::
  
            Parser.parse_c_interval('26+2_57-3') -> Interval(...)