| 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 dart2js.scanner; | 5 library dart2js.scanner; |
| 6 | 6 |
| 7 import '../io/source_file.dart' show SourceFile, Utf8BytesSourceFile; | 7 import '../io/source_file.dart' show SourceFile, Utf8BytesSourceFile; |
| 8 import '../tokens/keyword.dart' show Keyword, KeywordState; | 8 import '../tokens/keyword.dart' show Keyword, KeywordState; |
| 9 import '../tokens/precedence.dart'; | 9 import '../tokens/precedence.dart'; |
| 10 import '../tokens/precedence_constants.dart'; | 10 import '../tokens/precedence_constants.dart'; |
| (...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 677 return select($PERIOD, PERIOD_PERIOD_PERIOD_INFO, PERIOD_PERIOD_INFO); | 677 return select($PERIOD, PERIOD_PERIOD_PERIOD_INFO, PERIOD_PERIOD_INFO); |
| 678 } else { | 678 } else { |
| 679 appendPrecedenceToken(PERIOD_INFO); | 679 appendPrecedenceToken(PERIOD_INFO); |
| 680 return next; | 680 return next; |
| 681 } | 681 } |
| 682 } | 682 } |
| 683 | 683 |
| 684 int tokenizeFractionPart(int next, int start) { | 684 int tokenizeFractionPart(int next, int start) { |
| 685 bool done = false; | 685 bool done = false; |
| 686 bool hasDigit = false; | 686 bool hasDigit = false; |
| 687 LOOP: while (!done) { | 687 LOOP: |
| 688 while (!done) { |
| 688 if ($0 <= next && next <= $9) { | 689 if ($0 <= next && next <= $9) { |
| 689 hasDigit = true; | 690 hasDigit = true; |
| 690 } else if (identical($e, next) || identical($E, next)) { | 691 } else if (identical($e, next) || identical($E, next)) { |
| 691 hasDigit = true; | 692 hasDigit = true; |
| 692 next = advance(); | 693 next = advance(); |
| 693 if (identical(next, $PLUS) || identical(next, $MINUS)) { | 694 if (identical(next, $PLUS) || identical(next, $MINUS)) { |
| 694 next = advance(); | 695 next = advance(); |
| 695 } | 696 } |
| 696 bool hasExponentDigits = false; | 697 bool hasExponentDigits = false; |
| 697 while (true) { | 698 while (true) { |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 995 } | 996 } |
| 996 if (!asciiOnly) handleUnicode(start); | 997 if (!asciiOnly) handleUnicode(start); |
| 997 return unterminatedRawString(quoteChar); | 998 return unterminatedRawString(quoteChar); |
| 998 } | 999 } |
| 999 | 1000 |
| 1000 int tokenizeMultiLineRawString(int quoteChar, int start) { | 1001 int tokenizeMultiLineRawString(int quoteChar, int start) { |
| 1001 bool asciiOnlyString = true; | 1002 bool asciiOnlyString = true; |
| 1002 bool asciiOnlyLine = true; | 1003 bool asciiOnlyLine = true; |
| 1003 int unicodeStart = start; | 1004 int unicodeStart = start; |
| 1004 int next = advance(); // Advance past the (last) quote (of three). | 1005 int next = advance(); // Advance past the (last) quote (of three). |
| 1005 outer: while (!identical(next, $EOF)) { | 1006 outer: |
| 1007 while (!identical(next, $EOF)) { |
| 1006 while (!identical(next, quoteChar)) { | 1008 while (!identical(next, quoteChar)) { |
| 1007 if (identical(next, $LF)) { | 1009 if (identical(next, $LF)) { |
| 1008 if (!asciiOnlyLine) { | 1010 if (!asciiOnlyLine) { |
| 1009 // Synchronize the string offset in the utf8 scanner. | 1011 // Synchronize the string offset in the utf8 scanner. |
| 1010 handleUnicode(unicodeStart); | 1012 handleUnicode(unicodeStart); |
| 1011 asciiOnlyLine = true; | 1013 asciiOnlyLine = true; |
| 1012 unicodeStart = scanOffset; | 1014 unicodeStart = scanOffset; |
| 1013 } | 1015 } |
| 1014 lineFeedInMultiline(); | 1016 lineFeedInMultiline(); |
| 1015 } else if (next > 127) { | 1017 } else if (next > 127) { |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1176 | 1178 |
| 1177 PrecedenceInfo closeBraceInfoFor(BeginGroupToken begin) { | 1179 PrecedenceInfo closeBraceInfoFor(BeginGroupToken begin) { |
| 1178 return const { | 1180 return const { |
| 1179 '(': CLOSE_PAREN_INFO, | 1181 '(': CLOSE_PAREN_INFO, |
| 1180 '[': CLOSE_SQUARE_BRACKET_INFO, | 1182 '[': CLOSE_SQUARE_BRACKET_INFO, |
| 1181 '{': CLOSE_CURLY_BRACKET_INFO, | 1183 '{': CLOSE_CURLY_BRACKET_INFO, |
| 1182 '<': GT_INFO, | 1184 '<': GT_INFO, |
| 1183 r'${': CLOSE_CURLY_BRACKET_INFO, | 1185 r'${': CLOSE_CURLY_BRACKET_INFO, |
| 1184 }[begin.value]; | 1186 }[begin.value]; |
| 1185 } | 1187 } |
| OLD | NEW |