// MustCompile is like Compile but panics if the rules and optional
// variables can't be compiled. Like regexp.MustCompile, it allows for
// simple, safe initialization of global or test data.
320718
func MustCompile(rules string, variables map[string]interface{}) (r *Rules) {
	r, err := Compile(rules, variables)
	if err != nil {
		panic(err)
	}
	return
}
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
}
370527
func MustParse(s string) Pattern {
	pattern, err := Parse(s)
	if err != nil {
		panic(err)
	}
	return pattern
}
465800
func MustCompileModules(modules map[string]string) *Compiler {

	compiler, err := CompileModules(modules)
	if err != nil {
		panic(err)
	}

	return compiler
}
545333
func Must(tpl *Template, err error) *Template {
	if err != nil {
		panic(err)
	}
	return tpl
}
49442
func Compile(rules string, variables map[string]interface{}) (r *Rules, err error) {
	var c *Compiler
	if c, err = NewCompiler(); err != nil {
		return
	}
	defer c.Destroy()
	for k, v := range variables {
		if err = c.DefineVariable(k, v); err != nil {
			return
		}
	}
	if err = c.AddString(rules, ""); err != nil {
		return
	}
	r, err = c.GetRules()
	return
}
1368949
func Must(v *Version, err error) *Version {
	if err != nil {
		panic(err)
	}

	return v
}
1262779
func (d *Decoder) mustDecode(v interface{}) {
	// TODO: Top-level: ensure that v is a pointer and not nil.
	if d.d.TryDecodeAsNil() {
		setZero(v)
		return
	}
	if d.bi == nil {
		d.decode(v)
		return
	}

	d.bi.calls++
	d.decode(v)
	// xprintf.(">>>>>>>> >>>>>>>> num decFns: %v\n", d.cf.sn)
	d.bi.calls--
	if !d.h.ExplicitRelease && d.bi.calls == 0 {
		d.bi.release()
	}
}
202628
func MustCompileFrame(f Frame) []byte {
	bts, err := CompileFrame(f)
	if err != nil {
		panic(err)
	}
	return bts
}
480518
func Must(t *Template, err error) *Template {
	if err != nil {
		panic(fmt.Sprintf("template error: %s", err))
	}
	if t == nil {
		panic(fmt.Sprintf("template was nil"))
	}
	return t
}
548747
func Strict() *regexp.Regexp {
	re := regexp.MustCompile(strictExp())
	re.Longest()
	return re
}
490663
func compileStruct(file string, src *ast.Struct, requiredness fieldRequiredness) (*StructSpec, error) {
	opts := fieldOptions{requiredness: requiredness}

	if src.Type == ast.UnionType {
		opts.requiredness = noRequiredFields
		opts.disallowDefaultValue = true
	}

	fields, err := compileFields(src.Fields, opts)
	if err != nil {
		return nil, compileError{
			Target: src.Name,
			Line:   src.Line,
			Reason: err,
		}
	}

	annotations, err := compileAnnotations(src.Annotations)
	if err != nil {
		return nil, compileError{
			Target: src.Name,
			Line:   src.Line,
			Reason: err,
		}
	}

	return &StructSpec{
		Name:        src.Name,
		File:        file,
		Type:        src.Type,
		Fields:      fields,
		Doc:         src.Doc,
		Annotations: annotations,
	}, nil
}
216885
func (ctx *compctx) compile(out io.Writer, in io.Reader) error {

	defer ctx.Reset()
	var (
		bs  []byte
		err error
	)

	// libSass will fail on Sass syntax given as non-file input
	// convert the input on its behalf
	if ctx.compiler.Syntax() == SassSyntax {
		// this is memory intensive
		var buf bytes.Buffer
		err := ToScss(in, &buf)
		if err != nil {
			return err
		}
		bs = buf.Bytes()
	} else {
		// ScssSyntax
		bs, err = ioutil.ReadAll(in)
		if err != nil {
			return err
		}
	}

	if len(bs) == 0 {
		return errors.New("No input provided")
	}

	godc := libs.SassMakeDataContext(string(bs))
	goopts := libs.SassDataContextGetOptions(godc)
	libs.SassOptionSetSourceComments(goopts, true)

	ctx.Init(goopts)

	libs.SassDataContextSetOptions(godc, goopts)
	goctx := libs.SassDataContextGetContext(godc)
	ctx.context = goctx
	gocompiler := libs.SassMakeDataCompiler(godc)
	libs.SassCompilerParse(gocompiler)
	libs.SassCompilerExecute(gocompiler)
	defer libs.SassDeleteCompiler(gocompiler)

	goout := libs.SassContextGetOutputString(goctx)
	io.WriteString(out, goout)

	ctx.Status = libs.SassContextGetErrorStatus(goctx)
	errJSON := libs.SassContextGetErrorJSON(goctx)
	err = ctx.ProcessSassError([]byte(errJSON))
	if err != nil {
		return err
	}

	if ctx.Error() != "" {
		lines := bytes.Split(bs, []byte("\n"))
		var out string
		for i := -7; i < 7; i++ {
			if i+ctx.err.Line >= 0 && i+ctx.err.Line < len(lines) {
				out += fmt.Sprintf("%s\n", string(lines[i+ctx.err.Line]))
			}
		}
		// TODO: this is weird, make something more idiomatic
		return errors.New(ctx.Error() + "\n" + out)
	}

	return nil
}
1117587
func (this *GoTemplateCompiler) Compile(f string) (templates.Templater, error) {
	return template.ParseFiles(f)
}
658443
func init() {
	var err error
	validTagRe, err = regexp.Compile(`^([a-z][a-z0-9]*(\-[a-z0-9]+)*)(:([a-z0-9]+(\-[a-z0-9]+)*))*$`)
	if err != nil {
		panic(err)
	}
}
831472
func (p *Pattern) Compile() error {
	if p.re != nil {
		// we've already been compiled!
		return nil
	}
	rawRE := p.Pat
	varRE, err := regexp.Compile("/(:[^/]+)")
	if err != nil {
		p.failed = true
		return err
	}
	vars := varRE.FindAllStringSubmatch(p.Pat, -1)
	for _, varMatch := range vars {
		varName := strings.Trim(varMatch[0], "/:")
		regName := fmt.Sprintf("/(?P<%s>[^/]+)", varName)
		rawRE = strings.Replace(rawRE, varMatch[0], regName, 1)
	}
	// handle * at the end of the pattern
	if strings.HasSuffix(rawRE, "*") {
		rawRE = strings.TrimSuffix(rawRE, "*")
		rawRE += ".*"
	}
	// anchor the regex to both the beginning and the end
	rawRE = "^" + rawRE + "$"
	p.rawRE = rawRE

	re, err := regexp.Compile(rawRE)
	if err != nil {
		p.failed = true
		return err
	}
	p.re = re
	return nil
}
80179
func MustCompile(name, src string, strict bool) *Program {
	prg, err := Compile(name, src, strict)
	if err != nil {
		panic(err)
	}

	return prg
}