| 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 static bool IsIdent(const String& str); | 78 static bool IsIdent(const String& str); |
| 79 | 79 |
| 80 // Does the token stream contain a valid literal. This is used to implement | 80 // Does the token stream contain a valid literal. This is used to implement |
| 81 // the Dart methods int.parse and double.parse. | 81 // the Dart methods int.parse and double.parse. |
| 82 static bool IsValidLiteral(const Scanner::GrowableTokenStream& tokens, | 82 static bool IsValidLiteral(const Scanner::GrowableTokenStream& tokens, |
| 83 Token::Kind literal_kind, | 83 Token::Kind literal_kind, |
| 84 bool* is_positive, | 84 bool* is_positive, |
| 85 const String** value); | 85 const String** value); |
| 86 | 86 |
| 87 private: | 87 private: |
| 88 static const int kNumLowercaseChars = 26; |
| 89 |
| 88 struct ScanContext { | 90 struct ScanContext { |
| 89 ScanContext* next; | 91 ScanContext* next; |
| 90 char string_delimiter; | 92 char string_delimiter; |
| 91 bool string_is_multiline; | 93 bool string_is_multiline; |
| 92 int brace_level; | 94 int brace_level; |
| 93 }; | 95 }; |
| 94 | 96 |
| 95 struct KeywordTable { | 97 struct KeywordTable { |
| 96 Token::Kind kind; | 98 Token::Kind kind; |
| 97 const char* keyword_chars; | 99 const char* keyword_chars; |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 // and its interpolated expressions. | 200 // and its interpolated expressions. |
| 199 ScanContext* saved_context_; | 201 ScanContext* saved_context_; |
| 200 int32_t string_delimiter_; | 202 int32_t string_delimiter_; |
| 201 bool string_is_multiline_; | 203 bool string_is_multiline_; |
| 202 int brace_level_; | 204 int brace_level_; |
| 203 | 205 |
| 204 const String& private_key_; | 206 const String& private_key_; |
| 205 | 207 |
| 206 SourcePosition c0_pos_; // Source position of lookahead character c0_. | 208 SourcePosition c0_pos_; // Source position of lookahead character c0_. |
| 207 | 209 |
| 208 static KeywordTable keywords_[Token::numKeywords]; | 210 static KeywordTable keywords_[Token::kNumKeywords]; |
| 211 static int keywords_char_offset_[kNumLowercaseChars]; |
| 209 }; | 212 }; |
| 210 | 213 |
| 211 | 214 |
| 212 } // namespace dart | 215 } // namespace dart |
| 213 | 216 |
| 214 #endif // VM_SCANNER_H_ | 217 #endif // VM_SCANNER_H_ |
| OLD | NEW |