fix EOF handling after stdlib change for files
This commit is contained in:
parent
4f1c219052
commit
5e069c4ca4
@ -1,6 +1,7 @@
|
|||||||
package treerack
|
package treerack
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"errors"
|
||||||
"io"
|
"io"
|
||||||
"strings"
|
"strings"
|
||||||
"unicode"
|
"unicode"
|
||||||
@ -39,7 +40,7 @@ func (c *context) read() bool {
|
|||||||
|
|
||||||
token, n, err := c.reader.ReadRune()
|
token, n, err := c.reader.ReadRune()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if err == io.EOF {
|
if errors.Is(err, io.EOF) {
|
||||||
if n == 0 {
|
if n == 0 {
|
||||||
c.eof = true
|
c.eof = true
|
||||||
return false
|
return false
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@ -18,6 +18,7 @@ unlicensed.
|
|||||||
|
|
||||||
package self
|
package self
|
||||||
|
|
||||||
|
// head
|
||||||
import (
|
import (
|
||||||
"bufio"
|
"bufio"
|
||||||
"errors"
|
"errors"
|
||||||
@ -618,7 +619,7 @@ func (c *context) read() bool {
|
|||||||
}
|
}
|
||||||
token, n, err := c.reader.ReadRune()
|
token, n, err := c.reader.ReadRune()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if err == io.EOF {
|
if errors.Is(err, io.EOF) {
|
||||||
if n == 0 {
|
if n == 0 {
|
||||||
c.eof = true
|
c.eof = true
|
||||||
return false
|
return false
|
||||||
@ -808,6 +809,8 @@ func parseInput(r io.Reader, p parser, b builder, kw []parser) (*Node, error) {
|
|||||||
return n[0], nil
|
return n[0], nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// eo head
|
||||||
|
|
||||||
func Parse(r io.Reader) (*Node, error) {
|
func Parse(r io.Reader) (*Node, error) {
|
||||||
|
|
||||||
var p196 = sequenceParser{id: 196, commit: 128, ranges: [][]int{{0, -1}, {1, 1}, {0, -1}}}
|
var p196 = sequenceParser{id: 196, commit: 128, ranges: [][]int{{0, -1}, {1, 1}, {0, -1}}}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user