initial commits

master
Charles Iliya Krempeaux 2023-11-28 08:29:07 -08:00
parent 97238f4932
commit 908859b9dc
5 changed files with 46 additions and 0 deletions

View File

@ -6,6 +6,15 @@ import (
"sourcecode.social/reiver/go-opt" "sourcecode.social/reiver/go-opt"
) )
// ReadCR tries to read the "\r" (i.e., carriage-return) end-of-line sequence.
//
// If successful, it returns the number-of-bytes read (to read in end-of-line sequence "\r").
//
// If the character read is not a '\r', then ReadCR will try to unread the character.
//
// Example usage:
//
// size, err := eol.ReadCR(runescanner)
func ReadCR(runescanner io.RuneScanner) (size int, err error) { func ReadCR(runescanner io.RuneScanner) (size int, err error) {
const characterNumber uint64 = 1 const characterNumber uint64 = 1
var circumstance internalCircumstance = specifyCircumstance(opt.Something(CR), characterNumber) var circumstance internalCircumstance = specifyCircumstance(opt.Something(CR), characterNumber)

View File

@ -6,6 +6,16 @@ import (
"sourcecode.social/reiver/go-opt" "sourcecode.social/reiver/go-opt"
) )
// ReadCRLF tries to read the "\r\n" (i.e., carriage-return line-feed) end-of-line sequence.
//
// If successful, it returns the number-of-bytes read (to read in end-of-line sequence "\r\n").
//
// If the first character read is not a '\r', then ReadCRLF will try to unread the character.
// If the second character read is not a '\n', then ReadCRLF will also try to unread the second character, but will not be able to unread the first character (i.e., '\r') it already read.
//
// Example usage:
//
// size, err := eol.ReadCRLF(runescanner)
func ReadCRLF(runescanner io.RuneScanner) (size int, err error) { func ReadCRLF(runescanner io.RuneScanner) (size int, err error) {
var size0 int var size0 int

View File

@ -6,6 +6,15 @@ import (
"sourcecode.social/reiver/go-opt" "sourcecode.social/reiver/go-opt"
) )
// ReadLF tries to read the "\n" (i.e., line-feed) end-of-line sequence.
//
// If successful, it returns the number-of-bytes read (to read in end-of-line sequence "\n").
//
// If the character read is not a '\n', then ReadLF will try to unread the character.
//
// Example usage:
//
// size, err := eol.ReadLF(runescanner)
func ReadLF(runescanner io.RuneScanner) (size int, err error) { func ReadLF(runescanner io.RuneScanner) (size int, err error) {
const characterNumber uint64 = 1 const characterNumber uint64 = 1
var circumstance internalCircumstance = specifyCircumstance(opt.Something(LF), characterNumber) var circumstance internalCircumstance = specifyCircumstance(opt.Something(LF), characterNumber)

View File

@ -6,6 +6,15 @@ import (
"sourcecode.social/reiver/go-opt" "sourcecode.social/reiver/go-opt"
) )
// 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)
func ReadLS(runescanner io.RuneScanner) (size int, err error) { func ReadLS(runescanner io.RuneScanner) (size int, err error) {
const characterNumber uint64 = 1 const characterNumber uint64 = 1
var circumstance internalCircumstance = specifyCircumstance(opt.Something(LS), characterNumber) var circumstance internalCircumstance = specifyCircumstance(opt.Something(LS), characterNumber)

View File

@ -6,6 +6,15 @@ import (
"sourcecode.social/reiver/go-opt" "sourcecode.social/reiver/go-opt"
) )
// ReadNEL tries to read the "\u0085" (i.e., next-line) end-of-line sequence.
//
// If successful, it returns the number-of-bytes read (to read in end-of-line sequence "\u0085").
//
// If the character read is not a '\u0085', then ReadNEL will try to unread the character.
//
// Example usage:
//
// size, err := eol.ReadNEL(runescanner)
func ReadNEL(runescanner io.RuneScanner) (size int, err error) { func ReadNEL(runescanner io.RuneScanner) (size int, err error) {
const characterNumber uint64 = 1 const characterNumber uint64 = 1
var circumstance internalCircumstance = specifyCircumstance(opt.Something(NEL), characterNumber) var circumstance internalCircumstance = specifyCircumstance(opt.Something(NEL), characterNumber)