Skip to content

Commit

Permalink
ivy: strip carriage returns from input
Browse files Browse the repository at this point in the history
  • Loading branch information
robpike committed Jan 5, 2015
1 parent 01a5dd9 commit 44a38fb
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion scan/scan.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ type Scanner struct {

// loadLine reads the next line of input and stores it in (appends it to) the input.
// (l.input may have data left over when we are called.)
// It strips carriage returns to make subsequent processing simpler.
func (l *Scanner) loadLine() {
l.buf = l.buf[:0]
for {
Expand All @@ -157,7 +158,9 @@ func (l *Scanner) loadLine() {
l.done = true
break
}
l.buf = append(l.buf, c)
if c != '\r' {
l.buf = append(l.buf, c)
}
if c == '\n' {
break
}
Expand Down

0 comments on commit 44a38fb

Please sign in to comment.