Skip to content

Commit

Permalink
std::io: Scanner: forward any exceptional
Browse files Browse the repository at this point in the history
  • Loading branch information
mertcandav committed Aug 25, 2024
1 parent 2c9874a commit 8f7804c
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions std/io/scan.jule
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ impl Scanner {
// Scans line from handle via read method.
// Scans bytes until end of the line, line delimiter is not included.
// Reports whether readed byte into buffer.
// Forwards any exceptional.
fn Scan(self)!: bool {
const LINE_DELIMITER = '\n'

Expand All @@ -57,9 +58,7 @@ impl Scanner {
let mut partBuff: bufferArray
mut part := unsafe::Slice(&partBuff[0], len(partBuff))
for {
n := self.r.Read(part) else {
ret false
}
n := self.r.Read(part) else { error(error) }
if n == 0 {
break
}
Expand All @@ -70,7 +69,7 @@ impl Scanner {
self.b = append(self.b, part[:n]...)
}
self.b = clearCr(self.b)
ret len(self.b) != 0
ret len(self.b) > 0
}
}

Expand Down

0 comments on commit 8f7804c

Please sign in to comment.