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

Side by Side Diff: src/lexer/even-more-experimental-scanner.cc

Issue 72693002: Experimental lexer generator: Don't go BACK(); (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/parser
Patch Set: Created 7 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/lexer/even-more-experimental-scanner.h ('k') | src/lexer/lexer_py.re » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 bool EvenMoreExperimentalScanner::ValidIdentifierStart() { 112 bool EvenMoreExperimentalScanner::ValidIdentifierStart() {
113 return unicode_cache_->IsIdentifierStart(ScanHexNumber(4)); 113 return unicode_cache_->IsIdentifierStart(ScanHexNumber(4));
114 } 114 }
115 115
116 116
117 uint32_t EvenMoreExperimentalScanner::push(const void *input, int input_size) { 117 uint32_t EvenMoreExperimentalScanner::push(const void *input, int input_size) {
118 // FIXME: for now, we can only push once and that'll read the input. 118 // FIXME: for now, we can only push once and that'll read the input.
119 if (input_size == 0) 119 if (input_size == 0)
120 return 0; 120 return 0;
121 buffer_ = const_cast<YYCTYPE*>(reinterpret_cast<const YYCTYPE*>(input)); 121 buffer_ = const_cast<YYCTYPE*>(reinterpret_cast<const YYCTYPE*>(input));
122 cursor_ = buffer_ - 1; 122 cursor_ = buffer_;
123 start_ = buffer_; 123 start_ = buffer_;
124 buffer_end_ = buffer_ + input_size; 124 buffer_end_ = buffer_ + input_size;
125 return DoLex(); 125 return DoLex();
126 } 126 }
127 127
128 128
129 void EvenMoreExperimentalScanner::send(Token::Value token) { 129 void EvenMoreExperimentalScanner::send(Token::Value token) {
130 int beg = start_ - buffer_; 130 int beg = start_ - buffer_;
131 int end = cursor_ - buffer_; 131 int end = cursor_ - buffer_;
132 sink_->Record(token, beg, end); 132 sink_->Record(token, beg, end);
133 } 133 }
134 134
135 135
136 } 136 }
137 } 137 }
OLDNEW
« no previous file with comments | « src/lexer/even-more-experimental-scanner.h ('k') | src/lexer/lexer_py.re » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698