예제 #1
0
파일: read.go 프로젝트: deoxxa/sourcemap
// Looks ahead to see if the next character completes the entry. Does not read
// any characters from the reader.
func entryCompleted(r *strings.Reader) bool {
	if r.Len() > 0 {
		b, _ := r.ReadByte()
		r.UnreadByte()
		return b == lineSeparator || b == entrySeparator
	}
	return true
}
예제 #2
0
파일: read.go 프로젝트: deoxxa/sourcemap
// Attempts to consume the wanted character from the reader. Returns true if
// character was read successfully, false otherwise. If the character could
// not be read, then no characters are consumed from the reader.
func consume(r *strings.Reader, wanted byte) bool {
	if r.Len() > 0 {
		b, _ := r.ReadByte()
		if b == wanted {
			return true
		}
		r.UnreadByte()
	}
	return false
}