| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 | 321 |
| 322 void Scanner::LiteralScope::Complete() { | 322 void Scanner::LiteralScope::Complete() { |
| 323 scanner_->TerminateLiteral(); | 323 scanner_->TerminateLiteral(); |
| 324 complete_ = true; | 324 complete_ = true; |
| 325 } | 325 } |
| 326 | 326 |
| 327 | 327 |
| 328 // ---------------------------------------------------------------------------- | 328 // ---------------------------------------------------------------------------- |
| 329 // V8JavaScriptScanner | 329 // V8JavaScriptScanner |
| 330 | 330 |
| 331 V8JavaScriptScanner::V8JavaScriptScanner() : JavaScriptScanner() { } | |
| 332 | |
| 333 | 331 |
| 334 void V8JavaScriptScanner::Initialize(UC16CharacterStream* source) { | 332 void V8JavaScriptScanner::Initialize(UC16CharacterStream* source) { |
| 335 source_ = source; | 333 source_ = source; |
| 336 // Need to capture identifiers in order to recognize "get" and "set" | 334 // Need to capture identifiers in order to recognize "get" and "set" |
| 337 // in object literals. | 335 // in object literals. |
| 338 Init(); | 336 Init(); |
| 339 // Skip initial whitespace allowing HTML comment ends just like | 337 // Skip initial whitespace allowing HTML comment ends just like |
| 340 // after a newline and scan first token. | 338 // after a newline and scan first token. |
| 341 has_line_terminator_before_next_ = true; | 339 has_line_terminator_before_next_ = true; |
| 342 SkipWhiteSpace(); | 340 SkipWhiteSpace(); |
| 343 Scan(); | 341 Scan(); |
| 344 } | 342 } |
| 345 | 343 |
| 346 | 344 |
| 347 // ---------------------------------------------------------------------------- | 345 // ---------------------------------------------------------------------------- |
| 348 // JsonScanner | 346 // JsonScanner |
| 349 | 347 |
| 350 JsonScanner::JsonScanner() : Scanner() { } | 348 JsonScanner::JsonScanner(Isolate* isolate) : Scanner(isolate) { } |
| 351 | 349 |
| 352 | 350 |
| 353 void JsonScanner::Initialize(UC16CharacterStream* source) { | 351 void JsonScanner::Initialize(UC16CharacterStream* source) { |
| 354 source_ = source; | 352 source_ = source; |
| 355 Init(); | 353 Init(); |
| 356 // Skip initial whitespace. | 354 // Skip initial whitespace. |
| 357 SkipJsonWhiteSpace(); | 355 SkipJsonWhiteSpace(); |
| 358 // Preload first token as look-ahead. | 356 // Preload first token as look-ahead. |
| 359 ScanJson(); | 357 ScanJson(); |
| 360 } | 358 } |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 569 | 567 |
| 570 | 568 |
| 571 Token::Value JsonScanner::ScanJsonIdentifier(const char* text, | 569 Token::Value JsonScanner::ScanJsonIdentifier(const char* text, |
| 572 Token::Value token) { | 570 Token::Value token) { |
| 573 LiteralScope literal(this); | 571 LiteralScope literal(this); |
| 574 while (*text != '\0') { | 572 while (*text != '\0') { |
| 575 if (c0_ != *text) return Token::ILLEGAL; | 573 if (c0_ != *text) return Token::ILLEGAL; |
| 576 Advance(); | 574 Advance(); |
| 577 text++; | 575 text++; |
| 578 } | 576 } |
| 579 if (ScannerConstants::kIsIdentifierPart.get(c0_)) return Token::ILLEGAL; | 577 if (scanner_constants_->IsIdentifierPart(c0_)) return Token::ILLEGAL; |
| 580 literal.Complete(); | 578 literal.Complete(); |
| 581 return token; | 579 return token; |
| 582 } | 580 } |
| 583 | 581 |
| 584 | 582 |
| 585 | |
| 586 } } // namespace v8::internal | 583 } } // namespace v8::internal |
| OLD | NEW |