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

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

Issue 2710973002: Revert "Add support for the new function-type syntax." (Closed)
Patch Set: Created 3 years, 10 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.scanner.abstract_scanner; 5 library fasta.scanner.abstract_scanner;
6 6
7 import '../scanner.dart' show 7 import '../scanner.dart' show
8 ErrorToken, 8 ErrorToken,
9 Scanner, 9 Scanner,
10 buildUnexpectedCharacterToken; 10 buildUnexpectedCharacterToken;
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 if ($a <= next && next <= $z) { 234 if ($a <= next && next <= $z) {
235 if (identical($r, next)) { 235 if (identical($r, next)) {
236 return tokenizeRawStringKeywordOrIdentifier(next); 236 return tokenizeRawStringKeywordOrIdentifier(next);
237 } 237 }
238 return tokenizeKeywordOrIdentifier(next, true); 238 return tokenizeKeywordOrIdentifier(next, true);
239 } 239 }
240 240
241 if (($A <= next && next <= $Z) || 241 if (($A <= next && next <= $Z) ||
242 identical(next, $_) || 242 identical(next, $_) ||
243 identical(next, $$)) { 243 identical(next, $$)) {
244 return tokenizeKeywordOrIdentifier(next, true); 244 return tokenizeIdentifier(next, scanOffset, true);
245 } 245 }
246 246
247 if (identical(next, $LT)) { 247 if (identical(next, $LT)) {
248 return tokenizeLessThan(next); 248 return tokenizeLessThan(next);
249 } 249 }
250 250
251 if (identical(next, $GT)) { 251 if (identical(next, $GT)) {
252 return tokenizeGreaterThan(next); 252 return tokenizeGreaterThan(next);
253 } 253 }
254 254
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after
801 int start = scanOffset; 801 int start = scanOffset;
802 next = advance(); 802 next = advance();
803 return tokenizeString(next, start, true); 803 return tokenizeString(next, start, true);
804 } 804 }
805 return tokenizeKeywordOrIdentifier(next, true); 805 return tokenizeKeywordOrIdentifier(next, true);
806 } 806 }
807 807
808 int tokenizeKeywordOrIdentifier(int next, bool allowDollar) { 808 int tokenizeKeywordOrIdentifier(int next, bool allowDollar) {
809 KeywordState state = KeywordState.KEYWORD_STATE; 809 KeywordState state = KeywordState.KEYWORD_STATE;
810 int start = scanOffset; 810 int start = scanOffset;
811 // We allow a leading capital character.
812 if ($A <= next && next <= $Z) {
813 state = state.nextCapital(next);
814 next = advance();
815 } else if ($a <= next && next <= $z){
816 // Do the first next call outside the loop to avoid an additional test
817 // and to make the loop monomorphic.
818 state = state.next(next);
819 next = advance();
820 }
821 while (state != null && $a <= next && next <= $z) { 811 while (state != null && $a <= next && next <= $z) {
822 state = state.next(next); 812 state = state.next(next);
823 next = advance(); 813 next = advance();
824 } 814 }
825 if (state == null || state.keyword == null) { 815 if (state == null || state.keyword == null) {
826 return tokenizeIdentifier(next, start, allowDollar); 816 return tokenizeIdentifier(next, start, allowDollar);
827 } 817 }
828 if (($A <= next && next <= $Z) || 818 if (($A <= next && next <= $Z) ||
829 ($0 <= next && next <= $9) || 819 ($0 <= next && next <= $9) ||
830 identical(next, $_) || 820 identical(next, $_) ||
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
948 } 938 }
949 if (identical(next, $EOF)) return next; 939 if (identical(next, $EOF)) return next;
950 next = advance(); // Move past the $STX. 940 next = advance(); // Move past the $STX.
951 beginToken(); // The string interpolation suffix starts here. 941 beginToken(); // The string interpolation suffix starts here.
952 return next; 942 return next;
953 } 943 }
954 944
955 int tokenizeInterpolatedIdentifier(int next) { 945 int tokenizeInterpolatedIdentifier(int next) {
956 appendPrecedenceToken(STRING_INTERPOLATION_IDENTIFIER_INFO); 946 appendPrecedenceToken(STRING_INTERPOLATION_IDENTIFIER_INFO);
957 947
958 if ($a <= next && next <= $z || 948 if ($a <= next && next <= $z) {
959 $A <= next && next <= $Z ||
960 identical(next, $_)) {
961 beginToken(); // The identifier starts here. 949 beginToken(); // The identifier starts here.
962 next = tokenizeKeywordOrIdentifier(next, false); 950 next = tokenizeKeywordOrIdentifier(next, false);
951 } else if (($A <= next && next <= $Z) || identical(next, $_)) {
952 beginToken(); // The identifier starts here.
953 next = tokenizeIdentifier(next, scanOffset, false);
963 } else { 954 } else {
964 unterminated(r'$', shouldAdvance: false); 955 unterminated(r'$', shouldAdvance: false);
965 } 956 }
966 beginToken(); // The string interpolation suffix starts here. 957 beginToken(); // The string interpolation suffix starts here.
967 return next; 958 return next;
968 } 959 }
969 960
970 int tokenizeSingleLineRawString(int next, int quoteChar, int start) { 961 int tokenizeSingleLineRawString(int next, int quoteChar, int start) {
971 bool asciiOnly = true; 962 bool asciiOnly = true;
972 while (next != $EOF) { 963 while (next != $EOF) {
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
1167 1158
1168 PrecedenceInfo closeBraceInfoFor(BeginGroupToken begin) { 1159 PrecedenceInfo closeBraceInfoFor(BeginGroupToken begin) {
1169 return const { 1160 return const {
1170 '(': CLOSE_PAREN_INFO, 1161 '(': CLOSE_PAREN_INFO,
1171 '[': CLOSE_SQUARE_BRACKET_INFO, 1162 '[': CLOSE_SQUARE_BRACKET_INFO,
1172 '{': CLOSE_CURLY_BRACKET_INFO, 1163 '{': CLOSE_CURLY_BRACKET_INFO,
1173 '<': GT_INFO, 1164 '<': GT_INFO,
1174 r'${': CLOSE_CURLY_BRACKET_INFO, 1165 r'${': CLOSE_CURLY_BRACKET_INFO,
1175 }[begin.value]; 1166 }[begin.value];
1176 } 1167 }
OLDNEW
« no previous file with comments | « pkg/front_end/lib/src/fasta/parser/parser.dart ('k') | pkg/front_end/lib/src/fasta/scanner/keyword.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698