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

Side by Side Diff: test/cctest/test-parsing.cc

Issue 6075005: Change scanner buffers to not use utf-8. (Closed)
Patch Set: Fixed linto. Created 10 years 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
« no previous file with comments | « src/utils.h ('k') | no next file » | 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-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-2009 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 555 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 } 566 }
567 } 567 }
568 568
569 #undef CHECK_EQU 569 #undef CHECK_EQU
570 570
571 void TestStreamScanner(i::UC16CharacterStream* stream, 571 void TestStreamScanner(i::UC16CharacterStream* stream,
572 i::Token::Value* expected_tokens, 572 i::Token::Value* expected_tokens,
573 int skip_pos = 0, // Zero means not skipping. 573 int skip_pos = 0, // Zero means not skipping.
574 int skip_to = 0) { 574 int skip_to = 0) {
575 i::V8JavaScriptScanner scanner; 575 i::V8JavaScriptScanner scanner;
576 scanner.Initialize(stream, i::JavaScriptScanner::kAllLiterals); 576 scanner.Initialize(stream);
577 577
578 int i = 0; 578 int i = 0;
579 do { 579 do {
580 i::Token::Value expected = expected_tokens[i]; 580 i::Token::Value expected = expected_tokens[i];
581 i::Token::Value actual = scanner.Next(); 581 i::Token::Value actual = scanner.Next();
582 CHECK_EQ(i::Token::String(expected), i::Token::String(actual)); 582 CHECK_EQ(i::Token::String(expected), i::Token::String(actual));
583 if (scanner.location().end_pos == skip_pos) { 583 if (scanner.location().end_pos == skip_pos) {
584 scanner.SeekForward(skip_to); 584 scanner.SeekForward(skip_to);
585 } 585 }
586 i++; 586 i++;
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
638 // Skip zero-four RBRACEs. 638 // Skip zero-four RBRACEs.
639 for (int i = 0; i <= 4; i++) { 639 for (int i = 0; i <= 4; i++) {
640 expectations3[6 - i] = i::Token::ILLEGAL; 640 expectations3[6 - i] = i::Token::ILLEGAL;
641 expectations3[5 - i] = i::Token::EOS; 641 expectations3[5 - i] = i::Token::EOS;
642 i::Utf8ToUC16CharacterStream stream3( 642 i::Utf8ToUC16CharacterStream stream3(
643 reinterpret_cast<const i::byte*>(str3), 643 reinterpret_cast<const i::byte*>(str3),
644 static_cast<unsigned>(strlen(str3))); 644 static_cast<unsigned>(strlen(str3)));
645 TestStreamScanner(&stream3, expectations3, 1, 1 + i); 645 TestStreamScanner(&stream3, expectations3, 1, 1 + i);
646 } 646 }
647 } 647 }
OLDNEW
« no previous file with comments | « src/utils.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698