Starts constructing a {@link PatternProcessFunction} from a {@link PatternSelectFunction} that
emitted elements through return value.
165555
static <IN, OUT> SelectBuilder<IN, OUT> fromSelect(final PatternSelectFunction<IN, OUT> function) {
		return new SelectBuilder<>(function);
	}
369802
public static Pattern createPattern(final String pattern, final int flags) {
        if (pattern == null) {
            LOGGER.debug("Pattern cannot be null");
            return MATCH_NOTHING_PATTERN;
        }
        try {
            return Pattern.compile(pattern, flags);
        } catch (final PatternSyntaxException exception) {
            LOGGER.debug("Pattern [{}] is not a valid regex.", pattern);
            return MATCH_NOTHING_PATTERN;
        }
    }
658099
Node createThisForFunction(Node functionNode) {
    final Node result = IR.thisNode();
    if (isAddingTypes()) {
      result.setJSType(getTypeOfThisForFunctionNode(functionNode));
    }
    return result;
  }
547498
@Nonnull
	public DataBuilder appendOperatingSystemPattern(@Nonnull final OperatingSystemPattern pattern) {
		Check.notNull(pattern, "pattern");

		if (!operatingSystemPatterns.containsKey(pattern.getId())) {
			operatingSystemPatterns.put(pattern.getId(), new TreeSet<OperatingSystemPattern>(OS_PATTERN_COMPARATOR));
		}

		operatingSystemPatterns.get(pattern.getId()).add(pattern);
		return this;
	}
1261580
private void processFunction(final Expression expression, final FunctionDescriptor od, RulesTextProvider textProvider) throws ParserException
	{
    	log.debug("processFunction");
		if (!exact("(",textProvider))
			throw new ParserException("Expected ')' after '"+od.getName()+"': ",textProvider);
		Class<?> args[] = od.getParameterTypes();
		for (int arg=1;arg <= args.length;arg++)
		{
			if (args[arg-1].equals(Expression.class))
			{
				Expression e = processExpression(textProvider);
				expression.expression(e);
			}
			if (args[arg-1].equals(List.class))
			{	
				if (!xpath(textProvider))
					throw new ParserException("expected list operand: ",textProvider);
				// operand string found
				String operand = textProvider.getLastToken();
				if (!textProvider.findOperandInScope(operand))
				{
					throw new ParserException("Could not locate "+operand+" in scope",textProvider);
				}
				expression.list(textProvider.getLastToken(),textProvider.getLastResolvedField());
			}
			else
			{
	             Expression e = processExpression(textProvider);
	             expression.expression(e);
			}
			if (arg < args.length)
			{
				// ensure arguments are separated by a comma
			    exactOrError(",",textProvider);
			}
		}
		exactOrError(")",textProvider);
		expression.function(od);
	}
1354334
public PatternMatcher execute() throws DataflowAnalysisException {
        workList.addLast(cfg.getEntry());

        while (!workList.isEmpty()) {
            BasicBlock basicBlock = workList.removeLast();
            visitedBlockMap.put(basicBlock, basicBlock);

            // Scan instructions of basic block for possible matches
            BasicBlock.InstructionIterator i = basicBlock.instructionIterator();
            while (i.hasNext()) {
                attemptMatch(basicBlock, i.duplicate());
                i.next();
            }

            // Add successors of the basic block (which haven't been visited
            // already)
            Iterator<BasicBlock> succIterator = cfg.successorIterator(basicBlock);
            while (succIterator.hasNext()) {
                BasicBlock succ = succIterator.next();
                if (visitedBlockMap.get(succ) == null) {
                    workList.addLast(succ);
                }
            }
        }

        return this;
    }
996462
public static WildcardPatternMatcher compile(String patterns) {
		if(patterns == null || patterns.isEmpty()) {
			return matchNone;
		} else {
			List<String> list = StringUtility.splitStringCommaSpace(patterns);
			// Match none shortcut
			if(list.isEmpty()) return matchNone;

			// Parse into a series of individual matchers
			final List<WildcardPatternMatcher> matchers = new ArrayList<>(list.size());
			for(String pattern : list) {
				int end = pattern.length();
				if(end > 0) {
					// Beginning wildcards
					int pos = 0;
					final boolean startsWildcard;
					if(pattern.charAt(0) == '*') {
						startsWildcard = true;
						pos++;
						// Skip consecutive beginning
						while(pos < end && pattern.charAt(pos) == '*') pos++;
						if(pos >= end) {
							// Is any number of '*' only, matchAll shortcut
							return matchAll;
						}
					} else {
						startsWildcard = false;
					}
					// Ending wildcards
					final boolean endsWildcard;
					if(pattern.charAt(end - 1) == '*') {
						endsWildcard = true;
						end--;
						// Skip consecutive ending
						while(end > pos && pattern.charAt(end - 1) == '*') end--;
						assert end > pos;
					} else {
						endsWildcard = false;
					}
					// Split the remaining pattern on any internal '*'
					final List<String> sequences = new ArrayList<>();
					while(pos < end) {
						assert pattern.charAt(pos) != '*';
						int starPos = pattern.indexOf('*', pos + 1);
						if(starPos == -1 || starPos >= end) {
							// Not more '*' found
							sequences.add(pattern.substring(pos, end));
							pos = end;
						} else {
							// Found
							sequences.add(pattern.substring(pos, starPos));
							pos = starPos + 1;
							// Skip consecutive
							while(pos < end && pattern.charAt(pos) == '*') pos++;
						}
					}
					int seqCount = sequences.size();
					assert seqCount >= 1;
					if(seqCount == 1) {
						final String sequence = sequences.get(0);
						if(startsWildcard) {
							if(endsWildcard) {
								// *infix*
								matchers.add(
									new WildcardPatternMatcher() {
										@Override
										public boolean isMatch(String paramName) {
											return paramName.contains(sequence);
										}
									}
								);
							} else {
								// *suffix
								matchers.add(
									new WildcardPatternMatcher() {
										@Override
										public boolean isMatch(String paramName) {
											return paramName.endsWith(sequence);
										}
									}
								);
							}
						} else {
							if(endsWildcard) {
								// prefix*
								matchers.add(
									new WildcardPatternMatcher() {
										@Override
										public boolean isMatch(String paramName) {
											return paramName.startsWith(sequence);
										}
									}
								);
							} else {
								// exact
								matchers.add(
									new WildcardPatternMatcher() {
										@Override
										public boolean isMatch(String paramName) {
											return paramName.equals(sequence);
										}
									}
								);
							}
						}
					} else {
						matchers.add(
							new WildcardPatternMatcher() {
								@Override
								public boolean isMatch(String paramName) {
									int index = 0;
									int indexEnd = sequences.size();
									int pos = 0;
									int end = paramName.length();
									// Handle non-wildcard start
									if(!startsWildcard) {
										String prefix = sequences.get(0);
										if(!paramName.startsWith(prefix)) {
											return false;
										}
										index++;
										pos += prefix.length();
									}
									// Handle non-wildcard end
									if(!endsWildcard) {
										indexEnd--;
										String suffix = sequences.get(indexEnd);
										if(!paramName.endsWith(suffix)) {
											return false;
										}
										end -= suffix.length();
									}
									// Check if overlapping prefix and suffix matches
									if(end < pos) return false;
									// Handle any remaining infixes
									while(index < indexEnd) {
										String sequence = sequences.get(index++);
										int sequenceLen = sequence.length();
										assert sequenceLen > 0;
										int foundAt = paramName.indexOf(sequence, pos);
										if(foundAt == -1 || foundAt > (end - sequenceLen)) {
											return false;
										}
										pos += sequenceLen;
									}
									return true;
								}
							}
						);
					}
				}
			}
			if(matchers.isEmpty()) {
				return matchNone;
			}
			if(matchers.size() == 1) return matchers.get(0);
			return new WildcardPatternMatcher() {
				@Override
				public boolean isMatch(String paramName) {
					for(WildcardPatternMatcher matcher : matchers) {
						if(matcher.isMatch(paramName)) return true;
					}
					return false;
				}
			};
		}
	}
1135711
protected Pattern compilePattern(Element regex, int flags) {

		Pattern p = null;
		try {
			String re = ((StringProperty) regex).getValue();
			p = Pattern.compile(re, flags);
		} catch (PatternSyntaxException pse) {
			throw EvaluationException.create(sourceRange, MSG_INVALID_REGEXP,
					pse.getLocalizedMessage());
		}

		return p;
	}
1028727
function matchPatternOrExact(patternStrings, candidate) {
        var patterns = [];
        for (var _i = 0, patternStrings_1 = patternStrings; _i < patternStrings_1.length; _i++) {
            var patternString = patternStrings_1[_i];
            var pattern = tryParsePattern(patternString);
            if (pattern) {
                patterns.push(pattern);
            }
            else if (patternString === candidate) {
                // pattern was matched as is - no need to search further
                return patternString;
            }
        }
        return findBestPatternMatch(patterns, function (_) { return _; }, candidate);
    }
493790
@Override
	public boolean process(final Set<? extends TypeElement> annotations, final RoundEnvironment roundEnv) {
		parseBindType(roundEnv);
		
		// Build model
		for (Element element : roundEnv.getElementsAnnotatedWith(BindType.class)) {
			final Element item = element;

			AssertKripton.assertTrueOrInvalidKindForAnnotationException(item.getKind() == ElementKind.CLASS, item, BindType.class);
			BindEntityBuilder.parse(model, (TypeElement) item);
		}
		

		if (globalBeanElements.size() == 0) {
			info("No class with @%s annotation was found", BindType.class.getSimpleName());
		}

		// Generate classes for model
		try {
			generateClasses();
		} catch (IOException e) {
			e.printStackTrace();
			throw(new KriptonRuntimeException(e));
		}

		return true;
	}
280452
private void processRenderFunction() {
    if (!hasInterface(processingEnv, component.asType(), HasRender.class)) {
      return;
    }

    componentExposedTypeBuilder.addMethod(MethodSpec
        .methodBuilder("vg$render")
        .addModifiers(Modifier.PUBLIC)
        .addAnnotation(JsMethod.class)
        .returns(VNode.class)
        .addParameter(CreateElementFunction.class, "createElementFunction")
        .addStatement("return super.render(new $T(createElementFunction))", VNodeBuilder.class)
        .build());

    addMethodToProto("vg$render");

    // Register the render method
    optionsBuilder.addStatement("options.addHookMethod($S, p.$L)", "render", "vg$render");
  }
1322573
@Override
    protected boolean onProcess(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
        List<TypeElement> deferredTypes = deferredTypeNames.stream()
                .map(deferred -> processingEnv.getElementUtils().getTypeElement(deferred)).collect(Collectors.toList());

        if (roundEnv.processingOver()) {
            // This means that the previous round didn't generate any new sources, so we can't have found
            // any new instances of @Templated; and we can't have any new types that are the reason a type
            // was in deferredTypes.
            for (TypeElement type : deferredTypes) {
                error(type, "Did not generate @%s class for %s because it references undefined types",
                        Templated.class.getSimpleName(), type);
            }
            return false;
        }

        Collection<? extends Element> annotatedElements = roundEnv.getElementsAnnotatedWith(Templated.class);
        List<TypeElement> types = new ImmutableList.Builder<TypeElement>()
                .addAll(deferredTypes)
                .addAll(ElementFilter.typesIn(annotatedElements))
                .build();
        deferredTypeNames.clear();
        for (TypeElement type : types) {
            try {
                Templated templated = type.getAnnotation(Templated.class);
                validateType(type, templated);

                boolean isInjectable = templated.injectable() == Injectable.TRUE
                        || (templated.injectable() == Injectable.IF_DI_DETECTED && diInClasspath());
                processType(type, templated, isInjectable ? "@javax.inject.Inject" : "");
            } catch (AbortProcessingException e) {
                // We abandoned this type; continue with the next.
            } catch (MissingTypeException e) {
                // We abandoned this type, but only because we needed another type that it references and
                // that other type was missing. It is possible that the missing type will be generated by
                // further annotation processing, so we will try again on the next round (perhaps failing
                // again and adding it back to the list). We save the name of the @Templated type rather
                // than its TypeElement because it is not guaranteed that it will be represented by
                // the same TypeElement on the next round.
                deferredTypeNames.add(type.getQualifiedName().toString());
            } catch (RuntimeException e) {
                // Don't propagate this exception, which will confusingly crash the compiler.
                // Instead, report a compiler error with the stack trace.
                String trace = Throwables.getStackTraceAsString(e);
                error(type, "@%s processor threw an exception: %s", Templated.class.getSimpleName(), trace);
            }
        }
        return false;  // never claim annotation, because who knows what other processors want?
    }
1054707
function Pattern() {

    // Invoking with `new` this WILL not be able to construct all pattern types
    // like e.g. from objects, those must to through the toPattern() function instead
    if (this instanceof Pattern) {

        this._match = [];
        this._last = [];
        this._first = [];
        this._not = [];

        l.map(l.flatten(arguments), this.merge, this);

    } else {
        return Pattern.toPattern.apply(null, arguments);
    }

}
534002
private void patternFilter(PatternDescrBuilder<?> pattern) throws RecognitionException {
        //        if ( input.LA( 1 ) == DRL6Lexer.PIPE ) {
        //            while ( input.LA( 1 ) == DRL6Lexer.PIPE ) {
        //                match( input,
        //                       DRL6Lexer.PIPE,
        //                       null,
        //                       null,
        //                       DroolsEditorType.SYMBOL );
        //                if ( state.failed ) return;
        //
        //                filterDef( pattern );
        //                if ( state.failed ) return;
        //            }
        //        } else {
        match(input,
                DRL6Lexer.ID,
                DroolsSoftKeywords.OVER,
                null,
                DroolsEditorType.KEYWORD);
        if (state.failed)
            return;

        filterDef(pattern);
        if (state.failed)
            return;
        //        }
    }
902131
public CharSequence matchesPattern(final CharSequence input, final String pattern, final String message) {
        if (!Pattern.matches(pattern, input)) {
            fail(message);
        }
        return input;
    }
824842
@Nonnull
	public <V1 extends T1, V2 extends T2, V3 extends T3> LToIntTriFunctionBuilder<T1, T2, T3> aCase(Class<V1> argC1, Class<V2> argC2, Class<V3> argC3, LToIntTriFunction<V1, V2, V3> function) {
		PartialCaseWithIntProduct.The pc = partialCaseFactoryMethod((a1, a2, a3) -> (argC1 == null || argC1.isInstance(a1)) && (argC2 == null || argC2.isInstance(a2)) && (argC3 == null || argC3.isInstance(a3)));

		pc.evaluate(function);
		return self();
	}
1325644
function (pattern, options) {
    var self = this;
    function find() {
      var isMatch = lazy.mm.matcher(pattern, options);
      for (var key in self) {
        var val = self[key];
        if (typeof val === 'object' && isMatch(key)) {
          return val;
        }
      }
    }
    var res = this.fragmentCache(pattern, find);
    res.__proto__ = this;
    return res;
  }