Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(46)

Side by Side Diff: runtime/vm/scanner.h

Issue 72923002: Add Dart keyword symbols to the VM isolate (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 ScanContext* next; 98 ScanContext* next;
99 char string_delimiter; 99 char string_delimiter;
100 bool string_is_multiline; 100 bool string_is_multiline;
101 int brace_level; 101 int brace_level;
102 }; 102 };
103 103
104 struct KeywordTable { 104 struct KeywordTable {
105 Token::Kind kind; 105 Token::Kind kind;
106 const char* keyword_chars; 106 const char* keyword_chars;
107 int keyword_len; 107 int keyword_len;
108 String* keyword_symbol; 108 const String* keyword_symbol;
109 }; 109 };
110 110
111 // Rewind scanner position to token 0. 111 // Rewind scanner position to token 0.
112 void Reset(); 112 void Reset();
113 113
114 // Initialize Scanner tables.
115 void InitKeywordTable();
116
117 // Reads next lookahead character. 114 // Reads next lookahead character.
118 void ReadChar(); 115 void ReadChar();
119 116
120 // Read and discard characters up to end of line. 117 // Read and discard characters up to end of line.
121 void SkipLine(); 118 void SkipLine();
122 119
123 // Recognizes token 'kind' and reads next character in input. 120 // Recognizes token 'kind' and reads next character in input.
124 void Recognize(Token::Kind kind) { 121 void Recognize(Token::Kind kind) {
125 ReadChar(); 122 ReadChar();
126 current_token_.kind = kind; 123 current_token_.kind = kind;
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 // The following fields keep track whether we are scanning a string literal 206 // The following fields keep track whether we are scanning a string literal
210 // and its interpolated expressions. 207 // and its interpolated expressions.
211 ScanContext* saved_context_; 208 ScanContext* saved_context_;
212 int32_t string_delimiter_; 209 int32_t string_delimiter_;
213 bool string_is_multiline_; 210 bool string_is_multiline_;
214 int brace_level_; 211 int brace_level_;
215 212
216 const String& private_key_; 213 const String& private_key_;
217 214
218 SourcePosition c0_pos_; // Source position of lookahead character c0_. 215 SourcePosition c0_pos_; // Source position of lookahead character c0_.
219 KeywordTable keywords_[Token::numKeywords]; 216
220 Array& keyword_symbol_table_; // Access to keyword symbols in object store. 217 static KeywordTable keywords_[Token::numKeywords];
221 }; 218 };
222 219
223 220
224 } // namespace dart 221 } // namespace dart
225 222
226 #endif // VM_SCANNER_H_ 223 #endif // VM_SCANNER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698