MCPcopy Index your code
hub / github.com/g3n/engine / parse

Method parse

loader/obj/obj.go:401–424  ·  view source on GitHub ↗

parse reads the lines from the specified reader and dispatch them to the specified line parser.

(reader io.Reader, parseLine func(string) error)

Source from the content-addressed store, hash-verified

399// parse reads the lines from the specified reader and dispatch them
400// to the specified line parser.
401func (dec *Decoder) parse(reader io.Reader, parseLine func(string) error) error {
402
403 bufin := bufio.NewReader(reader)
404 dec.line = 1
405 for {
406 // Reads next line and abort on errors (not EOF)
407 line, err := bufin.ReadString('\n')
408 if err != nil && err != io.EOF {
409 return err
410 }
411 // Parses the line
412 line = strings.Trim(line, blanks)
413 perr := parseLine(line)
414 if perr != nil {
415 return perr
416 }
417 // If EOF ends of parsing.
418 if err == io.EOF {
419 break
420 }
421 dec.line++
422 }
423 return nil
424}
425
426// Parses obj file line, dispatching to specific parsers
427func (dec *Decoder) parseObjLine(line string) error {

Callers 1

DecodeReaderFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected