From 908859b9dce0bc6faa30d57ae638e0001c8c912b Mon Sep 17 00:00:00 2001 From: Charles Iliya Krempeaux Date: Tue, 28 Nov 2023 08:29:07 -0800 Subject: [PATCH] initial commits --- readcr.go | 9 +++++++++ readcrlf.go | 10 ++++++++++ readlf.go | 9 +++++++++ readls.go | 9 +++++++++ readnel.go | 9 +++++++++ 5 files changed, 46 insertions(+) diff --git a/readcr.go b/readcr.go index 555bc36..dfdfa43 100644 --- a/readcr.go +++ b/readcr.go @@ -6,6 +6,15 @@ import ( "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) { const characterNumber uint64 = 1 var circumstance internalCircumstance = specifyCircumstance(opt.Something(CR), characterNumber) diff --git a/readcrlf.go b/readcrlf.go index 683418e..aae876e 100644 --- a/readcrlf.go +++ b/readcrlf.go @@ -6,6 +6,16 @@ import ( "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) { var size0 int diff --git a/readlf.go b/readlf.go index 43d2e03..cf4760f 100644 --- a/readlf.go +++ b/readlf.go @@ -6,6 +6,15 @@ import ( "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) { const characterNumber uint64 = 1 var circumstance internalCircumstance = specifyCircumstance(opt.Something(LF), characterNumber) diff --git a/readls.go b/readls.go index de50f19..f862b4d 100644 --- a/readls.go +++ b/readls.go @@ -6,6 +6,15 @@ import ( "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) { const characterNumber uint64 = 1 var circumstance internalCircumstance = specifyCircumstance(opt.Something(LS), characterNumber) diff --git a/readnel.go b/readnel.go index ef6cdb0..80df7bf 100644 --- a/readnel.go +++ b/readnel.go @@ -6,6 +6,15 @@ import ( "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) { const characterNumber uint64 = 1 var circumstance internalCircumstance = specifyCircumstance(opt.Something(NEL), characterNumber)