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

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

Issue 560113002: Narrow String::CharAt from int32_t to uint16_t. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 3 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 | Annotate | Revision Log
« runtime/lib/string.cc ('K') | « runtime/vm/object.cc ('k') | no next file » | 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_
11 11
12 #include "vm/growable_array.h" 12 #include "vm/growable_array.h"
13 #include "vm/token.h" 13 #include "vm/token.h"
14 14
15 namespace dart { 15 namespace dart {
16 16
17 // Forward declarations. 17 // Forward declarations.
18 class Array; 18 class Array;
19 class Library; 19 class Library;
20 class RawString; 20 class RawString;
21 class ScanContext; 21 class ScanContext;
22 class String; 22 class String;
23 23
24 // A call to Scan() scans the source one token at at time. 24 // A call to Scan() scans the source one token at at time.
25 // The scanned token is returned by cur_token(). 25 // The scanned token is returned by cur_token().
26 // GetStream() scans the entire source text and returns a stream of tokens. 26 // GetStream() scans the entire source text and returns a stream of tokens.
27 class Scanner : ValueObject { 27 class Scanner : ValueObject {
28 public: 28 public:
29 typedef int32_t (*CharAtFunc)(const String& str, intptr_t index); 29 typedef uint16_t (*CharAtFunc)(const String& str, intptr_t index);
30 30
31 // SourcePosition describes a text location in user friendly 31 // SourcePosition describes a text location in user friendly
32 // terms of line number and column. 32 // terms of line number and column.
33 struct SourcePosition { 33 struct SourcePosition {
34 int line; 34 int line;
35 int column; 35 int column;
36 }; 36 };
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.
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 Isolate* isolate_; 214 Isolate* isolate_;
215 215
216 static KeywordTable keywords_[Token::kNumKeywords]; 216 static KeywordTable keywords_[Token::kNumKeywords];
217 static int keywords_char_offset_[kNumLowercaseChars]; 217 static int keywords_char_offset_[kNumLowercaseChars];
218 }; 218 };
219 219
220 220
221 } // namespace dart 221 } // namespace dart
222 222
223 #endif // VM_SCANNER_H_ 223 #endif // VM_SCANNER_H_
OLDNEW
« runtime/lib/string.cc ('K') | « runtime/vm/object.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698