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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 } | 89 } |
90 | 90 |
91 static void InitOnce(); | 91 static void InitOnce(); |
92 | 92 |
93 // Allocated a private key which is used for name mangling. | 93 // Allocated a private key which is used for name mangling. |
94 static RawString* AllocatePrivateKey(const Library& library); | 94 static RawString* AllocatePrivateKey(const Library& library); |
95 | 95 |
96 // Return true if str is an identifier. | 96 // Return true if str is an identifier. |
97 static bool IsIdent(const String& str); | 97 static bool IsIdent(const String& str); |
98 | 98 |
| 99 // Does the token stream contain a valid literal. This is used to implement |
| 100 // the Dart methods int.parse and double.parse. |
| 101 static bool IsValidLiteral(const Scanner::GrowableTokenStream& tokens, |
| 102 Token::Kind literal_kind, |
| 103 bool* is_positive, |
| 104 String** value); |
| 105 |
99 private: | 106 private: |
100 struct ScanContext { | 107 struct ScanContext { |
101 ScanContext* next; | 108 ScanContext* next; |
102 char string_delimiter; | 109 char string_delimiter; |
103 bool string_is_multiline; | 110 bool string_is_multiline; |
104 int brace_level; | 111 int brace_level; |
105 }; | 112 }; |
106 | 113 |
107 struct KeywordTable { | 114 struct KeywordTable { |
108 Token::Kind kind; | 115 Token::Kind kind; |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 | 223 |
217 SourcePosition c0_pos_; // Source position of lookahead character c0_. | 224 SourcePosition c0_pos_; // Source position of lookahead character c0_. |
218 KeywordTable keywords_[Token::numKeywords]; | 225 KeywordTable keywords_[Token::numKeywords]; |
219 Array& keyword_symbol_table_; // Access to keyword symbols in object store. | 226 Array& keyword_symbol_table_; // Access to keyword symbols in object store. |
220 }; | 227 }; |
221 | 228 |
222 | 229 |
223 } // namespace dart | 230 } // namespace dart |
224 | 231 |
225 #endif // VM_SCANNER_H_ | 232 #endif // VM_SCANNER_H_ |
OLD | NEW |