OLD | NEW |
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 library fasta.parser.parser; | 5 library fasta.parser.parser; |
6 | 6 |
7 import '../fasta_codes.dart' show Code, Message, Template; | 7 import '../fasta_codes.dart' show Code, Message, Template; |
8 | 8 |
9 import '../fasta_codes.dart' as fasta; | 9 import '../fasta_codes.dart' as fasta; |
10 | 10 |
(...skipping 3957 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3968 (identical(value, 'default')) || | 3968 (identical(value, 'default')) || |
3969 ((identical(value, '}')) && (identical(token, peek)))) { | 3969 ((identical(value, '}')) && (identical(token, peek)))) { |
3970 // A label just before "}" will be handled as a statement error. | 3970 // A label just before "}" will be handled as a statement error. |
3971 break; | 3971 break; |
3972 } else { | 3972 } else { |
3973 token = parseStatement(token); | 3973 token = parseStatement(token); |
3974 } | 3974 } |
3975 statementCount++; | 3975 statementCount++; |
3976 peek = peekPastLabels(token); | 3976 peek = peekPastLabels(token); |
3977 } | 3977 } |
3978 listener.handleSwitchCase(labelCount, expressionCount, defaultKeyword, | 3978 listener.endSwitchCase(labelCount, expressionCount, defaultKeyword, |
3979 statementCount, begin, token); | 3979 statementCount, begin, token); |
3980 return token; | 3980 return token; |
3981 } | 3981 } |
3982 | 3982 |
3983 Token parseBreakStatement(Token token) { | 3983 Token parseBreakStatement(Token token) { |
3984 assert(optional('break', token)); | 3984 assert(optional('break', token)); |
3985 Token breakKeyword = token; | 3985 Token breakKeyword = token; |
3986 token = token.next; | 3986 token = token.next; |
3987 bool hasTarget = false; | 3987 bool hasTarget = false; |
3988 if (token.isIdentifier) { | 3988 if (token.isIdentifier) { |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4135 } | 4135 } |
4136 | 4136 |
4137 Token reportUnexpectedToken(Token token) { | 4137 Token reportUnexpectedToken(Token token) { |
4138 return reportUnrecoverableErrorWithToken( | 4138 return reportUnrecoverableErrorWithToken( |
4139 token, fasta.templateUnexpectedToken); | 4139 token, fasta.templateUnexpectedToken); |
4140 } | 4140 } |
4141 } | 4141 } |
4142 | 4142 |
4143 // TODO(ahe): Remove when analyzer supports generalized function syntax. | 4143 // TODO(ahe): Remove when analyzer supports generalized function syntax. |
4144 typedef _MessageWithArgument<T> = Message Function(T); | 4144 typedef _MessageWithArgument<T> = Message Function(T); |
OLD | NEW |