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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 // Source code line number and column of current token. | 72 // Source code line number and column of current token. |
73 const SourcePosition& CurrentPosition() const { | 73 const SourcePosition& CurrentPosition() const { |
74 return current_token_.position; | 74 return current_token_.position; |
75 } | 75 } |
76 | 76 |
77 static void InitOnce(); | 77 static void InitOnce(); |
78 | 78 |
79 // Allocated a private key which is used for name mangling. | 79 // Allocated a private key which is used for name mangling. |
80 static RawString* AllocatePrivateKey(const Library& library); | 80 static RawString* AllocatePrivateKey(const Library& library); |
81 | 81 |
| 82 // Return true if str is an identifier. |
| 83 static bool IsIdent(const String& str); |
| 84 |
82 private: | 85 private: |
83 struct ScanContext { | 86 struct ScanContext { |
84 ScanContext* next; | 87 ScanContext* next; |
85 char string_delimiter; | 88 char string_delimiter; |
86 bool string_is_multiline; | 89 bool string_is_multiline; |
87 int brace_level; | 90 int brace_level; |
88 }; | 91 }; |
89 | 92 |
90 struct KeywordTable { | 93 struct KeywordTable { |
91 Token::Kind kind; | 94 Token::Kind kind; |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 const String& private_key_; | 197 const String& private_key_; |
195 | 198 |
196 SourcePosition c0_pos_; // Source position of lookahead character c0_. | 199 SourcePosition c0_pos_; // Source position of lookahead character c0_. |
197 KeywordTable keywords_[Token::numKeywords]; | 200 KeywordTable keywords_[Token::numKeywords]; |
198 }; | 201 }; |
199 | 202 |
200 | 203 |
201 } // namespace dart | 204 } // namespace dart |
202 | 205 |
203 #endif // VM_SCANNER_H_ | 206 #endif // VM_SCANNER_H_ |
OLD | NEW |