| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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(); |
| 62 | 62 |
| 63 // Scans to specified token position. | 63 // Scans to specified token position. |
| 64 // Use CurrentPosition() to extract position. | 64 // Use CurrentPosition() to extract position. |
| 65 void ScanTo(intptr_t token_index); | 65 void ScanTo(intptr_t token_index); |
| 66 | 66 |
| 67 // Returns token index of first token on or after given line number. | 67 // Returns index of first and last token on the given line. |
| 68 // Returns negative value if no token exists on or after the line. | 68 // Returns both indices < 0 if no token exists on or after the line. |
| 69 intptr_t TokenIndexAtLine(intptr_t line_number); | 69 // If a token exists after, but not on given line, returns in |
| 70 // *fisrt_token_index the index of the first token after the line, |
| 71 // and a negative value in *last_token_index. |
| 72 void TokenRangeAtLine(intptr_t line_number, |
| 73 intptr_t* first_token_index, |
| 74 intptr_t* last_token_index); |
| 70 | 75 |
| 71 // Scans entire source and returns a stream of tokens. | 76 // Scans entire source and returns a stream of tokens. |
| 72 // Should be called only once. | 77 // Should be called only once. |
| 73 const GrowableTokenStream& GetStream(); | 78 const GrowableTokenStream& GetStream(); |
| 74 | 79 |
| 75 // Info about most recently recognized token. | 80 // Info about most recently recognized token. |
| 76 const TokenDescriptor& current_token() const { return current_token_; } | 81 const TokenDescriptor& current_token() const { return current_token_; } |
| 77 | 82 |
| 78 // Was there a line break before the current token? | 83 // Was there a line break before the current token? |
| 79 bool NewlineBeforeToken() const { return newline_seen_; } | 84 bool NewlineBeforeToken() const { return newline_seen_; } |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 | 216 |
| 212 SourcePosition c0_pos_; // Source position of lookahead character c0_. | 217 SourcePosition c0_pos_; // Source position of lookahead character c0_. |
| 213 KeywordTable keywords_[Token::numKeywords]; | 218 KeywordTable keywords_[Token::numKeywords]; |
| 214 Array& keyword_symbol_table_; // Access to keyword symbols in object store. | 219 Array& keyword_symbol_table_; // Access to keyword symbols in object store. |
| 215 }; | 220 }; |
| 216 | 221 |
| 217 | 222 |
| 218 } // namespace dart | 223 } // namespace dart |
| 219 | 224 |
| 220 #endif // VM_SCANNER_H_ | 225 #endif // VM_SCANNER_H_ |
| OLD | NEW |