Skip to content

Commit

Permalink
Add peek function for consistency with preprocess
Browse files Browse the repository at this point in the history
  • Loading branch information
kpu committed Feb 25, 2020
1 parent 0929c4d commit 2fc4130
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions util/file_piece.hh
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,18 @@ class FilePiece {
return LineIterator();
}

char get() {
char peek() {
if (position_ == position_end_) {
Shift();
if (at_end_) throw EndOfFileException();
}
return *(position_++);
return *position_;
}

char get() {
char ret = peek();
++position_;
return ret;
}

// Leaves the delimiter, if any, to be returned by get(). Delimiters defined by isspace().
Expand Down

0 comments on commit 2fc4130

Please sign in to comment.