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 26 matching lines...) Expand all Loading... |
37 codeExtraneousModifier, | 37 codeExtraneousModifier, |
38 codeFactoryNotSync, | 38 codeFactoryNotSync, |
39 codeFinalFieldWithoutInitializer, | 39 codeFinalFieldWithoutInitializer, |
40 codeFunctionTypeDefaultValue, | 40 codeFunctionTypeDefaultValue, |
41 codeGeneratorReturnsValue, | 41 codeGeneratorReturnsValue, |
42 codeGetterWithFormals, | 42 codeGetterWithFormals, |
43 codeInvalidAwaitFor, | 43 codeInvalidAwaitFor, |
44 codeInvalidInlineFunctionType, | 44 codeInvalidInlineFunctionType, |
45 codeInvalidSyncModifier, | 45 codeInvalidSyncModifier, |
46 codeInvalidVoid, | 46 codeInvalidVoid, |
| 47 codeMetadataTypeArguments, |
47 codeNoFormals, | 48 codeNoFormals, |
48 codeNonAsciiIdentifier, | 49 codeNonAsciiIdentifier, |
49 codeNonAsciiWhitespace, | 50 codeNonAsciiWhitespace, |
50 codeOnlyTry, | 51 codeOnlyTry, |
51 codePositionalParameterWithEquals, | 52 codePositionalParameterWithEquals, |
52 codePrivateNamedParameter, | 53 codePrivateNamedParameter, |
53 codeRequiredParameterWithDefault, | 54 codeRequiredParameterWithDefault, |
54 codeSetterNotSync, | 55 codeSetterNotSync, |
55 codeStackOverflow, | 56 codeStackOverflow, |
56 codeSuperNullAware, | 57 codeSuperNullAware, |
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
583 } | 584 } |
584 | 585 |
585 /// Parse `'@' qualified (‘.’ identifier)? (arguments)?` | 586 /// Parse `'@' qualified (‘.’ identifier)? (arguments)?` |
586 Token parseMetadata(Token token) { | 587 Token parseMetadata(Token token) { |
587 listener.beginMetadata(token); | 588 listener.beginMetadata(token); |
588 Token atToken = token; | 589 Token atToken = token; |
589 assert(optional('@', token)); | 590 assert(optional('@', token)); |
590 token = parseIdentifier(token.next, IdentifierContext.metadataReference); | 591 token = parseIdentifier(token.next, IdentifierContext.metadataReference); |
591 token = | 592 token = |
592 parseQualifiedRestOpt(token, IdentifierContext.metadataContinuation); | 593 parseQualifiedRestOpt(token, IdentifierContext.metadataContinuation); |
| 594 if (optional("<", token)) { |
| 595 reportRecoverableErrorCode(token, codeMetadataTypeArguments); |
| 596 } |
593 token = parseTypeArgumentsOpt(token); | 597 token = parseTypeArgumentsOpt(token); |
594 Token period = null; | 598 Token period = null; |
595 if (optional('.', token)) { | 599 if (optional('.', token)) { |
596 period = token; | 600 period = token; |
597 token = parseIdentifier( | 601 token = parseIdentifier( |
598 token.next, IdentifierContext.metadataContinuationAfterTypeArguments); | 602 token.next, IdentifierContext.metadataContinuationAfterTypeArguments); |
599 } | 603 } |
600 token = parseArgumentsOpt(token); | 604 token = parseArgumentsOpt(token); |
601 listener.endMetadata(atToken, period, token); | 605 listener.endMetadata(atToken, period, token); |
602 return token; | 606 return token; |
(...skipping 3423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4026 return reportUnrecoverableError( | 4030 return reportUnrecoverableError( |
4027 token, () => code.format(uri, token.charOffset, string)); | 4031 token, () => code.format(uri, token.charOffset, string)); |
4028 } | 4032 } |
4029 } | 4033 } |
4030 | 4034 |
4031 typedef FastaMessage NoArgument(Uri uri, int charOffset); | 4035 typedef FastaMessage NoArgument(Uri uri, int charOffset); |
4032 | 4036 |
4033 typedef FastaMessage TokenArgument(Uri uri, int charOffset, Token token); | 4037 typedef FastaMessage TokenArgument(Uri uri, int charOffset, Token token); |
4034 | 4038 |
4035 typedef FastaMessage StringArgument(Uri uri, int charOffset, String string); | 4039 typedef FastaMessage StringArgument(Uri uri, int charOffset, String string); |
OLD | NEW |