// Compile parses a regular expression and returns, if successful,
// a Regexp object that can be used to match against lines of text.
343495
func Compile(expr string) (*Regexp, error) {
	re, err := syntax.Parse(expr, syntax.Perl)
	if err != nil {
		return nil, err
	}
	sre := re.Simplify()
	prog, err := syntax.Compile(sre)
	if err != nil {
		return nil, err
	}
	if err := toByteProg(prog); err != nil {
		return nil, err
	}
	r := &Regexp{
		Syntax: re,
		expr:   expr,
	}
	if err := r.m.init(prog); err != nil {
		return nil, err
	}
	return r, nil
}
70210
func (self *Otto) Compile(filename string, src interface{}) (*Script, error) {
	return self.CompileWithSourceMap(filename, src, nil)
}
1062551
func (c *Criterion) RegExp(expression *regexp.Regexp) *Query {
	return c.op(re, expression)
}
1241847
func (r *Rego) Compile(ctx context.Context) (*CompileResult, error) {

	pq, err := r.Partial(ctx)
	if err != nil {
		return nil, err
	}

	if len(pq.Support) > 0 {
		return nil, fmt.Errorf("modules not supported")
	}

	policy, err := planner.New().WithQueries(pq.Queries).Plan()
	if err != nil {
		return nil, err
	}

	if r.dump != nil {
		fmt.Fprintln(r.dump, "PLAN:")
		fmt.Fprintln(r.dump, "-----")
		ir.Pretty(r.dump, policy)
		fmt.Fprintln(r.dump)
	}

	m, err := wasm.New().WithPolicy(policy).Compile()
	if err != nil {
		return nil, err
	}

	var out bytes.Buffer

	if err := encoding.WriteModule(&out, m); err != nil {
		return nil, err
	}

	result := &CompileResult{
		Bytes: out.Bytes(),
	}

	return result, nil
}
766386
func capture(res ...*regexp.Regexp) *regexp.Regexp {
	return match(`(` + expression(res...).String() + `)`)
}
833032
func Compile(template string) (renderFn *js.Object) {
	return vue.Call("compile", template).Get("render")
}
836207
func RegexMatch(regexStr string) gopter.Gen {
	regexSyntax, err1 := syntax.Parse(regexStr, syntax.Perl)
	regex, err2 := regexp.Compile(regexStr)
	if err1 != nil || err2 != nil {
		return Fail(reflect.TypeOf(""))
	}
	return regexMatchGen(regexSyntax.Simplify()).SuchThat(func(v string) bool {
		return regex.MatchString(v)
	}).WithShrinker(StringShrinker)
}
302583
func (this *AmberCompiler) Compile(f string) (templates.Templater, error) {
	// amber.CompileFile creates a new compiler each time. To limit the number
	// of allocations, reuse a compiler.
	if this.c == nil {
		this.c = amber.New()
	}
	this.c.Options = this.Options
	if err := this.c.ParseFile(f); err != nil {
		return nil, err
	}
	return this.c.Compile()
}
257857
func (p *parserMixin) RegexpList() (target *[]*regexp.Regexp) {
	target = new([]*regexp.Regexp)
	p.RegexpListVar(target)
	return
}
557057
func compile(src string, des string, lan string) error {
	var cmd = new(exec.Cmd)
	switch lan {
	case C:
		cmd = exec.Command("gcc", "-o", des, src, "-lm") //-lm for gcc math link option
	case CPP:
		cmd = exec.Command("g++", "-o", des, src)
	case GO:
		cmd = exec.Command("go", "build", "-o", des, src)
	default:
		return fmt.Errorf("unspported or unknown language %s", lan)
	}
	if out, err := cmd.CombinedOutput(); err != nil {
		return cli.NewExitError(fmt.Sprintf("%s err:%s", out, err), 1)
	} else {
		return nil
	}
}
1123305
func (p *Parameter) Compile(d Dialect, params *Parameters) (string, error) {
	i := params.Add(p.Value)
	return d.Parameterize(i), nil
}
1018377
func (v *VerbalExpression) Regex() *regexp.Regexp {

	if !v.compiled {
		v.regexp = regexp.MustCompile(
			strings.Join([]string{
				strings.Join(v.parts, ""),
				`(?` + v.getFlags() + `)`,
				v.prefixes,
				v.expression,
				v.suffixes}, ""))
		v.compiled = true
	}
	return v.regexp
}
1058460
func Compile(ctx context.Context, rawStmt ast.StmtNode) (plan.Plan, error) {
	info := ctx.GetSessionVars().TxnCtx.InfoSchema.(infoschema.InfoSchema)

	node := rawStmt
	err := resolver.ResolveName(node, info, ctx)
	if err != nil {
		return nil, errors.Trace(err)
	}
	p, err := plan.Optimize(ctx, node, info)
	if err != nil {
		return nil, errors.Trace(err)
	}
	return p, nil
}
769046
func (p *pattern) compile(tokens []*Token) Pattern {
	// what tokens do we have in this pattern?
	//      - ANY token means we can match to any depth
	//      - SEPARATOR means we have path rather than file matching
	_separator := false
	for _, _token := range tokens {
		switch _token.Type {
		case ANY:
			return p.any(tokens)
		case SEPARATOR:
			_separator = true
		}
	}

	// should we perform path or name/file matching?
	if _separator {
		return p.path(tokens)
	} else {
		return p.name(tokens)
	}
}
1278257
func Compile(where criteria.Expression) (whereClause string, parameters []interface{}, joins []*TableJoin, err []error) {
	compiler := newExpressionCompiler()

	criteria.IteratePostOrder(where, bubbleUpJSONContext(&compiler))

	compiled := where.Accept(&compiler)

	c, ok := compiled.(string)
	if !ok {
		c = ""
	}

	// Make sure we don't return all possible joins but only the once that were
	// activated. Returning them as a slice preserves the correct order of
	// joins.
	joins, e := compiler.joins.GetOrderdActivatedJoins()
	if e != nil {
		compiler.err = append(compiler.err, e)
	}

	for _, j := range joins {
		if j.Where == "" {
			continue
		}
		if c != "" {
			c += " AND "
		}
		c += j.Where
	}

	return c, compiler.parameters, joins, compiler.err
}
1152831
func (f *Filter) Compile() error {
	if len(f.NameDrop) == 0 &&
		len(f.NamePass) == 0 &&
		len(f.FieldDrop) == 0 &&
		len(f.FieldPass) == 0 &&
		len(f.TagInclude) == 0 &&
		len(f.TagExclude) == 0 &&
		len(f.TagPass) == 0 &&
		len(f.TagDrop) == 0 {
		return nil
	}

	f.isActive = true
	var err error
	f.nameDrop, err = filter.Compile(f.NameDrop)
	if err != nil {
		return fmt.Errorf("Error compiling 'namedrop', %s", err)
	}
	f.namePass, err = filter.Compile(f.NamePass)
	if err != nil {
		return fmt.Errorf("Error compiling 'namepass', %s", err)
	}

	f.fieldDrop, err = filter.Compile(f.FieldDrop)
	if err != nil {
		return fmt.Errorf("Error compiling 'fielddrop', %s", err)
	}
	f.fieldPass, err = filter.Compile(f.FieldPass)
	if err != nil {
		return fmt.Errorf("Error compiling 'fieldpass', %s", err)
	}

	f.tagExclude, err = filter.Compile(f.TagExclude)
	if err != nil {
		return fmt.Errorf("Error compiling 'tagexclude', %s", err)
	}
	f.tagInclude, err = filter.Compile(f.TagInclude)
	if err != nil {
		return fmt.Errorf("Error compiling 'taginclude', %s", err)
	}

	for i := range f.TagDrop {
		f.TagDrop[i].filter, err = filter.Compile(f.TagDrop[i].Filter)
		if err != nil {
			return fmt.Errorf("Error compiling 'tagdrop', %s", err)
		}
	}
	for i := range f.TagPass {
		f.TagPass[i].filter, err = filter.Compile(f.TagPass[i].Filter)
		if err != nil {
			return fmt.Errorf("Error compiling 'tagpass', %s", err)
		}
	}
	return nil
}
347589
func match(regex, text string) string {
	if matched, _ := regexp.MatchString(regex, text); matched {
		return regexp.MustCompile(regex).ReplaceAllString(text, "$1")
	}
	return ""
}