go-eol/readls.go

25 lines
700 B
Go
Raw Normal View History

2023-11-27 19:32:08 +00:00
package eol
import (
"io"
2023-11-28 16:08:55 +00:00
"sourcecode.social/reiver/go-opt"
2024-02-18 17:09:29 +00:00
"sourcecode.social/reiver/go-eol/ls"
2023-11-27 19:32:08 +00:00
)
2023-11-28 16:29:07 +00:00
// ReadLS tries to read the "\u2028" (i.e., line-separator) end-of-line sequence.
//
// If successful, it returns the number-of-bytes read (to read in end-of-line sequence "\u2028").
//
// If the character read is not a '\u2028', then ReadLS will try to unread the character.
//
// Example usage:
//
// size, err := eol.ReadLS(runescanner)
2023-11-27 19:32:08 +00:00
func ReadLS(runescanner io.RuneScanner) (size int, err error) {
2023-11-28 16:08:55 +00:00
const characterNumber uint64 = 1
var circumstance internalCircumstance = specifyCircumstance(opt.Something(LS), characterNumber)
2024-02-18 17:09:29 +00:00
return readthisrune(circumstance, runescanner, ls.Rune)
2023-11-27 19:32:08 +00:00
}