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 3361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3372 } | 3372 } |
3373 return parseForRest(forKeyword, leftParenthesis, token); | 3373 return parseForRest(forKeyword, leftParenthesis, token); |
3374 } | 3374 } |
3375 } | 3375 } |
3376 | 3376 |
3377 Token parseVariablesDeclarationOrExpressionOpt(Token token) { | 3377 Token parseVariablesDeclarationOrExpressionOpt(Token token) { |
3378 final String value = token.stringValue; | 3378 final String value = token.stringValue; |
3379 if (identical(value, ';')) { | 3379 if (identical(value, ';')) { |
3380 listener.handleNoExpression(token); | 3380 listener.handleNoExpression(token); |
3381 return token; | 3381 return token; |
3382 } else if (isOneOf3(token, 'var', 'final', 'const')) { | 3382 } else if (isOneOf4(token, '@', 'var', 'final', 'const')) { |
3383 return parseVariablesDeclarationNoSemicolon(token); | 3383 return parseVariablesDeclarationNoSemicolon(token); |
3384 } | 3384 } |
3385 Token identifier = peekIdentifierAfterType(token); | 3385 Token identifier = peekIdentifierAfterType(token); |
3386 if (identifier != null) { | 3386 if (identifier != null) { |
3387 assert(identifier.isIdentifier()); | 3387 assert(identifier.isIdentifier()); |
3388 if (isOneOf4(identifier.next, '=', ';', ',', 'in')) { | 3388 if (isOneOf4(identifier.next, '=', ';', ',', 'in')) { |
3389 return parseVariablesDeclarationNoSemicolon(token); | 3389 return parseVariablesDeclarationNoSemicolon(token); |
3390 } | 3390 } |
3391 } | 3391 } |
3392 return parseExpression(token); | 3392 return parseExpression(token); |
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3855 previous.setNext(firstToken); | 3855 previous.setNext(firstToken); |
3856 beforeToken = firstToken; | 3856 beforeToken = firstToken; |
3857 } | 3857 } |
3858 } | 3858 } |
3859 | 3859 |
3860 typedef FastaMessage NoArgument(Uri uri, int charOffset); | 3860 typedef FastaMessage NoArgument(Uri uri, int charOffset); |
3861 | 3861 |
3862 typedef FastaMessage TokenArgument(Uri uri, int charOffset, Token token); | 3862 typedef FastaMessage TokenArgument(Uri uri, int charOffset, Token token); |
3863 | 3863 |
3864 typedef FastaMessage StringArgument(Uri uri, int charOffset, String string); | 3864 typedef FastaMessage StringArgument(Uri uri, int charOffset, String string); |
OLD | NEW |