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

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

Issue 1589643002: Source positions for constructors and lots of async machinery (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 months 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
« no previous file with comments | « runtime/vm/runtime_entry.cc ('k') | runtime/vm/scopes.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 26 matching lines...) Expand all
37 37
38 // TokenDesc defines the kind of a token and its location in 38 // TokenDesc defines the kind of a token and its location in
39 // the source text. 39 // the source text.
40 struct TokenDescriptor { 40 struct TokenDescriptor {
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 // Dummy token index reflecting an unknown source position.
48 static const intptr_t kNoSourcePos = -1;
49
50 static bool ValidSourcePosition(intptr_t token_pos) {
51 return (token_pos >= 0) || (token_pos == kNoSourcePos);
52 }
53
54 typedef ZoneGrowableArray<TokenDescriptor> GrowableTokenStream; 47 typedef ZoneGrowableArray<TokenDescriptor> GrowableTokenStream;
55 48
56 // Initializes scanner to scan string source. 49 // Initializes scanner to scan string source.
57 Scanner(const String& source, const String& private_key); 50 Scanner(const String& source, const String& private_key);
58 ~Scanner(); 51 ~Scanner();
59 52
60 // Scans one token at a time. 53 // Scans one token at a time.
61 void Scan(); 54 void Scan();
62 55
63 // Scans to specified token position. 56 // Scans to specified token position.
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 Zone* zone_; 211 Zone* zone_;
219 212
220 static KeywordTable keywords_[Token::kNumKeywords]; 213 static KeywordTable keywords_[Token::kNumKeywords];
221 static int keywords_char_offset_[kNumLowercaseChars]; 214 static int keywords_char_offset_[kNumLowercaseChars];
222 }; 215 };
223 216
224 217
225 } // namespace dart 218 } // namespace dart
226 219
227 #endif // VM_SCANNER_H_ 220 #endif // VM_SCANNER_H_
OLDNEW
« no previous file with comments | « runtime/vm/runtime_entry.cc ('k') | runtime/vm/scopes.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698