// Parse wraps the creation of a new template and parsing from r in one go.
497271
func Parse(r io.Reader) (*Template, error) {
	t := New()
	err := t.Parse(r)
	return t, err
}
735299
func Parse(md metadata.MD) interface{} {
	if parser == nil {
		return nil
	}
	return parser.Parse(md)
}
1155841
func Parse(reader io.ReadSeeker, c *Chunk, tiFlag bool) (Element, error) {
	var token [1]byte
	var err error
	read, err := reader.Read(token[:])
	if read != 1 || err != nil {
		return EmptyElement{}, err
	}
	_, err = reader.Seek(-1, os.SEEK_CUR)
	if err != nil {
		return EmptyElement{}, err
	}
	switch token[0] {
	case FragmentHeaderToken:
		f := Fragment{}
		err = f.Parse(reader)
		checkFullParsingError(err, reader, &f, c)
		f.BinXMLElement, err = Parse(reader, c, tiFlag)
		checkFullParsingError(err, reader, &f, c)
		if err != nil {
			return &f, err
		}
		// We hack a bit over here creating a fake TemplateInstance to benefit from
		// the further GoEvtxMap convertion of it. Conceptually it makes sense since
		// we just create a template without substitutions.
		if _, ok := f.BinXMLElement.(*ElementStart); ok {
			var e Element
			var ti TemplateInstance
			ti.Definition.Data.Elements = make([]Element, 0)

			ti.Definition.Data.Elements = append(ti.Definition.Data.Elements, f.BinXMLElement.(*ElementStart))
			for e, err = Parse(reader, c, tiFlag); err == nil; e, err = Parse(reader, c, tiFlag) {
				ti.Definition.Data.Elements = append(ti.Definition.Data.Elements, e)
				if _, ok := e.(*BinXMLEOF); ok {
					break
				}
			}
			checkFullParsingError(err, reader, e, c)
			f.BinXMLElement = &ti
		}
		return &f, err
	case TokenOpenStartElementTag1, TokenOpenStartElementTag2:
		es := ElementStart{IsTemplateInstance: tiFlag}
		err = es.Parse(reader)
		checkFullParsingError(err, reader, &es, c)
		return &es, err
	case TokenNormalSubstitution:
		ns := NormalSubstitution{}
		err = ns.Parse(reader)
		checkParsingError(err, reader, &ns)
		return &ns, err
	case TokenOptionalSubstitution:
		os := OptionalSubstitution{}
		err = os.Parse(reader)
		checkParsingError(err, reader, &os)
		return &os, err
	case TokenCharRef1:
		tcr := CharEntityRef{}
		err = tcr.Parse(reader)
		checkParsingError(err, reader, &tcr)
		return &tcr, err
	case TokenTemplateInstance:
		var offset int32
		ti := TemplateInstance{}
		if c != nil {
			// Check if template already parsed
			offset, err = ti.DataOffset(reader)
			if err != nil {
				return nil, err
			}
			if t, ok := c.TemplateTable[offset]; ok {
				// We have now to fix the offset to continue to read
				err = ti.ParseTemplateDefinitionHeader(reader)
				if err != nil {
					return nil, err
				}
				// Only the definition is valid, not the data
				ti.Definition.Data = t
				// We jump over the template definition data if needed
				if int64(offset) == BackupSeeker(reader) {
					// We patch offset to jump off to arrive after definition data size
					RelGoToSeeker(reader, int64(ti.Definition.Data.Size)+24)
				}
				// We parse the data
				err = ti.Data.Parse(reader)
				if err != nil {
					return nil, err
				}
				return &ti, nil
			}
		}
		// We have to parse the template since it cannot be found the template table
		err = ti.Parse(reader)
		if c != nil {
			// Update template table
			c.TemplateTable[ti.Definition.Header.DataOffset] = ti.Definition.Data
		}
		checkParsingError(err, reader, &ti)
		return &ti, err
	case TokenValue1, TokenValue2:
		// ValueText
		vt := ValueText{}
		err = vt.Parse(reader)
		checkParsingError(err, reader, &vt)
		return &vt, err

	case TokenEntityRef1, TokenEntityRef2:
		e := BinXMLEntityReference{}
		err = e.Parse(reader)
		checkParsingError(err, reader, &e)
		return &e, err

	case TokenEndElementTag:
		b := BinXMLEndElementTag{}
		err = b.Parse(reader)
		checkParsingError(err, reader, &b)
		return &b, err
	case TokenCloseStartElementTag:
		t := BinXMLCloseStartElementTag{}
		err = t.Parse(reader)
		checkParsingError(err, reader, &t)
		return &t, err
	case TokenCloseEmptyElementTag:
		t := BinXMLCloseEmptyElementTag{}
		err = t.Parse(reader)
		checkParsingError(err, reader, &t)
		return &t, err
	case TokenEOF:
		b := BinXMLEOF{}
		err = b.Parse(reader)
		checkParsingError(err, reader, &b)
		return &b, nil
	}
	//log.DontPanic(ErrUnknownToken{token[0]})
	log.DebugDontPanic(ErrUnknownToken{token[0]})
	return EmptyElement{}, ErrUnknownToken{token[0]}
}
735846
func Parse(v interface{}) error {
	globalFlagSet = NewFlagSet(filepath.Base(os.Args[0]), v)
	return globalFlagSet.Parse(os.Args[1:])
}
1221937
func Parse(v interface{}) ([]string, error) {
	if command, _, err := generateCommand(v, true); err == nil {
		return command, err
	} else {
		return nil, err
	}
}
616505
func Parse(locale, text string, args ...interface{}) (r string, err error) {
	var data interface{}
	if len(args) > 0 {
		data = args[0]
	}

	mutex.RLock()
	tmpl := parseTextCache[text]
	mutex.RUnlock()

	p := parser{locale: locale, data: data}
	funcs := template.FuncMap{"p": p.parsePlural}
	for i := range args {
		arg := args[i]
		funcs[fmt.Sprintf("cldr_arg_%d", i+1)] = func() interface{} { return arg }
	}
	if tmpl == nil {
		for i := range args {
			text = strings.Replace(text, fmt.Sprintf("{{$%d}}", i+1), fmt.Sprintf("{{cldr_arg_%d}}", i+1), -1)
		}
		tmpl = template.New("").Funcs(parseFuncMap).Funcs(funcs)
		tmpl, err = tmpl.Parse(text)
		if err != nil {
			return
		}
		mutex.Lock()
		parseTextCache[text] = tmpl
		mutex.Unlock()
	} else {
		tmpl = tmpl.Funcs(funcs)
	}

	var buf bytes.Buffer
	if err = tmpl.Execute(&buf, data); err != nil {
		return
	}
	r = buf.String()
	return
}
69079
func parse(r io.Reader, pf *ProtoFile) error {
	br := bufio.NewReader(r)

	// initialize parser...
	loc := location{line: 1, column: 0}
	parser := parser{br: br, loc: &loc}

	// parse the file contents...
	return parser.parse(pf)
}
514080
func Parse(err string) *Error {
	e := new(Error)
	errr := json.Unmarshal([]byte(err), e)
	if errr != nil {
		e.Detail = err
	}
	return e
}
207030
func (t *Template) Parse(r io.Reader) error {
	b, err := ioutil.ReadAll(r)
	if err != nil {
		return err
	}
	l := newLexer(string(b), t.startDelim, t.endDelim)
	p := newParser(l)
	elems, err := p.parse()
	if err != nil {
		return err
	}
	t.elems = elems
	return nil
}
1082633
func Parse(tmpl string) (Compiler, error) {
	if !strings.HasPrefix(tmpl, "/") {
		return template{}, InvalidTemplateError{tmpl: tmpl, msg: "no leading /"}
	}
	tokens, verb := tokenize(tmpl[1:])

	p := parser{tokens: tokens}
	segs, err := p.topLevelSegments()
	if err != nil {
		return template{}, InvalidTemplateError{tmpl: tmpl, msg: err.Error()}
	}

	return template{
		segments: segs,
		verb:     verb,
		template: tmpl,
	}, nil
}
1199124
func Parse(filename string, b []byte, opts ...Option) (interface{}, error) {
	return newParser(filename, b, opts...).parse(g)
}
161493
func (p *Parser) Parse() ([]Revisioner, error) {
	var rev Revisioner
	var revs []Revisioner
	var tok token
	var err error

	for {
		tok, _, err = p.scan()

		if err != nil {
			return nil, err
		}

		switch tok {
		case at:
			rev, err = p.parseAt()
		case tilde:
			rev, err = p.parseTilde()
		case caret:
			rev, err = p.parseCaret()
		case colon:
			rev, err = p.parseColon()
		case eof:
			err = p.validateFullRevision(&revs)

			if err != nil {
				return []Revisioner{}, err
			}

			return revs, nil
		default:
			p.unscan()
			rev, err = p.parseRef()
		}

		if err != nil {
			return []Revisioner{}, err
		}

		revs = append(revs, rev)
	}
}
140898
func (t *Tree) Parse(text string) (err error) {
	defer t.recover(&err)
	t.startParse(lex(text))
	t.Text = text
	t.parse()
	t.stopParse()
	return nil
}
946257
func Parse(parser, obj interface{}) {
	parsers := Parsers{}

	if p, ok := parser.(StringParser); ok {
		parsers.StringParser = p
	}
	if p, ok := parser.(IntParser); ok {
		parsers.IntParser = p
	}
	if p, ok := parser.(FloatParser); ok {
		parsers.FloatParser = p
	}

	parseRecursive(parsers, reflect.ValueOf(obj))
}
1124616
func Parse(filename string, src io.Reader) (Grammar, error) {
	var p parser
	grammar := p.parse(filename, src)
	return grammar, p.errors.Err()
}
426174
func (tid *TemplateInstanceData) Parse(reader io.ReadSeeker) error {
	err := encoding.Unmarshal(reader, &tid.NumValues, Endianness)
	if err != nil {
		return err
	}
	if tid.NumValues < 0 {
		return fmt.Errorf("Negative number of values in TemplateInstanceData")
	}
	// Cannot definitely not be bigger than MaxSliceSize
	if tid.NumValues > MaxSliceSize {
		return fmt.Errorf("Too many values in TemplateInstanceData")
	}
	// We can now allocate process the values
	tid.Values = make([]Element, tid.NumValues)
	tid.ValueOffsets = make([]int32, tid.NumValues)
	tid.ValDescs = make([]ValueDescriptor, tid.NumValues)
	if tid.NumValues > 0 {
		err = encoding.UnmarshaInitSlice(reader, &tid.ValDescs, Endianness)
		if err != nil {
			return err
		}
	}

	// Parse the values
	for i := int32(0); i < tid.NumValues; i++ {
		tid.Values[i], err = ParseValueReader(tid.ValDescs[i], reader)
		if err != nil {
			log.Errorf("%v : %s", tid.ValDescs[i], err)
			log.DebugDontPanicf("%v : %s", tid.ValDescs[i], err)
		}
	}
	return err
}
30606
func (pp *primitiveParser) Parse() map[string]*data {
	pp.loadTypeComments()
	pp.loadStructs()

	visible := make(map[string]*data)
	for k := range pp.structmap {
		if strings.ToUpper(string(k[0])) != string(k[0]) { // not exported
			continue
		}
		pp.visitStruct(visible, k, false)
	}

	return visible
}