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

Side by Side Diff: dart/lib/compiler/implementation/scanner/token.dart

Issue 11092101: Diagnose unbalanced parentheses better. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 2 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 | « dart/lib/compiler/implementation/scanner/string_scanner.dart ('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 const int EOF_TOKEN = 0; 5 const int EOF_TOKEN = 0;
6 6
7 const int KEYWORD_TOKEN = $k; 7 const int KEYWORD_TOKEN = $k;
8 const int IDENTIFIER_TOKEN = $a; 8 const int IDENTIFIER_TOKEN = $a;
9 const int BAD_INPUT_TOKEN = $X; 9 const int BAD_INPUT_TOKEN = $X;
10 const int DOUBLE_TOKEN = $d; 10 const int DOUBLE_TOKEN = $d;
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 String toString() => info.value.toString(); 132 String toString() => info.value.toString();
133 133
134 /** 134 /**
135 * The text parsed by this token. 135 * The text parsed by this token.
136 */ 136 */
137 String slowToString() => toString(); 137 String slowToString() => toString();
138 138
139 /** 139 /**
140 * The number of characters parsed by this token. 140 * The number of characters parsed by this token.
141 */ 141 */
142 int get slowCharCount => slowToString().length; 142 int get slowCharCount {
143 if (info == BAD_INPUT_INFO) {
floitsch 2012/10/12 12:23:28 add comment why this is 1.
144 return 1;
145 } else {
146 return slowToString().length;
147 }
148 }
143 } 149 }
144 150
145 /** 151 /**
146 * A keyword token. 152 * A keyword token.
147 */ 153 */
148 class KeywordToken extends Token { 154 class KeywordToken extends Token {
149 final Keyword value; 155 final Keyword value;
150 String get stringValue => value.syntax; 156 String get stringValue => value.syntax;
151 157
152 KeywordToken(Keyword value, int charOffset) 158 KeywordToken(Keyword value, int charOffset)
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 499
494 const PrecedenceInfo HEXADECIMAL_INFO = 500 const PrecedenceInfo HEXADECIMAL_INFO =
495 const PrecedenceInfo(const SourceString('hexadecimal'), 0, HEXADECIMAL_TOKEN); 501 const PrecedenceInfo(const SourceString('hexadecimal'), 0, HEXADECIMAL_TOKEN);
496 502
497 const PrecedenceInfo COMMENT_INFO = 503 const PrecedenceInfo COMMENT_INFO =
498 const PrecedenceInfo(const SourceString('comment'), 0, COMMENT_TOKEN); 504 const PrecedenceInfo(const SourceString('comment'), 0, COMMENT_TOKEN);
499 505
500 // For reporting lexical errors. 506 // For reporting lexical errors.
501 const PrecedenceInfo ERROR_INFO = 507 const PrecedenceInfo ERROR_INFO =
502 const PrecedenceInfo(const SourceString('?'), 0, UNKNOWN_TOKEN); 508 const PrecedenceInfo(const SourceString('?'), 0, UNKNOWN_TOKEN);
OLDNEW
« no previous file with comments | « dart/lib/compiler/implementation/scanner/string_scanner.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698