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

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: Comments and comments Created 6 years, 4 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 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
898 BeginGroupToken beginGroup = token.next; 898 BeginGroupToken beginGroup = token.next;
899 if (beginGroup.endGroup == null) { 899 if (beginGroup.endGroup == null) {
900 listener.unmatched(beginGroup); 900 listener.unmatched(beginGroup);
901 } 901 }
902 token = beginGroup.endGroup; 902 token = beginGroup.endGroup;
903 } 903 }
904 } 904 }
905 } 905 }
906 token = token.next; 906 token = token.next;
907 } 907 }
908 return listener.expectedDeclaration(start); 908 return const Link<Token>();
909 } 909 }
910 910
911 Token parseVariableInitializerOpt(Token token) { 911 Token parseVariableInitializerOpt(Token token) {
912 if (optional('=', token)) { 912 if (optional('=', token)) {
913 Token assignment = token; 913 Token assignment = token;
914 listener.beginInitializer(token); 914 listener.beginInitializer(token);
915 token = parseExpression(token.next); 915 token = parseExpression(token.next);
916 listener.endInitializer(assignment); 916 listener.endInitializer(assignment);
917 } 917 }
918 return token; 918 return token;
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
1069 token = parseMetadataStar(token); 1069 token = parseMetadataStar(token);
1070 String value = token.stringValue; 1070 String value = token.stringValue;
1071 if (isFactoryDeclaration(token)) { 1071 if (isFactoryDeclaration(token)) {
1072 return parseFactoryMethod(token); 1072 return parseFactoryMethod(token);
1073 } 1073 }
1074 Token start = token; 1074 Token start = token;
1075 listener.beginMember(token); 1075 listener.beginMember(token);
1076 1076
1077 Link<Token> identifiers = findMemberName(token); 1077 Link<Token> identifiers = findMemberName(token);
1078 if (identifiers.isEmpty) { 1078 if (identifiers.isEmpty) {
1079 return listener.unexpected(start); 1079 return listener.expectedDeclaration(start);
1080 } 1080 }
1081 Token name = identifiers.head; 1081 Token name = identifiers.head;
1082 Token afterName = name.next; 1082 Token afterName = name.next;
1083 identifiers = identifiers.tail; 1083 identifiers = identifiers.tail;
1084 if (!identifiers.isEmpty) { 1084 if (!identifiers.isEmpty) {
1085 if (optional('operator', identifiers.head)) { 1085 if (optional('operator', identifiers.head)) {
1086 name = identifiers.head; 1086 name = identifiers.head;
1087 identifiers = identifiers.tail; 1087 identifiers = identifiers.tail;
1088 } 1088 }
1089 } 1089 }
(...skipping 1356 matching lines...) Expand 10 before | Expand all | Expand 10 after
2446 } 2446 }
2447 listener.handleContinueStatement(hasTarget, continueKeyword, token); 2447 listener.handleContinueStatement(hasTarget, continueKeyword, token);
2448 return expectSemicolon(token); 2448 return expectSemicolon(token);
2449 } 2449 }
2450 2450
2451 Token parseEmptyStatement(Token token) { 2451 Token parseEmptyStatement(Token token) {
2452 listener.handleEmptyStatement(token); 2452 listener.handleEmptyStatement(token);
2453 return expectSemicolon(token); 2453 return expectSemicolon(token);
2454 } 2454 }
2455 } 2455 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698