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' | 7 import '../fasta_codes.dart' |
8 show | 8 show |
9 FastaCode, | 9 FastaCode, |
10 FastaMessage, | 10 FastaMessage, |
(...skipping 2473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2484 | 2484 |
2485 case AsyncModifier.Async: | 2485 case AsyncModifier.Async: |
2486 reportRecoverableErrorCode(token, codeYieldNotGenerator); | 2486 reportRecoverableErrorCode(token, codeYieldNotGenerator); |
2487 return parseYieldStatement(token); | 2487 return parseYieldStatement(token); |
2488 } | 2488 } |
2489 throw "Internal error: Unknown asyncState: '$asyncState'."; | 2489 throw "Internal error: Unknown asyncState: '$asyncState'."; |
2490 } else if (identical(value, 'const')) { | 2490 } else if (identical(value, 'const')) { |
2491 return parseExpressionStatementOrConstDeclaration(token); | 2491 return parseExpressionStatementOrConstDeclaration(token); |
2492 } else if (token.isIdentifier) { | 2492 } else if (token.isIdentifier) { |
2493 return parseExpressionStatementOrDeclaration(token); | 2493 return parseExpressionStatementOrDeclaration(token); |
| 2494 } else if (identical(value, '@')) { |
| 2495 return parseVariablesDeclaration(token); |
2494 } else { | 2496 } else { |
2495 return parseExpressionStatement(token); | 2497 return parseExpressionStatement(token); |
2496 } | 2498 } |
2497 } | 2499 } |
2498 | 2500 |
2499 Token parseYieldStatement(Token token) { | 2501 Token parseYieldStatement(Token token) { |
2500 Token begin = token; | 2502 Token begin = token; |
2501 listener.beginYieldStatement(begin); | 2503 listener.beginYieldStatement(begin); |
2502 assert(identical('yield', token.stringValue)); | 2504 assert(identical('yield', token.stringValue)); |
2503 token = token.next; | 2505 token = token.next; |
(...skipping 1520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4024 return reportUnrecoverableError( | 4026 return reportUnrecoverableError( |
4025 token, () => code.format(uri, token.charOffset, string)); | 4027 token, () => code.format(uri, token.charOffset, string)); |
4026 } | 4028 } |
4027 } | 4029 } |
4028 | 4030 |
4029 typedef FastaMessage NoArgument(Uri uri, int charOffset); | 4031 typedef FastaMessage NoArgument(Uri uri, int charOffset); |
4030 | 4032 |
4031 typedef FastaMessage TokenArgument(Uri uri, int charOffset, Token token); | 4033 typedef FastaMessage TokenArgument(Uri uri, int charOffset, Token token); |
4032 | 4034 |
4033 typedef FastaMessage StringArgument(Uri uri, int charOffset, String string); | 4035 typedef FastaMessage StringArgument(Uri uri, int charOffset, String string); |
OLD | NEW |