initial commits

master
Charles Iliya Krempeaux 2023-11-27 11:20:41 -08:00
parent e44c899fa3
commit a418be929b
3 changed files with 16 additions and 16 deletions

View File

@ -1,16 +1,16 @@
package eol
const (
lf = '\u000A'
cr = '\u000D'
nl = '\u0085'
ls = '\u2028'
lf = '\u000A'
cr = '\u000D'
nel = '\u0085'
ls = '\u2028'
)
const (
LF = string(lf)
CR = string(cr)
LF = string(lf)
CR = string(cr)
CRLF = CR+LF
NL = string(nl)
LS = string(ls)
NEL = string(nel)
LS = string(ls)
)

View File

@ -8,11 +8,11 @@ import (
//
// The end-of-line sequences it supports are:
//
// line-feed (LF) (U+000A) ('\n')
// carriage-return (CR) (U+000D) ('\r')
// line-feed (LF) (U+000A) ('\n')
// carriage-return (CR) (U+000D) ('\r')
// carriage-return, line-feed ("\r\n")
// new-line (NL) (U+0085)
// line-separator (LS) (U+2028)
// next-line (NEL) (U+0085)
// line-separator (LS) (U+2028)
//
// If successful, ReadEOL return the end-of-line sequence and the number-of-bytes read.
func ReadEOL(runescanner io.RuneScanner) (endofline string, size int, err error) {
@ -37,8 +37,8 @@ func ReadEOL(runescanner io.RuneScanner) (endofline string, size int, err error)
return LF, size0, nil
case cr:
// Nothing here.
case nl:
return NL, size0, nil
case nel:
return NEL, size0, nil
case ls:
return LS, size0, nil
default:

View File

@ -35,7 +35,7 @@ func TestReadEOL(t *testing.T) {
},
{
Value: "\u0085",
ExpectedEOL: eol.NL,
ExpectedEOL: eol.NEL,
ExpectedSize: 2,
},
{
@ -63,7 +63,7 @@ func TestReadEOL(t *testing.T) {
},
{
Value: "\u0085apple banana cherr",
ExpectedEOL: eol.NL,
ExpectedEOL: eol.NEL,
ExpectedSize: 2,
},
{