// Parse parses values in the U2F configuration section and validates its content.
486767
func (u *U2F) Parse() (*services.U2F, error) {
	// If no appID specified, default to hostname
	appID := u.AppID
	if appID == "" {
		hostname, err := os.Hostname()
		if err != nil {
			return nil, trace.Wrap(err, "failed to automatically determine U2F AppID from hostname")
		}
		appID = fmt.Sprintf("https://%s:%d", strings.ToLower(hostname), defaults.HTTPListenPort)
	}

	// If no facets specified, default to AppID
	facets := u.Facets
	if len(facets) == 0 {
		facets = []string{appID}
	}

	return &services.U2F{
		AppID:  appID,
		Facets: facets,
	}, nil
}
620479
func (b *Boxfile) parse() {
	// if im given no data it is not a valid boxfile
	if len(b.raw) == 0 {
		b.Valid = false
		return
	}
  
  err := goyaml.Unmarshal(b.raw, &b.Parsed)
  if err != nil {
    b.Valid = false
  } else {
    b.Valid = true
  }
  b.ensureValid()
}
322651
func Parse(v string) (*MediaType, error) {
	mt, params, err := mime.ParseMediaType(v)
	if err != nil {
		return nil, err
	}

	return parse(&MediaType{
		Full:   v,
		Type:   mt,
		Params: params,
	})
}
416025
func Parse(tokens []*lexer.Token, params Params) (*fsm.State, error) {
	p := &parser{
		spec:       params.Spec,
		options:    params.Options,
		optionsIdx: params.OptionsIdx,
		args:       params.Args,
		argsIdx:    params.ArgsIdx,
		tokens:     tokens,
	}
	return p.parse()
}
1133344
func Parse(s string) (u UUID, err error) {
	if len(s) != 36 {
		return UUID{}, ErrUUIDInvalid
	}

	// create stack addresses for each section of the uuid.
	p := make([][]byte, 5)

	if _, err := fmt.Sscanf(s, format, &p[0], &p[1], &p[2], &p[3], &p[4]); err != nil {
		return u, err
	}

	copy(u[0:4], p[0])
	copy(u[4:6], p[1])
	copy(u[6:8], p[2])
	copy(u[8:10], p[3])
	copy(u[10:16], p[4])

	return
}
671117
func (d *Data) Parse() error {
	defer d.cleanup()

	exifData := C.exif_loader_get_data(d.exifLoader)
	if exifData == nil {
		return fmt.Errorf(ErrNoExifData.Error(), "")
	}

	defer func() {
		C.exif_data_unref(exifData)
	}()

	return d.parseExifData(exifData)
}
1240321
func Parse(buf string) (*Tree, error) {
	t := new(Tree)
	t.scanner = new(scanner)
	return t.Parse(buf)
}
482309
func Parse(value string) (GUID, error) {
	var guid GUID
	for _, fullFormat := range knownFormats {
		parity, err := fmt.Sscanf(
			value,
			fullFormat,
			&guid.timeLow,
			&guid.timeMid,
			&guid.timeHighAndVersion,
			&guid.clockSeqHighAndReserved,
			&guid.clockSeqLow,
			&guid.node[0],
			&guid.node[1],
			&guid.node[2],
			&guid.node[3],
			&guid.node[4],
			&guid.node[5])
		if parity == 11 && err == nil {
			return guid, err
		}
	}
	return emptyGUID, fmt.Errorf("\"%s\" is not in a recognized format", value)
}
987776
func Parse(content, inEncoding, url []byte, options xml.ParseOption, outEncoding []byte) (doc *HtmlDocument, err error) {
	inEncoding = AppendCStringTerminator(inEncoding)
	outEncoding = AppendCStringTerminator(outEncoding)

	var docPtr *C.xmlDoc
	contentLen := len(content)

	if contentLen > 0 {
		var contentPtr, urlPtr, encodingPtr unsafe.Pointer

		contentPtr = unsafe.Pointer(&content[0])
		if len(url) > 0 {
			url = AppendCStringTerminator(url)
			urlPtr = unsafe.Pointer(&url[0])
		}
		if len(inEncoding) > 0 {
			encodingPtr = unsafe.Pointer(&inEncoding[0])
		}

		docPtr = C.htmlParse(contentPtr, C.int(contentLen), urlPtr, encodingPtr, C.int(options), nil, 0)

		if docPtr == nil {
			err = ERR_FAILED_TO_PARSE_HTML
		} else {
			doc = NewDocument(unsafe.Pointer(docPtr), contentLen, inEncoding, outEncoding)
		}
	}
	if docPtr == nil {
		doc = CreateEmptyDocument(inEncoding, outEncoding)
	}
	return
}
1005229
func (p *parser) parse(pf *ProtoFile) error {
	for {
		// read any documentation if found...
		documentation, err := p.readDocumentationIfFound()
		if err != nil {
			return err
		}
		if p.eofReached {
			break
		}

		// skip any intervening whitespace if present...
		p.skipWhitespace()
		if p.eofReached {
			break
		}

		// read any declaration...
		err = p.readDeclaration(pf, documentation, parseCtx{ctxType: fileCtx})
		if err != nil {
			return err
		}
		if p.eofReached {
			break
		}
	}
	return nil
}
691006
func Parse(i string) (o *url.URL, err error) {
	// Basic parse
	if o, err = url.Parse(i); err != nil {
		err = errors.Wrapf(err, "basic parsing of url %s failed", i)
		return
	}

	// File
	if o.Scheme == "" {
		// Get absolute path
		if i, err = filepath.Abs(i); err != nil {
			err = errors.Wrapf(err, "getting absolute path of %s failed", i)
			return
		}

		// Set url
		o = &url.URL{Path: filepath.ToSlash(i), Scheme: "file"}
	}
	return
}
624909
func (c *Flags) Parse() error {
	if c.ServerURL == "" {
		return errors.New("-isolate-server must be specified")
	}
	if c.ServerURL == "fake" {
		ts := httptest.NewServer(isolatedfake.New())
		c.ServerURL = ts.URL
	} else {
		s, err := lhttp.CheckURL(c.ServerURL)
		if err != nil {
			return err
		}
		c.ServerURL = s
	}
	if c.Namespace == "" {
		return errors.New("-namespace must be specified")
	}
	return nil
}
1134352
func Parse(b []byte) (u *UUID, err error) {
	if len(b) != 16 {
		err = errors.New("Given slice is not valid UUID sequence")
		return
	}
	u = new(UUID)
	copy(u[:], b)
	return
}
1199124
func Parse(filename string, b []byte, opts ...Option) (interface{}, error) {
	return newParser(filename, b, opts...).parse(g)
}
786641
func (s *HTTPServer) parse(resp http.ResponseWriter, req *http.Request, dc *string, b *structs.QueryOptions) bool {
	return s.parseInternal(resp, req, dc, b, true)
}
1151408
func (l *Parser) Parse() int {
	// init
	l.Lexer.Errors = nil
	l.rootNode = nil
	l.positionBuilder = &parser.PositionBuilder{}

	// parse

	return yyParse(l)
}
874963
func Parse(rawConfig []byte) (types.Config, report.Report, error) {
	if isEmpty(rawConfig) {
		return types.Config{}, report.Report{}, errors.ErrEmpty
	}

	var config types.Config
	if rpt, err := util.HandleParseErrors(rawConfig, &config); err != nil {
		return types.Config{}, rpt, err
	}

	version, err := semver.NewVersion(config.Ignition.Version)

	if err != nil || *version != types.MaxVersion {
		return types.Config{}, report.Report{}, errors.ErrUnknownVersion
	}

	rpt := validate.ValidateConfig(rawConfig, config)
	if rpt.IsFatal() {
		return types.Config{}, rpt, errors.ErrInvalid
	}

	return config, rpt, nil
}