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

Side by Side Diff: runtime/vm/scanner.cc

Issue 10686003: Better breakpoint placement (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 5 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 | « runtime/vm/scanner.h ('k') | runtime/vm/scanner_test.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 (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/scanner.h" 5 #include "vm/scanner.h"
6 6
7 #include "platform/assert.h" 7 #include "platform/assert.h"
8 #include "vm/flags.h" 8 #include "vm/flags.h"
9 #include "vm/object.h" 9 #include "vm/object.h"
10 #include "vm/object_store.h" 10 #include "vm/object_store.h"
(...skipping 856 matching lines...) Expand 10 before | Expand all | Expand 10 after
867 void Scanner::ScanTo(intptr_t token_index) { 867 void Scanner::ScanTo(intptr_t token_index) {
868 int index = 0; 868 int index = 0;
869 Reset(); 869 Reset();
870 do { 870 do {
871 Scan(); 871 Scan();
872 index++; 872 index++;
873 } while ((token_index >= index) && (current_token_.kind != Token::kEOS)); 873 } while ((token_index >= index) && (current_token_.kind != Token::kEOS));
874 } 874 }
875 875
876 876
877 intptr_t Scanner::TokenIndexAtLine(intptr_t line_number) { 877 void Scanner::TokenRangeAtLine(intptr_t line_number,
878 intptr_t* first_token_index,
879 intptr_t* last_token_index) {
878 ASSERT(line_number >= 0); 880 ASSERT(line_number >= 0);
881 ASSERT((first_token_index != NULL) && (last_token_index != NULL));
879 Reset(); 882 Reset();
883 *first_token_index = -1;
884 *last_token_index = -1;
880 int token_index = 0; 885 int token_index = 0;
881 do { 886 do {
882 Scan(); 887 Scan();
883 if (current_token_.position.line >= line_number) { 888 if (current_token_.position.line >= line_number) {
884 return token_index; 889 *first_token_index = token_index;
890 break;
885 } 891 }
886 token_index++; 892 token_index++;
887 } while (current_token_.kind != Token::kEOS); 893 } while (current_token_.kind != Token::kEOS);
888 return -1; 894 if (current_token_.kind == Token::kEOS) {
895 return;
896 }
897 if (current_token_.position.line > line_number) {
898 // *last_token_index is -1 to signal that the first token is past
899 // the requested line.
900 return;
901 }
902 ASSERT(current_token_.position.line == line_number);
903 while ((current_token_.kind != Token::kEOS) &&
904 (current_token_.position.line == line_number)) {
905 *last_token_index = token_index;
906 Scan();
907 token_index++;
908 }
889 } 909 }
890 910
891 911
892
893 const Scanner::GrowableTokenStream& Scanner::GetStream() { 912 const Scanner::GrowableTokenStream& Scanner::GetStream() {
894 GrowableTokenStream* ts = new GrowableTokenStream(128); 913 GrowableTokenStream* ts = new GrowableTokenStream(128);
895 ScanAll(ts); 914 ScanAll(ts);
896 if (FLAG_print_tokens) { 915 if (FLAG_print_tokens) {
897 Scanner::PrintTokens(*ts); 916 Scanner::PrintTokens(*ts);
898 } 917 }
899 return *ts; 918 return *ts;
900 } 919 }
901 920
902 921
(...skipping 22 matching lines...) Expand all
925 "%c%"PRIxPTR, kPrivateKeySeparator, key_value); 944 "%c%"PRIxPTR, kPrivateKeySeparator, key_value);
926 const String& result = String::Handle(String::New(private_key)); 945 const String& result = String::Handle(String::New(private_key));
927 return result.raw(); 946 return result.raw();
928 } 947 }
929 948
930 949
931 void Scanner::InitOnce() { 950 void Scanner::InitOnce() {
932 } 951 }
933 952
934 } // namespace dart 953 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/scanner.h ('k') | runtime/vm/scanner_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698