docs: def _MatchDirective(token):
      """Helper function for matching certain directives."""
      # Tokens below must start with '.'
      if token.startswith('.'):
          token = token[1:]
      else:
          return None, None
      
      if token == 'end':
          return END_TOKEN, None
      
      if token == 'alternates with':
          return ALTERNATES_TOKEN, token
      
      if token.startswith('or'):
          if token.strip() == 'or':
              return OR_TOKEN, None
          else:
              pred_str = token[2:].strip()
              return OR_TOKEN, pred_str
      
      match = _SECTION_RE.match(token)
      if match:
          repeated, section_name = match.groups()
          if repeated:
              return REPEATED_SECTION_TOKEN, section_name
          else:
              return SECTION_TOKEN, section_name
      
      if token.startswith('template '):
          return SUBST_TEMPLATE_TOKEN, token[9:].strip()
      if token.startswith('define '):
          return DEF_TOKEN, token[7:].strip()
      
      if token.startswith('if '):
          return IF_TOKEN, token[3:].strip()
      if token.endswith('?'):
          return PREDICATE_TOKEN, token
      
      return None, None