/* parsingRightQuote parsing the line until we found the right quote or separator. Return the data and index of last parsed line, or error if right-quote is not found or not match with specification. */ func parsingRightQuote(reader ReaderInterface, rq, line []byte, startAt int) ( v, lines []byte, p int, eRead *ReaderError, ) { var e error var content []byte p = startAt found := false // (2.2.1) for { content, p, found = tekstus.BytesCutUntil(line, rq, p, true) v = append(v, content...) if found { return v, line, p, nil } // EOL before finding right-quote. // Read and join with the next line. line, e = reader.FetchNextLine(line) if e != nil { break } } eRead = &ReaderError{ T: EReadMissRightQuote, Func: "parsingRightQuote", What: "Missing right-quote '" + string(rq) + "'", Line: string(line), Pos: p, N: 0, } if e == io.EOF { eRead.T &= EReadEOF } return v, line, p, eRead }
/* parsingSeparator parsing the line until we found the separator. Return the data and index of last parsed line, or error if separator is not found or not match with specification. */ func parsingSeparator(sep, line []byte, startAt int) ( v []byte, p int, eRead *ReaderError, ) { p = startAt v, p, found := tekstus.BytesCutUntil(line, sep, p, false) if found { return v, p, nil } eRead = &ReaderError{ Func: "parsingSeparator", What: "Missing separator '" + string(sep) + "'", Line: string(line), Pos: p, N: 0, } return v, p, eRead }