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

Side by Side Diff: src/scanner.h

Issue 173116: Fix an ASSERT in the scanner (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/scanner.cc » ('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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 205
206 // Tells whether the buffer contains an identifier (no escapes). 206 // Tells whether the buffer contains an identifier (no escapes).
207 // Used for checking if a property name is an identifier. 207 // Used for checking if a property name is an identifier.
208 static bool IsIdentifier(unibrow::CharacterStream* buffer); 208 static bool IsIdentifier(unibrow::CharacterStream* buffer);
209 209
210 static unibrow::Predicate<IdentifierStart, 128> kIsIdentifierStart; 210 static unibrow::Predicate<IdentifierStart, 128> kIsIdentifierStart;
211 static unibrow::Predicate<IdentifierPart, 128> kIsIdentifierPart; 211 static unibrow::Predicate<IdentifierPart, 128> kIsIdentifierPart;
212 static unibrow::Predicate<unibrow::LineTerminator, 128> kIsLineTerminator; 212 static unibrow::Predicate<unibrow::LineTerminator, 128> kIsLineTerminator;
213 static unibrow::Predicate<unibrow::WhiteSpace, 128> kIsWhiteSpace; 213 static unibrow::Predicate<unibrow::WhiteSpace, 128> kIsWhiteSpace;
214 214
215 static const int kCharacterLookaheadBufferSize = 1;
216
215 private: 217 private:
216 CharacterStreamUTF16Buffer char_stream_buffer_; 218 CharacterStreamUTF16Buffer char_stream_buffer_;
217 TwoByteStringUTF16Buffer two_byte_string_buffer_; 219 TwoByteStringUTF16Buffer two_byte_string_buffer_;
218 220
219 // Source. 221 // Source.
220 UTF16Buffer* source_; 222 UTF16Buffer* source_;
221 int position_; 223 int position_;
222 224
223 // Buffer to hold literal values (identifiers, strings, numbers) 225 // Buffer to hold literal values (identifiers, strings, numbers)
224 // using 0-terminated UTF-8 encoding. 226 // using 0-terminated UTF-8 encoding.
(...skipping 10 matching lines...) Expand all
235 Token::Value token; 237 Token::Value token;
236 Location location; 238 Location location;
237 int literal_pos, literal_end; 239 int literal_pos, literal_end;
238 }; 240 };
239 241
240 TokenDesc current_; // desc for current token (as returned by Next()) 242 TokenDesc current_; // desc for current token (as returned by Next())
241 TokenDesc next_; // desc for next token (one token look-ahead) 243 TokenDesc next_; // desc for next token (one token look-ahead)
242 bool has_line_terminator_before_next_; 244 bool has_line_terminator_before_next_;
243 bool is_pre_parsing_; 245 bool is_pre_parsing_;
244 246
245 static const int kCharacterLookaheadBufferSize = 1;
246
247 // Literal buffer support 247 // Literal buffer support
248 void StartLiteral(); 248 void StartLiteral();
249 void AddChar(uc32 ch); 249 void AddChar(uc32 ch);
250 void AddCharAdvance(); 250 void AddCharAdvance();
251 void TerminateLiteral(); 251 void TerminateLiteral();
252 252
253 // Low-level scanning support. 253 // Low-level scanning support.
254 void Advance() { c0_ = source_->Advance(); } 254 void Advance() { c0_ = source_->Advance(); }
255 void PushBack(uc32 ch) { 255 void PushBack(uc32 ch) {
256 source_->PushBack(ch); 256 source_->PushBack(ch);
(...skipping 25 matching lines...) Expand all
282 } 282 }
283 283
284 // Decodes a unicode escape-sequence which is part of an identifier. 284 // Decodes a unicode escape-sequence which is part of an identifier.
285 // If the escape sequence cannot be decoded the result is kBadRune. 285 // If the escape sequence cannot be decoded the result is kBadRune.
286 uc32 ScanIdentifierUnicodeEscape(); 286 uc32 ScanIdentifierUnicodeEscape();
287 }; 287 };
288 288
289 } } // namespace v8::internal 289 } } // namespace v8::internal
290 290
291 #endif // V8_SCANNER_H_ 291 #endif // V8_SCANNER_H_
OLDNEW
« no previous file with comments | « no previous file | src/scanner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698