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 856 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
867 diff > 0; | 867 diff > 0; |
868 diff--) { | 868 diff--) { |
869 newline_token_.position.line = current_token_.position.line - diff; | 869 newline_token_.position.line = current_token_.position.line - diff; |
870 token_stream->Add(newline_token_); | 870 token_stream->Add(newline_token_); |
871 inserted_new_lines = true; | 871 inserted_new_lines = true; |
872 } | 872 } |
873 | 873 |
874 if (inserted_new_lines && | 874 if (inserted_new_lines && |
875 ((current_token_.kind == Token::kINTERPOL_VAR) || | 875 ((current_token_.kind == Token::kINTERPOL_VAR) || |
876 (current_token_.kind == Token::kINTERPOL_START))) { | 876 (current_token_.kind == Token::kINTERPOL_START))) { |
| 877 // NOTE: If this changes, be sure to update |
| 878 // Script::GenerateLineNumberArray to stay in sync. |
877 empty_string_token_.position.line = current_token_.position.line; | 879 empty_string_token_.position.line = current_token_.position.line; |
878 token_stream->Add(empty_string_token_); | 880 token_stream->Add(empty_string_token_); |
879 } | 881 } |
880 token_stream->Add(current_token_); | 882 token_stream->Add(current_token_); |
881 prev_token_line_ = current_token_.position.line; | 883 prev_token_line_ = current_token_.position.line; |
882 } while (current_token_.kind != Token::kEOS); | 884 } while (current_token_.kind != Token::kEOS); |
883 } | 885 } |
884 | 886 |
885 | 887 |
886 void Scanner::ScanTo(intptr_t token_index) { | 888 void Scanner::ScanTo(intptr_t token_index) { |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
937 for (int i = 0; i < Token::numKeywords; i++) { | 939 for (int i = 0; i < Token::numKeywords; i++) { |
938 Token::Kind token = static_cast<Token::Kind>(Token::kFirstKeyword + i); | 940 Token::Kind token = static_cast<Token::Kind>(Token::kFirstKeyword + i); |
939 keywords_[i].kind = token; | 941 keywords_[i].kind = token; |
940 keywords_[i].keyword_chars = Token::Str(token); | 942 keywords_[i].keyword_chars = Token::Str(token); |
941 keywords_[i].keyword_len = strlen(Token::Str(token)); | 943 keywords_[i].keyword_len = strlen(Token::Str(token)); |
942 keywords_[i].keyword_symbol = &Symbols::Keyword(token); | 944 keywords_[i].keyword_symbol = &Symbols::Keyword(token); |
943 } | 945 } |
944 } | 946 } |
945 | 947 |
946 } // namespace dart | 948 } // namespace dart |
OLD | NEW |