Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(240)

Unified Diff: src/lexer/lexer.re

Issue 26971006: Fix fetching tokens in lexer. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/parser
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/lexer/lexer.re
diff --git a/src/lexer/lexer.re b/src/lexer/lexer.re
index 0dd6e9efaf1951c1817d73c97dc12f783e3df6a6..b65c2dfec344ba2036a70a0e775ae4c83905d4ff 100644
--- a/src/lexer/lexer.re
+++ b/src/lexer/lexer.re
@@ -343,12 +343,13 @@ void ExperimentalScanner::FillTokens() {
fetched_ = 0;
uint8_t chars[BUFFER_SIZE];
int n = static_cast<int>(fread(&chars, 1, BUFFER_SIZE, file_));
- scanner_->push(chars, n);
+ for (int i = n; i < BUFFER_SIZE; i++) chars[i] = 0;
+ scanner_->push(chars, BUFFER_SIZE);
}
Token::Value ExperimentalScanner::Next(int* beg_pos, int* end_pos) {
- if (current_ == fetched_) {
+ while (current_ == fetched_) {
FillTokens();
}
*beg_pos = beg_[current_];
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698