| 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 30 matching lines...) Expand all Loading... |
| 41 Token::Kind kind; | 41 Token::Kind kind; |
| 42 int offset; // Offset in source string. | 42 int offset; // Offset in source string. |
| 43 SourcePosition position; // Text position in source. | 43 SourcePosition position; // Text position in source. |
| 44 const String* literal; // Identifier, number or string literal. | 44 const String* literal; // Identifier, number or string literal. |
| 45 }; | 45 }; |
| 46 | 46 |
| 47 class TokenCollector : public ValueObject { | 47 class TokenCollector : public ValueObject { |
| 48 public: | 48 public: |
| 49 TokenCollector() { } | 49 TokenCollector() { } |
| 50 virtual ~TokenCollector() { } | 50 virtual ~TokenCollector() { } |
| 51 virtual void AddToken(const TokenDescriptor& token); | 51 virtual void AddToken(const TokenDescriptor& token) { } |
| 52 private: | 52 private: |
| 53 DISALLOW_COPY_AND_ASSIGN(TokenCollector); | 53 DISALLOW_COPY_AND_ASSIGN(TokenCollector); |
| 54 }; | 54 }; |
| 55 | 55 |
| 56 // Initializes scanner to scan string source. | 56 // Initializes scanner to scan string source. |
| 57 Scanner(const String& source, const String& private_key); | 57 Scanner(const String& source, const String& private_key); |
| 58 ~Scanner(); | 58 ~Scanner(); |
| 59 | 59 |
| 60 // Scans one token at a time. | 60 // Scans one token at a time. |
| 61 void Scan(); | 61 void Scan(); |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 Zone* zone_; | 212 Zone* zone_; |
| 213 | 213 |
| 214 static KeywordTable keywords_[Token::kNumKeywords]; | 214 static KeywordTable keywords_[Token::kNumKeywords]; |
| 215 static int keywords_char_offset_[kNumLowercaseChars]; | 215 static int keywords_char_offset_[kNumLowercaseChars]; |
| 216 }; | 216 }; |
| 217 | 217 |
| 218 | 218 |
| 219 } // namespace dart | 219 } // namespace dart |
| 220 | 220 |
| 221 #endif // VM_SCANNER_H_ | 221 #endif // VM_SCANNER_H_ |
| OLD | NEW |