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 1007 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1018 listener.handleNoType(token); | 1018 listener.handleNoType(token); |
1019 } | 1019 } |
1020 listener.endTypeVariable(token, extendsOrSuper); | 1020 listener.endTypeVariable(token, extendsOrSuper); |
1021 return token; | 1021 return token; |
1022 } | 1022 } |
1023 | 1023 |
1024 /// Returns true if the stringValue of the [token] is either [value1], | 1024 /// Returns true if the stringValue of the [token] is either [value1], |
1025 /// [value2], or [value3]. | 1025 /// [value2], or [value3]. |
1026 bool isOneOf3(Token token, String value1, String value2, String value3) { | 1026 bool isOneOf3(Token token, String value1, String value2, String value3) { |
1027 String stringValue = token.stringValue; | 1027 String stringValue = token.stringValue; |
1028 return value1 == stringValue || | 1028 return identical(value1, stringValue) || |
1029 value2 == stringValue || | 1029 identical(value2, stringValue) || |
1030 value3 == stringValue; | 1030 identical(value3, stringValue); |
1031 } | 1031 } |
1032 | 1032 |
1033 /// Returns true if the stringValue of the [token] is either [value1], | 1033 /// Returns true if the stringValue of the [token] is either [value1], |
1034 /// [value2], [value3], or [value4]. | 1034 /// [value2], [value3], or [value4]. |
1035 bool isOneOf4( | 1035 bool isOneOf4( |
1036 Token token, String value1, String value2, String value3, String value4) { | 1036 Token token, String value1, String value2, String value3, String value4) { |
1037 String stringValue = token.stringValue; | 1037 String stringValue = token.stringValue; |
1038 return value1 == stringValue || | 1038 return identical(value1, stringValue) || |
1039 value2 == stringValue || | 1039 identical(value2, stringValue) || |
1040 value3 == stringValue || | 1040 identical(value3, stringValue) || |
1041 value4 == stringValue; | 1041 identical(value4, stringValue); |
1042 } | 1042 } |
1043 | 1043 |
1044 bool notEofOrValue(String value, Token token) { | 1044 bool notEofOrValue(String value, Token token) { |
1045 return !identical(token.kind, EOF_TOKEN) && | 1045 return !identical(token.kind, EOF_TOKEN) && |
1046 !identical(value, token.stringValue); | 1046 !identical(value, token.stringValue); |
1047 } | 1047 } |
1048 | 1048 |
1049 bool isGeneralizedFunctionType(Token token) { | 1049 bool isGeneralizedFunctionType(Token token) { |
1050 return optional('Function', token) && | 1050 return optional('Function', token) && |
1051 (optional('<', token.next) || optional('(', token.next)); | 1051 (optional('<', token.next) || optional('(', token.next)); |
(...skipping 2803 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 |