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