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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 codeInvalidVoid, | 44 codeInvalidVoid, |
45 codeNoFormals, | 45 codeNoFormals, |
46 codeNonAsciiIdentifier, | 46 codeNonAsciiIdentifier, |
47 codeNonAsciiWhitespace, | 47 codeNonAsciiWhitespace, |
48 codeOnlyTry, | 48 codeOnlyTry, |
49 codePositionalParameterWithEquals, | 49 codePositionalParameterWithEquals, |
50 codePrivateNamedParameter, | 50 codePrivateNamedParameter, |
51 codeRequiredParameterWithDefault, | 51 codeRequiredParameterWithDefault, |
52 codeSetterNotSync, | 52 codeSetterNotSync, |
53 codeStackOverflow, | 53 codeStackOverflow, |
| 54 codeSuperNullAware, |
54 codeTypeAfterVar, | 55 codeTypeAfterVar, |
55 codeTypeRequired, | 56 codeTypeRequired, |
56 codeUnexpectedToken, | 57 codeUnexpectedToken, |
57 codeUnmatchedToken, | 58 codeUnmatchedToken, |
58 codeUnspecified, | 59 codeUnspecified, |
59 codeUnsupportedPrefixPlus, | 60 codeUnsupportedPrefixPlus, |
60 codeUnterminatedString, | 61 codeUnterminatedString, |
61 codeYieldAsIdentifier, | 62 codeYieldAsIdentifier, |
62 codeYieldNotGenerator; | 63 codeYieldNotGenerator; |
63 | 64 |
(...skipping 2986 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3050 | 3051 |
3051 Token parseSuperExpression(Token token, IdentifierContext context) { | 3052 Token parseSuperExpression(Token token, IdentifierContext context) { |
3052 Token beginToken = token; | 3053 Token beginToken = token; |
3053 listener.handleSuperExpression(token, context); | 3054 listener.handleSuperExpression(token, context); |
3054 token = token.next; | 3055 token = token.next; |
3055 if (optional('(', token)) { | 3056 if (optional('(', token)) { |
3056 // Super constructor. | 3057 // Super constructor. |
3057 listener.handleNoTypeArguments(token); | 3058 listener.handleNoTypeArguments(token); |
3058 token = parseArguments(token); | 3059 token = parseArguments(token); |
3059 listener.endSend(beginToken, token); | 3060 listener.endSend(beginToken, token); |
| 3061 } else if (optional("?.", token)) { |
| 3062 reportRecoverableErrorCode(token, codeSuperNullAware); |
3060 } | 3063 } |
3061 return token; | 3064 return token; |
3062 } | 3065 } |
3063 | 3066 |
3064 /// '[' (expressionList ','?)? ']'. | 3067 /// '[' (expressionList ','?)? ']'. |
3065 /// | 3068 /// |
3066 /// Provide [constKeyword] if preceded by 'const', null if not. | 3069 /// Provide [constKeyword] if preceded by 'const', null if not. |
3067 /// This is a suffix parser because it is assumed that type arguments have | 3070 /// This is a suffix parser because it is assumed that type arguments have |
3068 /// been parsed, or `listener.handleNoTypeArguments(..)` has been executed. | 3071 /// been parsed, or `listener.handleNoTypeArguments(..)` has been executed. |
3069 Token parseLiteralListSuffix(Token token, Token constKeyword) { | 3072 Token parseLiteralListSuffix(Token token, Token constKeyword) { |
(...skipping 930 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4000 return reportUnrecoverableError( | 4003 return reportUnrecoverableError( |
4001 token, () => code.format(uri, token.charOffset, string)); | 4004 token, () => code.format(uri, token.charOffset, string)); |
4002 } | 4005 } |
4003 } | 4006 } |
4004 | 4007 |
4005 typedef FastaMessage NoArgument(Uri uri, int charOffset); | 4008 typedef FastaMessage NoArgument(Uri uri, int charOffset); |
4006 | 4009 |
4007 typedef FastaMessage TokenArgument(Uri uri, int charOffset, Token token); | 4010 typedef FastaMessage TokenArgument(Uri uri, int charOffset, Token token); |
4008 | 4011 |
4009 typedef FastaMessage StringArgument(Uri uri, int charOffset, String string); | 4012 typedef FastaMessage StringArgument(Uri uri, int charOffset, String string); |
OLD | NEW |