OLD | NEW |
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/dart.h" | 8 #include "vm/dart.h" |
9 #include "vm/flags.h" | 9 #include "vm/flags.h" |
10 #include "vm/object.h" | 10 #include "vm/object.h" |
(...skipping 842 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
853 ErrorMsg(msg); | 853 ErrorMsg(msg); |
854 ReadChar(); | 854 ReadChar(); |
855 } | 855 } |
856 } | 856 } |
857 } while (current_token_.kind == Token::kWHITESP); | 857 } while (current_token_.kind == Token::kWHITESP); |
858 } | 858 } |
859 | 859 |
860 | 860 |
861 void Scanner::ScanAll(GrowableTokenStream* token_stream) { | 861 void Scanner::ScanAll(GrowableTokenStream* token_stream) { |
862 Reset(); | 862 Reset(); |
| 863 VMTagScope(Isolate::Current(), VMTag::kCompileScannerTagId); |
863 do { | 864 do { |
864 Scan(); | 865 Scan(); |
865 | 866 |
866 bool inserted_new_lines = false; | 867 bool inserted_new_lines = false; |
867 for (intptr_t diff = current_token_.position.line - prev_token_line_; | 868 for (intptr_t diff = current_token_.position.line - prev_token_line_; |
868 diff > 0; | 869 diff > 0; |
869 diff--) { | 870 diff--) { |
870 newline_token_.position.line = current_token_.position.line - diff; | 871 newline_token_.position.line = current_token_.position.line - diff; |
871 token_stream->Add(newline_token_); | 872 token_stream->Add(newline_token_); |
872 inserted_new_lines = true; | 873 inserted_new_lines = true; |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
940 for (int i = 0; i < Token::numKeywords; i++) { | 941 for (int i = 0; i < Token::numKeywords; i++) { |
941 Token::Kind token = static_cast<Token::Kind>(Token::kFirstKeyword + i); | 942 Token::Kind token = static_cast<Token::Kind>(Token::kFirstKeyword + i); |
942 keywords_[i].kind = token; | 943 keywords_[i].kind = token; |
943 keywords_[i].keyword_chars = Token::Str(token); | 944 keywords_[i].keyword_chars = Token::Str(token); |
944 keywords_[i].keyword_len = strlen(Token::Str(token)); | 945 keywords_[i].keyword_len = strlen(Token::Str(token)); |
945 keywords_[i].keyword_symbol = &Symbols::Keyword(token); | 946 keywords_[i].keyword_symbol = &Symbols::Keyword(token); |
946 } | 947 } |
947 } | 948 } |
948 | 949 |
949 } // namespace dart | 950 } // namespace dart |
OLD | NEW |