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

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

Issue 2842213003: new TokenType and Keyword API (Closed)
Patch Set: rebase Created 3 years, 7 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
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 787 matching lines...) Expand 10 before | Expand all | Expand 10 after
798 } 798 }
799 listener.handleNoType(token); 799 listener.handleNoType(token);
800 return token; 800 return token;
801 } 801 }
802 802
803 bool isValidTypeReference(Token token) { 803 bool isValidTypeReference(Token token) {
804 final kind = token.kind; 804 final kind = token.kind;
805 if (identical(kind, IDENTIFIER_TOKEN)) return true; 805 if (identical(kind, IDENTIFIER_TOKEN)) return true;
806 if (identical(kind, KEYWORD_TOKEN)) { 806 if (identical(kind, KEYWORD_TOKEN)) {
807 Keyword keyword = (token as KeywordToken).keyword; 807 Keyword keyword = (token as KeywordToken).keyword;
808 String value = keyword.syntax; 808 String value = keyword.lexeme;
809 return keyword.isPseudo || 809 return keyword.isPseudo ||
810 (identical(value, 'dynamic')) || 810 (identical(value, 'dynamic')) ||
811 (identical(value, 'void')); 811 (identical(value, 'void'));
812 } 812 }
813 return false; 813 return false;
814 } 814 }
815 815
816 /// Returns true if [token] matches '<' type (',' type)* '>' '(', and 816 /// Returns true if [token] matches '<' type (',' type)* '>' '(', and
817 /// otherwise returns false. The final '(' is not part of the grammar 817 /// otherwise returns false. The final '(' is not part of the grammar
818 /// construct `typeArguments`, but it is required here such that type 818 /// construct `typeArguments`, but it is required here such that type
(...skipping 3074 matching lines...) Expand 10 before | Expand all | Expand 10 after
3893 return reportUnrecoverableError( 3893 return reportUnrecoverableError(
3894 token, () => code.format(uri, token.charOffset, string)); 3894 token, () => code.format(uri, token.charOffset, string));
3895 } 3895 }
3896 } 3896 }
3897 3897
3898 typedef FastaMessage NoArgument(Uri uri, int charOffset); 3898 typedef FastaMessage NoArgument(Uri uri, int charOffset);
3899 3899
3900 typedef FastaMessage TokenArgument(Uri uri, int charOffset, Token token); 3900 typedef FastaMessage TokenArgument(Uri uri, int charOffset, Token token);
3901 3901
3902 typedef FastaMessage StringArgument(Uri uri, int charOffset, String string); 3902 typedef FastaMessage StringArgument(Uri uri, int charOffset, String string);
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/parser/element_listener.dart ('k') | pkg/front_end/lib/src/fasta/scanner/array_based_scanner.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698