@example _Optional_ definition with isolation
   it { 'foo'.bar }.MAY! match /^foo$/

 @see MAY
329683
def MAY!(m)
      RequirementLevel::Low.new(m, false, subject, *challenges).result(true)
    end
799466
def match(other)
      other = other.type if other.instance_of? AnnotatedArgType
      return true if other.instance_of? WildQuery
      return false unless other.instance_of? MethodType
      return false unless @ret.match(other.ret)
      if @block == nil
        return false unless other.block == nil
      else
        return false if other.block == nil
        return false unless @block.match(other.block)
      end
      # Check arg matches; logic is similar to pre_cond
      states = [[0,0]] # [position in self, position in other]
      until states.empty?
        s_arg, o_arg = states.pop
        return true if s_arg == @args.size && o_arg == other.args.size # everything matches
        next if s_arg >= @args.size # match not possible, not enough args in self
        if @args[s_arg].instance_of? DotsQuery then
          if o_arg == other.args.size
            # no args left in other, skip ...
            states << [s_arg+1, o_arg]
          else
            states << [s_arg+1, o_arg+1] # match, no more matches to ...
            states << [s_arg, o_arg+1]   # match, more matches to ... coming
          end
        else
          next if o_arg == other.args.size # match not possible, not enough args in other
          s_arg_t = @args[s_arg]
          s_arg_t = s_arg_t.type if s_arg_t.instance_of? AnnotatedArgType
          o_arg_t = other.args[o_arg]
          o_arg_t = o_arg_t.type if o_arg_t.instance_of? AnnotatedArgType
          next unless s_arg_t.match(o_arg_t)
          states << [s_arg+1, o_arg+1]
        end
      end
      return false
    end
1062838
function maybeModifier (predicate) {
    var modifiedPredicate = function () {
      if (not.assigned(arguments[0])) {
        return true;
      }

      return predicate.apply(null, arguments);
    };
    modifiedPredicate.l = predicate.length;

    // Hackishly indicate that this is a maybe.xxx predicate.
    // Without this flag, the alternative would be to iterate
    // through the maybe predicates or use indexOf to check,
    // which would be time-consuming.
    modifiedPredicate.m = true;

    return modifiedPredicate;
  }
1138435
public <U extends T, A, B> OngoingMatchingC2<T, U, A, B> when(
      DecomposableMatchBuilder2<U, A, B> decomposableMatchBuilder) {
    return new OngoingMatchingC2<>(this, decomposableMatchBuilder.build());
  }
1128449
public <U extends T, A> OngoingMatchingR1<T, U, A, R> when(
      DecomposableMatchBuilder1<U, A> decomposableMatchBuilder) {
    return new OngoingMatchingR1<>(this, decomposableMatchBuilder.build());
  }
834458
function at_type() {
  match(/@type/);
  add_tag("type");
  skip_horiz_white();
  if (look(/\{/)) {
    var tdf = typedef();
    current_tag["type"] = tdf["type"];
    current_tag["optional"] = tdf["optional"] ? true : false;
  }
  else if (look(/\S/)) {
    current_tag["type"] = match(/\S+/);
  }
  skip_white();
}
670588
def _pv_regex(opts, key, regex)
        value = _pv_opts_lookup(opts, key)
        if value != nil
          passes = false
          [ regex ].flatten.each do |r|
            if value != nil
              if r.match(value.to_s)
                passes = true
              end
            end
          end
          unless passes
            raise ValidationFailed, "Option #{key}'s value #{value} does not match regular expression #{regex.inspect}"
          end
        end
      end
727723
def matches?(*rules)
      rules.flatten!
      match   = self.local.matches?(rules)
      match ||= self.host.matches?(rules)
      return match if match

      # Does "root@*.com" match "root@example.com" domain name
      rules.each do |r|
        if r =~ /.+@.+/
          return r if File.fnmatch?(r, self.to_s)
        end
      end
      false
    end
215640
public static <A> Maybe<A> fromOptional(Optional<? extends A> optional) {
        return optional.map(Maybe::<A>just).orElse(Maybe.nothing());
    }
908977
def match?(rules)
      flat_hash(rules).keys.all? do |multi_keys|
        if multi_keys.last == :any
          actual_values = actual_value(self, multi_keys[0...-1])
          expected = expected_value(rules, multi_keys)
          actual_values.any? { |actual| match_value?(actual, expected) }
        elsif multi_keys.last == :not
          actual = actual_value(self, multi_keys[0...-1])
          expected = expected_value(rules, multi_keys)
          !match_value?(actual, expected)
        else
          actual = actual_value(self, multi_keys)
          expected = expected_value(rules, multi_keys)
          match_value?(actual, expected)
        end
      end
    end
805672
private boolean isDependent(String style) {
		if (!style.trim().startsWith("<")) {
			return false;
		}
		Pattern p = Pattern.compile("rel\\s*=\\s*\"\\s*independent-parent\\s*\"");
		Matcher m = p.matcher(style);
		return m.find();
	}
896966
def matches?(*rules)
      rules.flatten.each do |r|
        if r =~ /(.+)@\z/
          return r if File.fnmatch?($1, self.local)
        end
      end
      false
    end
726717
function defineMatcher(name, fn) {
    Expectation.prototype[name] =
        function () {
            let expectation = this;
            expectation.specification.description.log_(name);
            return fn.apply(expectation, arguments);
        };
    fn.toString = function () {
        return name;
    };
}
1228615
def maybe(cls, parts, quotes=None, type=String, **kwargs):
        
        if len(parts) > 1:
            return cls(parts, quotes=quotes, type=type, **kwargs)

        if quotes is None and type is String:
            return Literal.from_bareword(parts[0])

        return Literal(type(parts[0], quotes=quotes, **kwargs))
1194253
def match?
      match = false
      @instance.current_node.recursive_children do |child_node|
        match = match || (child_node && child_node.match?(@rules))
      end
      !match
    end
4134
def expect_optional_token(lexer: Lexer, kind: TokenKind) -> Optional[Token]:
    
    token = lexer.token
    if token.kind == kind:
        lexer.advance()
        return token

    return None
1347149
function matchImmediate(el, match) {
        var matched = 1, startEl = el, relativeOp, startMatch = match;
        do {
            matched &= singleMatch(el, match);
            if (matched) {
                // advance
                match = match && match.prev;
                if (!match) {
                    return true;
                }
                relativeOp = relativeExpr[match.nextCombinator];
                el = dir(el, relativeOp.dir);
                if (!relativeOp.immediate) {
                    return {
                        // advance for non-immediate
                        el: el,
                        match: match
                    };
                }
            } else {
                relativeOp = relativeExpr[match.nextCombinator];
                if (relativeOp.immediate) {
                    // retreat but advance startEl
                    return {
                        el: dir(startEl, relativeExpr[startMatch.nextCombinator].dir),
                        match: startMatch
                    };
                } else {
                    // advance (before immediate match + jump unmatched)
                    return {
                        el: el && dir(el, relativeOp.dir),
                        match: match
                    };
                }
            }
        } while (el);    // only occur when match immediate
        // only occur when match immediate
        return {
            el: dir(startEl, relativeExpr[startMatch.nextCombinator].dir),
            match: startMatch
        };
    }