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

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

View File

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

View File

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