| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 // Scanner class for the Dart language. The scanner reads source text | 5 // Scanner class for the Dart language. The scanner reads source text |
| 6 // and produces a stream of tokens which is used by the parser. | 6 // and produces a stream of tokens which is used by the parser. |
| 7 // | 7 // |
| 8 | 8 |
| 9 #ifndef VM_SCANNER_H_ | 9 #ifndef VM_SCANNER_H_ |
| 10 #define VM_SCANNER_H_ | 10 #define VM_SCANNER_H_ |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 ScanIdentChars(false); | 173 ScanIdentChars(false); |
| 174 } | 174 } |
| 175 | 175 |
| 176 // Reads a number literal. | 176 // Reads a number literal. |
| 177 void ScanNumber(bool dec_point_seen); | 177 void ScanNumber(bool dec_point_seen); |
| 178 | 178 |
| 179 void ScanScriptTag(); | 179 void ScanScriptTag(); |
| 180 | 180 |
| 181 CharAtFunc CallCharAt() const { return char_at_func_; } | 181 CharAtFunc CallCharAt() const { return char_at_func_; } |
| 182 | 182 |
| 183 Thread* thread() const { return thread_; } |
| 183 Zone* zone() const { return zone_; } | 184 Zone* zone() const { return zone_; } |
| 184 | 185 |
| 185 static void PrintTokens(const GrowableTokenStream& ts); | 186 static void PrintTokens(const GrowableTokenStream& ts); |
| 186 | 187 |
| 187 TokenDescriptor current_token_; // Current token. | 188 TokenDescriptor current_token_; // Current token. |
| 188 TokenDescriptor newline_token_; // Newline token. | 189 TokenDescriptor newline_token_; // Newline token. |
| 189 TokenDescriptor empty_string_token_; // Token for "". | 190 TokenDescriptor empty_string_token_; // Token for "". |
| 190 const String& source_; // The source text being tokenized. | 191 const String& source_; // The source text being tokenized. |
| 191 intptr_t source_length_; // The length of the source text. | 192 intptr_t source_length_; // The length of the source text. |
| 192 intptr_t lookahead_pos_; // Position of lookahead character | 193 intptr_t lookahead_pos_; // Position of lookahead character |
| 193 // within source_. | 194 // within source_. |
| 194 intptr_t token_start_; // Begin of current token in src_. | 195 intptr_t token_start_; // Begin of current token in src_. |
| 195 int32_t c0_; // Lookahead character. | 196 int32_t c0_; // Lookahead character. |
| 196 bool newline_seen_; // Newline before current token. | 197 bool newline_seen_; // Newline before current token. |
| 197 intptr_t prev_token_line_; // Line number of the previous token. | 198 intptr_t prev_token_line_; // Line number of the previous token. |
| 198 | 199 |
| 199 // The following fields keep track whether we are scanning a string literal | 200 // The following fields keep track whether we are scanning a string literal |
| 200 // and its interpolated expressions. | 201 // and its interpolated expressions. |
| 201 ScanContext* saved_context_; | 202 ScanContext* saved_context_; |
| 202 int32_t string_delimiter_; | 203 int32_t string_delimiter_; |
| 203 bool string_is_multiline_; | 204 bool string_is_multiline_; |
| 204 int brace_level_; | 205 int brace_level_; |
| 205 | 206 |
| 206 const String& private_key_; | 207 const String& private_key_; |
| 207 | 208 |
| 208 SourcePosition c0_pos_; // Source position of lookahead character c0_. | 209 SourcePosition c0_pos_; // Source position of lookahead character c0_. |
| 209 | 210 |
| 210 const CharAtFunc char_at_func_; | 211 const CharAtFunc char_at_func_; |
| 211 | 212 |
| 213 Thread* thread_; |
| 212 Zone* zone_; | 214 Zone* zone_; |
| 213 | 215 |
| 214 static KeywordTable keywords_[Token::kNumKeywords]; | 216 static KeywordTable keywords_[Token::kNumKeywords]; |
| 215 static int keywords_char_offset_[kNumLowercaseChars]; | 217 static int keywords_char_offset_[kNumLowercaseChars]; |
| 216 }; | 218 }; |
| 217 | 219 |
| 218 | 220 |
| 219 } // namespace dart | 221 } // namespace dart |
| 220 | 222 |
| 221 #endif // VM_SCANNER_H_ | 223 #endif // VM_SCANNER_H_ |
| OLD | NEW |