Subroutine to determine the kind of Matcher to create and create it.
976316
private static ContentMatcher createMatcher(
    SimpleTest test,
    ContentMatcher oldMatcher)
  {
    if (tc.isEntryEnabled())
      tc.entry(
        cclass,
        "createMatcher",
        "test: " + test + ", oldmatcher: " + oldMatcher);
    Identifier id = test.getIdentifier();
    boolean isExtended = (test instanceof ExtendedSimpleTestImpl);
    ContentMatcher ans;
    switch (id.getType())
    {
      case Selector.BOOLEAN :
        if(!isExtended)
        {
          if (tc.isDebugEnabled())
            tc.debug(
              cclass,
              "createMatcher",
              "New BooleanMatcher for id " + id.getName());
          ans = new BooleanMatcher(id);
        }
        else
        {
          if (tc.isDebugEnabled())
            tc.debug(
              cclass,
              "createMatcher",
              "New SetValBooleanMatcher for id " + id.getName());
          ans = new SetValBooleanMatcher(id);          
        }
        break;
      case Selector.UNKNOWN :
      case Selector.OBJECT :
        if (tc.isDebugEnabled())
          tc.debug(
            cclass,
            "createMatcher",
            "New EqualityMatcher for id " + id.getName());
        ans = new EqualityMatcher(id);
        break;
      case Selector.STRING :
      case Selector.TOPIC :
        if(!isExtended)
        {        
          if (tc.isDebugEnabled())
            tc.debug(
              cclass,
              "createMatcher",
              "New StringMatcher for id " + id.getName());
          ans = new StringMatcher(id);
        }
        else
        {
          if (tc.isDebugEnabled())
            tc.debug(
              cclass,
              "createMatcher",
              "New SetValStringMatcher for id " + id.getName());
          ans = new SetValStringMatcher(id);          
        }          
        break;
      case Selector.CHILD :
        if (tc.isDebugEnabled())
          tc.debug(
            cclass,
            "createMatcher",
            "New ExtensionMatcher for id " + id.getName());
        ans = new SetValChildAccessMatcher(id);
        break;        
      default :
        if(!isExtended)
        {             
          if (tc.isDebugEnabled())
            tc.debug(
              cclass,
              "createMatcher",
              "New NumericMatcher for id " + id.getName());
          ans = new NumericMatcher(id);
        }
        else
        {
          if (tc.isDebugEnabled())
            tc.debug(
              cclass,
              "createMatcher",
              "New SetValNumericMatcher for id " + id.getName());
          ans = new SetValNumericMatcher(id);          
        }
    }
    
    ans.vacantChild = oldMatcher;

    if (tc.isEntryEnabled())
      tc.exit(cclass, "createMatcher");
    return ans;
  }
369653
def createMatcher(cls, *args, **kwargs):
        '''
        
        '''
        if kwargs and not args:
            return EventMatcher(tuple(getattr(cls, ind) if ind[:10] == '_classname' else kwargs.get(ind) for ind in cls.indicesNames()), kwargs.get('_ismatch'))
        else:
            return EventMatcher(tuple(cls._generateIndices(args)), kwargs.get('_ismatch'))
682080
def typeOf(cls, expected_type): #pylint: disable=no-self-argument,invalid-name,no-self-use
        
        if isinstance(expected_type, type):
            options = {}
            options["target_type"] = expected_type
            return Matcher("__TYPE__", options)
        ErrorHandler.matcher_type_error(expected_type)
342942
def _namematcher(regex):
    """"""

    matcher = re_compile(regex)

    def match(target):
        target_name = getattr(target, '__name__', '')
        result = matcher.match(target_name)
        return result

    return match
266956
static Matcher sequenceWithStuffAfterEndIsFalse(Matcher matcher) {
    if (matcher instanceof SeqMatcher) {
      boolean end = false;
      for (Matcher m : matcher.<SeqMatcher>as().matchers()) {
        if (m instanceof EndMatcher) {
          end = true;
        } else if (end && !m.alwaysMatches()) {
          return FalseMatcher.INSTANCE;
        }
      }
    }
    return matcher;
  }
304405
public static <S, T> DecomposableMatchBuilder1<S, T> typeOf(Class<T> clazz) {
    List<Matcher<Object>> matchers = new ArrayList<>();
    matchers.add(any()); // The extractor takes care of the matching

    return new DecomposableMatchBuilder1<>(matchers, 0, new TypeOfFieldExtractor<>(clazz));
  }
775716
def satisfy_custom_matcher(self, args, kwargs):
        
        if not self._custom_matcher:
            return False
        try:
            return self._custom_matcher(*args, **kwargs)
        except Exception:
            return False
759565
def match_type(mtype, patterns):
    ''''''
    for p in patterns:
        if fnmatch.fnmatch(mtype, p):
            return True
    return False
222519
public static <T extends Tree> Matcher<T> isTransient() {
    return new Matcher<T>() {
      @Override
      public boolean matches(Tree tree, VisitorState state) {
        Symbol sym = ASTHelpers.getSymbol(tree);
        // NOTE(yorick): there is no isTransient() on Symbol. This is what it would be.
        return sym.getModifiers().contains(Modifier.TRANSIENT);
      }
    };
  }
217679
private function buildMatcher()
    {
        $this->matchers = [];
        foreach ($this->option as $key => $value) {
            $this->matchers[$key] = $this->buildOneMatcher($key, $value);
        }
    }
134466
function( elem, context, xml ) {
			while ( (elem = elem[ dir ]) ) {
				if ( checkNonElements || elem.nodeType === 1  ) {
					return matcher( elem, context, xml );
				}
			}
		}
928805
def setup_regex(self):
        """"""
        self._RX_CONTAINS = r"^\s*contains[^\n]*?$"
        self.RE_CONTAINS = re.compile(self._RX_CONTAINS, re.M | re.I)

        #Setup a regex that can extract information about both functions and subroutines
        self._RX_EXEC = r"\n[ \t]*((?P<type>character|real|type|logical|integer|complex)?" + \
                        r"(?P<kind>\([a-z0-9_]+\))?)?((?P<modifiers>[\w, \t]+?))?[ \t]*" + \
                        r"(?P<codetype>subroutine|function)\s+(?P<name>[^(]+)" + \
                        r"\s*\((?P<parameters>[^)]*)\)(?P<result>\sresult\([a-z0-9_]+\))?" + \
                        r"(?P<contents>.+?)end\s*(?P=codetype)\s+(?P=name)"
        self.RE_EXEC = re.compile(self._RX_EXEC, re.DOTALL | re.I)
        #Regex for the signature is almost identical to the full executable, but it doesn't
        #look for any contents after the parameter list.
        self._RX_SIG =  r"((?P<type>character|real|type|logical|integer|complex)?" + \
                        r"(?P<kind>\([a-z0-9_]+\))?)?(,?(?P<modifiers>[^\n]+?))?\s*" + \
                        r"(?P<codetype>subroutine|function)\s+(?P<name>[^(]+)" + \
                        r"\s*\((?P<parameters>[^)]*)\)"
        self.RE_SIG = re.compile(self._RX_SIG, re.I)

        #The contents of the executable already have any & line continuations
        #removed, so we can use a simple multiline regex.
        self._RX_ASSIGN = r"^(?P<assignee>[^!<=\n/]+?)=[^\n]+?$"
        self.RE_ASSIGN = re.compile(self._RX_ASSIGN, re.M)

        self._RX_DEPEND = r"^\s*(?P<sub>call\s+)?(?P<exec>[a-z0-9_%]+\s*\([^\n]+)$"
        self.RE_DEPEND = re.compile(self._RX_DEPEND, re.M | re. I)

        self._RX_DEPCLEAN = r"(?P<key>[a-z0-9_%]+)\("
        self.RE_DEPCLEAN = re.compile(self._RX_DEPCLEAN, re.I)

        self._RX_CONST = '[^"\']+(?P<const>["\'][^\'"]+["\'])'
        self.RE_CONST = re.compile(self._RX_CONST)

        self._RX_COMMENTS = r'\s*![^\n"]+?\n'
        self.RE_COMMENTS = re.compile(self._RX_COMMENTS)
5646
function Matcher(matchFunc, toString) {
    this.match = function(expression) {
        // Save/restore marks to ensure that failed matches always restore
        // the original location in the expression.
        var result;
        expression.mark();
        result = matchFunc(expression);
        if (result) {
            expression.drop();
        } else {
            expression.restore();
        }
        return result;
    };
    this.toString = typeof toString === "function" ? toString : function() {
        return toString;
    };
}
595750
static Matcher zeroOrMoreFalse(Matcher matcher) {
    if (matcher instanceof ZeroOrMoreMatcher) {
      ZeroOrMoreMatcher zm = matcher.as();
      if (zm.repeated() instanceof FalseMatcher || zm.next() instanceof FalseMatcher) {
        return zm.next();
      }
    }
    return matcher;
  }
512275
static Matcher flattenNestedOr(Matcher matcher) {
    if (matcher instanceof OrMatcher) {
      List<Matcher> matchers = matcher.<OrMatcher>as().matchers();
      List<Matcher> ms = new ArrayList<>();
      for (Matcher m : matchers) {
        if (m instanceof OrMatcher) {
          ms.addAll(m.<OrMatcher>as().matchers());
        } else {
          ms.add(m);
        }
      }
      return OrMatcher.create(ms);
    }
    return matcher;
  }
454213
static Matcher create(Matcher... matchers) {
    switch (matchers.length) {
      case 0:  return TrueMatcher.INSTANCE;
      case 1:  return matchers[0];
      default: return new OrMatcher(matchers);
    }
  }
334500
def setup_regex(self):
        """"""
        #Regex for matching the entire body of the type and getting top-level modifiers.
        self._RX_TYPE = r"\n\s*type(?P<modifiers>,\s+(public|private))?(\s*::)?\s+(?P<name>[A-Za-z0-9_]+)" + \
                        r"(?P<contents>.+?)end\s*type(\s+(?P=name))?"
        self.RE_TYPE = re.compile(self._RX_TYPE, re.DOTALL | re.I)
        #This regex is the same as RE_TYPE, only the contents are removed from the definition.
        self._RX_SIG =  r"type(?P<modifiers>,\s+(public|private))?(\s+::)?\s+(?P<name>[A-Za-z0-9_]+)"
        self.RE_SIG = re.compile(self._RX_SIG, re.I)

        #Regex for finding if the type is private
        self._RX_PRIV = "private.+?(contains)?"
        self.RE_PRIV = re.compile(self._RX_PRIV, re.DOTALL | re.I)
        #Regex for finding methods buried in a type declaration.
        self._RX_EXEC = r"^\s*(?P<modifiers>[^:]+)\s+::\s+(?P<name>[A-Za-z0-9_]+)" + \
                        r"(\s+=>\s+(?P<points>[A-Za-z0-9_]+))?$"
        self.RE_EXEC = re.compile(self._RX_EXEC, re.M | re.I)
        #Regex for getting text after contains statement
        self._RX_CONTAINS = "\n\s*contains(?P<remainder>.+)"
        self.RE_CONTAINS = re.compile(self._RX_CONTAINS, re.DOTALL | re.I)