OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 analyzer.src.dart.scanner.scanner; | 5 library analyzer.src.dart.scanner.scanner; |
6 | 6 |
7 import 'package:analyzer/dart/ast/token.dart'; | 7 import 'package:analyzer/dart/ast/token.dart'; |
| 8 import 'package:analyzer/error/error.dart'; |
| 9 import 'package:analyzer/error/listener.dart'; |
8 import 'package:analyzer/src/dart/ast/token.dart'; | 10 import 'package:analyzer/src/dart/ast/token.dart'; |
9 import 'package:analyzer/src/dart/scanner/reader.dart'; | 11 import 'package:analyzer/src/dart/scanner/reader.dart'; |
10 import 'package:analyzer/src/generated/error.dart'; | |
11 import 'package:analyzer/src/generated/java_engine.dart'; | 12 import 'package:analyzer/src/generated/java_engine.dart'; |
12 import 'package:analyzer/src/generated/source.dart'; | 13 import 'package:analyzer/src/generated/source.dart'; |
13 import 'package:charcode/ascii.dart'; | 14 import 'package:charcode/ascii.dart'; |
14 | 15 |
15 /** | 16 /** |
16 * A state in a state machine used to scan keywords. | 17 * A state in a state machine used to scan keywords. |
17 */ | 18 */ |
18 class KeywordState { | 19 class KeywordState { |
19 /** | 20 /** |
20 * An empty transition table used by leaf states. | 21 * An empty transition table used by leaf states. |
(...skipping 775 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
796 } | 797 } |
797 return next; | 798 return next; |
798 } | 799 } |
799 next = _reader.advance(); | 800 next = _reader.advance(); |
800 } | 801 } |
801 } | 802 } |
802 | 803 |
803 int _tokenizeFractionPart(int next, int start) { | 804 int _tokenizeFractionPart(int next, int start) { |
804 bool done = false; | 805 bool done = false; |
805 bool hasDigit = false; | 806 bool hasDigit = false; |
806 LOOP: while (!done) { | 807 LOOP: |
| 808 while (!done) { |
807 if ($0 <= next && next <= $9) { | 809 if ($0 <= next && next <= $9) { |
808 hasDigit = true; | 810 hasDigit = true; |
809 } else if ($e == next || $E == next) { | 811 } else if ($e == next || $E == next) { |
810 hasDigit = true; | 812 hasDigit = true; |
811 next = _tokenizeExponent(_reader.advance()); | 813 next = _tokenizeExponent(_reader.advance()); |
812 done = true; | 814 done = true; |
813 continue LOOP; | 815 continue LOOP; |
814 } else { | 816 } else { |
815 done = true; | 817 done = true; |
816 continue LOOP; | 818 continue LOOP; |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1030 next = _reader.advance(); | 1032 next = _reader.advance(); |
1031 recordStartOfLine(); | 1033 recordStartOfLine(); |
1032 } else { | 1034 } else { |
1033 next = _reader.advance(); | 1035 next = _reader.advance(); |
1034 } | 1036 } |
1035 } | 1037 } |
1036 } | 1038 } |
1037 | 1039 |
1038 int _tokenizeMultiLineRawString(int quoteChar, int start) { | 1040 int _tokenizeMultiLineRawString(int quoteChar, int start) { |
1039 int next = _reader.advance(); | 1041 int next = _reader.advance(); |
1040 outer: while (next != -1) { | 1042 outer: |
| 1043 while (next != -1) { |
1041 while (next != quoteChar) { | 1044 while (next != quoteChar) { |
1042 if (next == -1) { | 1045 if (next == -1) { |
1043 break outer; | 1046 break outer; |
1044 } else if (next == $cr) { | 1047 } else if (next == $cr) { |
1045 next = _reader.advance(); | 1048 next = _reader.advance(); |
1046 if (next == $lf) { | 1049 if (next == $lf) { |
1047 next = _reader.advance(); | 1050 next = _reader.advance(); |
1048 } | 1051 } |
1049 recordStartOfLine(); | 1052 recordStartOfLine(); |
1050 } else if (next == $lf) { | 1053 } else if (next == $lf) { |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1383 */ | 1386 */ |
1384 const ScannerErrorCode(String name, String message, [String correction]) | 1387 const ScannerErrorCode(String name, String message, [String correction]) |
1385 : super(name, message, correction); | 1388 : super(name, message, correction); |
1386 | 1389 |
1387 @override | 1390 @override |
1388 ErrorSeverity get errorSeverity => ErrorSeverity.ERROR; | 1391 ErrorSeverity get errorSeverity => ErrorSeverity.ERROR; |
1389 | 1392 |
1390 @override | 1393 @override |
1391 ErrorType get type => ErrorType.SYNTACTIC_ERROR; | 1394 ErrorType get type => ErrorType.SYNTACTIC_ERROR; |
1392 } | 1395 } |
OLD | NEW |