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

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

Issue 9325047: Add token index position to classes and types for more accurate error reporting. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 8 years, 10 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
« no previous file with comments | « runtime/vm/runtime_entry_test.cc ('k') | runtime/vm/scopes_test.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 23 matching lines...) Expand all
34 // TokenDesc defines the kind of a token and its location in 34 // TokenDesc defines the kind of a token and its location in
35 // the source text. 35 // the source text.
36 struct TokenDescriptor { 36 struct TokenDescriptor {
37 Token::Kind kind; 37 Token::Kind kind;
38 int offset; // Offset in source string. 38 int offset; // Offset in source string.
39 int length; // Length of token in source. 39 int length; // Length of token in source.
40 SourcePosition position; // Text position in source. 40 SourcePosition position; // Text position in source.
41 String* literal; // Identifier, number or string literal. 41 String* literal; // Identifier, number or string literal.
42 }; 42 };
43 43
44 // Dummy token index reflecting an unknown source position.
45 static const intptr_t kDummyTokenIndex = 0;
46
44 // Character used to indicate a private identifier. 47 // Character used to indicate a private identifier.
45 static const char kPrivateIdentifierStart = '_'; 48 static const char kPrivateIdentifierStart = '_';
46 49
47 // Character used to separate the private identifier from the key. 50 // Character used to separate the private identifier from the key.
48 static const char kPrivateKeySeparator = '@'; 51 static const char kPrivateKeySeparator = '@';
49 52
50 typedef ZoneGrowableArray<TokenDescriptor> GrowableTokenStream; 53 typedef ZoneGrowableArray<TokenDescriptor> GrowableTokenStream;
51 54
52 // Initializes scanner to scan string source. 55 // Initializes scanner to scan string source.
53 Scanner(const String& source, const String& private_key); 56 Scanner(const String& source, const String& private_key);
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 const String& private_key_; 209 const String& private_key_;
207 210
208 SourcePosition c0_pos_; // Source position of lookahead character c0_. 211 SourcePosition c0_pos_; // Source position of lookahead character c0_.
209 KeywordTable keywords_[Token::numKeywords]; 212 KeywordTable keywords_[Token::numKeywords];
210 }; 213 };
211 214
212 215
213 } // namespace dart 216 } // namespace dart
214 217
215 #endif // VM_SCANNER_H_ 218 #endif // VM_SCANNER_H_
OLDNEW
« no previous file with comments | « runtime/vm/runtime_entry_test.cc ('k') | runtime/vm/scopes_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698