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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/scanner/parser.dart

Issue 340703003: Prevent double reporting on hex, strings, and multiline comments. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 6 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
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 part of scanner; 5 part of scanner;
6 6
7 class FormalParameterType { 7 class FormalParameterType {
8 final String type; 8 final String type;
9 const FormalParameterType(this.type); 9 const FormalParameterType(this.type);
10 bool get isRequired => this == REQUIRED; 10 bool get isRequired => this == REQUIRED;
(...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after
649 handleNoStuff(token); 649 handleNoStuff(token);
650 return token; 650 return token;
651 } 651 }
652 652
653 Token parseTopLevelMember(Token token) { 653 Token parseTopLevelMember(Token token) {
654 Token start = token; 654 Token start = token;
655 listener.beginTopLevelMember(token); 655 listener.beginTopLevelMember(token);
656 656
657 Link<Token> identifiers = findMemberName(token); 657 Link<Token> identifiers = findMemberName(token);
658 if (identifiers.isEmpty) { 658 if (identifiers.isEmpty) {
659 return listener.unexpected(start); 659 return listener.expectedDeclaration(start);
660 } 660 }
661 Token name = identifiers.head; 661 Token name = identifiers.head;
662 identifiers = identifiers.tail; 662 identifiers = identifiers.tail;
663 Token getOrSet; 663 Token getOrSet;
664 if (!identifiers.isEmpty) { 664 if (!identifiers.isEmpty) {
665 String value = identifiers.head.stringValue; 665 String value = identifiers.head.stringValue;
666 if ((identical(value, 'get')) || (identical(value, 'set'))) { 666 if ((identical(value, 'get')) || (identical(value, 'set'))) {
667 getOrSet = identifiers.head; 667 getOrSet = identifiers.head;
668 identifiers = identifiers.tail; 668 identifiers = identifiers.tail;
669 } 669 }
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
897 BeginGroupToken beginGroup = token.next; 897 BeginGroupToken beginGroup = token.next;
898 if (beginGroup.endGroup == null) { 898 if (beginGroup.endGroup == null) {
899 listener.unmatched(beginGroup); 899 listener.unmatched(beginGroup);
900 } 900 }
901 token = beginGroup.endGroup; 901 token = beginGroup.endGroup;
902 } 902 }
903 } 903 }
904 } 904 }
905 token = token.next; 905 token = token.next;
906 } 906 }
907 return listener.expectedDeclaration(start); 907 return const Link<Token>();
908 } 908 }
909 909
910 Token parseVariableInitializerOpt(Token token) { 910 Token parseVariableInitializerOpt(Token token) {
911 if (optional('=', token)) { 911 if (optional('=', token)) {
912 Token assignment = token; 912 Token assignment = token;
913 listener.beginInitializer(token); 913 listener.beginInitializer(token);
914 token = parseExpression(token.next); 914 token = parseExpression(token.next);
915 listener.endInitializer(assignment); 915 listener.endInitializer(assignment);
916 } 916 }
917 return token; 917 return token;
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
1068 token = parseMetadataStar(token); 1068 token = parseMetadataStar(token);
1069 String value = token.stringValue; 1069 String value = token.stringValue;
1070 if (isFactoryDeclaration(token)) { 1070 if (isFactoryDeclaration(token)) {
1071 return parseFactoryMethod(token); 1071 return parseFactoryMethod(token);
1072 } 1072 }
1073 Token start = token; 1073 Token start = token;
1074 listener.beginMember(token); 1074 listener.beginMember(token);
1075 1075
1076 Link<Token> identifiers = findMemberName(token); 1076 Link<Token> identifiers = findMemberName(token);
1077 if (identifiers.isEmpty) { 1077 if (identifiers.isEmpty) {
1078 return listener.unexpected(start); 1078 return listener.expectedDeclaration(start);
1079 } 1079 }
1080 Token name = identifiers.head; 1080 Token name = identifiers.head;
1081 Token afterName = name.next; 1081 Token afterName = name.next;
1082 identifiers = identifiers.tail; 1082 identifiers = identifiers.tail;
1083 if (!identifiers.isEmpty) { 1083 if (!identifiers.isEmpty) {
1084 if (optional('operator', identifiers.head)) { 1084 if (optional('operator', identifiers.head)) {
1085 name = identifiers.head; 1085 name = identifiers.head;
1086 identifiers = identifiers.tail; 1086 identifiers = identifiers.tail;
1087 } 1087 }
1088 } 1088 }
(...skipping 1356 matching lines...) Expand 10 before | Expand all | Expand 10 after
2445 } 2445 }
2446 listener.handleContinueStatement(hasTarget, continueKeyword, token); 2446 listener.handleContinueStatement(hasTarget, continueKeyword, token);
2447 return expectSemicolon(token); 2447 return expectSemicolon(token);
2448 } 2448 }
2449 2449
2450 Token parseEmptyStatement(Token token) { 2450 Token parseEmptyStatement(Token token) {
2451 listener.handleEmptyStatement(token); 2451 listener.handleEmptyStatement(token);
2452 return expectSemicolon(token); 2452 return expectSemicolon(token);
2453 } 2453 }
2454 } 2454 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698