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

Side by Side Diff: pkg/front_end/lib/src/fasta/parser/parser.dart

Issue 2802693004: Handle const list and map literals. (Closed)
Patch Set: Created 3 years, 8 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
« no previous file with comments | « pkg/front_end/lib/src/fasta/parser/listener.dart ('k') | tests/co19/co19-kernel.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 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 3075 matching lines...) Expand 10 before | Expand all | Expand 10 after
3086 listener.endNewExpression(newKeyword); 3086 listener.endNewExpression(newKeyword);
3087 return token; 3087 return token;
3088 } 3088 }
3089 3089
3090 Token parseConstExpression(Token token) { 3090 Token parseConstExpression(Token token) {
3091 Token constKeyword = token; 3091 Token constKeyword = token;
3092 token = expect('const', token); 3092 token = expect('const', token);
3093 token = _injectGenericCommentTypeList(token); 3093 token = _injectGenericCommentTypeList(token);
3094 final String value = token.stringValue; 3094 final String value = token.stringValue;
3095 if ((identical(value, '[')) || (identical(value, '[]'))) { 3095 if ((identical(value, '[')) || (identical(value, '[]'))) {
3096 listener.beginConstLiteral(token);
3096 listener.handleNoTypeArguments(token); 3097 listener.handleNoTypeArguments(token);
3097 return parseLiteralListSuffix(token, constKeyword); 3098 token = parseLiteralListSuffix(token, constKeyword);
3099 listener.endConstLiteral(token);
3100 return token;
3098 } 3101 }
3099 if (identical(value, '{')) { 3102 if (identical(value, '{')) {
3103 listener.beginConstLiteral(token);
3100 listener.handleNoTypeArguments(token); 3104 listener.handleNoTypeArguments(token);
3101 return parseLiteralMapSuffix(token, constKeyword); 3105 token = parseLiteralMapSuffix(token, constKeyword);
3106 listener.endConstLiteral(token);
3107 return token;
3102 } 3108 }
3103 if (identical(value, '<')) { 3109 if (identical(value, '<')) {
3104 return parseLiteralListOrMapOrFunction(token, constKeyword); 3110 listener.beginConstLiteral(token);
3111 token = parseLiteralListOrMapOrFunction(token, constKeyword);
3112 listener.endConstLiteral(token);
3113 return token;
3105 } 3114 }
3106 listener.beginConstExpression(constKeyword); 3115 listener.beginConstExpression(constKeyword);
3107 token = parseConstructorReference(token); 3116 token = parseConstructorReference(token);
3108 token = parseRequiredArguments(token); 3117 token = parseRequiredArguments(token);
3109 listener.endConstExpression(constKeyword); 3118 listener.endConstExpression(constKeyword);
3110 return token; 3119 return token;
3111 } 3120 }
3112 3121
3113 Token parseLiteralInt(Token token) { 3122 Token parseLiteralInt(Token token) {
3114 listener.handleLiteralInt(token); 3123 listener.handleLiteralInt(token);
(...skipping 740 matching lines...) Expand 10 before | Expand all | Expand 10 after
3855 previous.setNext(firstToken); 3864 previous.setNext(firstToken);
3856 beforeToken = firstToken; 3865 beforeToken = firstToken;
3857 } 3866 }
3858 } 3867 }
3859 3868
3860 typedef FastaMessage NoArgument(Uri uri, int charOffset); 3869 typedef FastaMessage NoArgument(Uri uri, int charOffset);
3861 3870
3862 typedef FastaMessage TokenArgument(Uri uri, int charOffset, Token token); 3871 typedef FastaMessage TokenArgument(Uri uri, int charOffset, Token token);
3863 3872
3864 typedef FastaMessage StringArgument(Uri uri, int charOffset, String string); 3873 typedef FastaMessage StringArgument(Uri uri, int charOffset, String string);
OLDNEW
« no previous file with comments | « pkg/front_end/lib/src/fasta/parser/listener.dart ('k') | tests/co19/co19-kernel.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698