OLD | NEW |
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 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 UNREACHABLE(); | 322 UNREACHABLE(); |
323 } | 323 } |
324 // On fallthrough, it's a failure. | 324 // On fallthrough, it's a failure. |
325 state_ = UNMATCHABLE; | 325 state_ = UNMATCHABLE; |
326 } | 326 } |
327 | 327 |
328 | 328 |
329 // ---------------------------------------------------------------------------- | 329 // ---------------------------------------------------------------------------- |
330 // Scanner | 330 // Scanner |
331 | 331 |
332 Scanner::Scanner(bool pre) : stack_overflow_(false), is_pre_parsing_(pre) { | 332 Scanner::Scanner(bool pre) : stack_overflow_(false), is_pre_parsing_(pre) { } |
333 Token::Initialize(); | |
334 } | |
335 | 333 |
336 | 334 |
337 void Scanner::Init(Handle<String> source, unibrow::CharacterStream* stream, | 335 void Scanner::Init(Handle<String> source, unibrow::CharacterStream* stream, |
338 int position) { | 336 int position) { |
339 // Initialize the source buffer. | 337 // Initialize the source buffer. |
340 if (!source.is_null() && StringShape(*source).IsExternalTwoByte()) { | 338 if (!source.is_null() && StringShape(*source).IsExternalTwoByte()) { |
341 two_byte_string_buffer_.Initialize( | 339 two_byte_string_buffer_.Initialize( |
342 Handle<ExternalTwoByteString>::cast(source)); | 340 Handle<ExternalTwoByteString>::cast(source)); |
343 source_ = &two_byte_string_buffer_; | 341 source_ = &two_byte_string_buffer_; |
344 } else { | 342 } else { |
(...skipping 746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1091 } | 1089 } |
1092 AddCharAdvance(); | 1090 AddCharAdvance(); |
1093 } | 1091 } |
1094 TerminateLiteral(); | 1092 TerminateLiteral(); |
1095 | 1093 |
1096 next_.location.end_pos = source_pos() - 1; | 1094 next_.location.end_pos = source_pos() - 1; |
1097 return true; | 1095 return true; |
1098 } | 1096 } |
1099 | 1097 |
1100 } } // namespace v8::internal | 1098 } } // namespace v8::internal |
OLD | NEW |