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 part of scanner; | 5 library dart2js.scanner; |
| 6 |
| 7 import '../io/source_file.dart' show |
| 8 SourceFile, |
| 9 Utf8BytesSourceFile; |
| 10 import '../util/characters.dart'; |
| 11 |
| 12 import 'keyword.dart' show |
| 13 Keyword, |
| 14 KeywordState; |
| 15 import 'string_scanner.dart' show |
| 16 StringScanner; |
| 17 import 'token.dart'; |
| 18 import 'utf8_bytes_scanner.dart' show |
| 19 Utf8BytesScanner; |
| 20 |
6 | 21 |
7 abstract class Scanner { | 22 abstract class Scanner { |
8 Token tokenize(); | 23 Token tokenize(); |
9 | 24 |
10 factory Scanner(SourceFile file, | 25 factory Scanner(SourceFile file, |
11 {bool includeComments: false}) { | 26 {bool includeComments: false}) { |
12 if (file is Utf8BytesSourceFile) { | 27 if (file is Utf8BytesSourceFile) { |
13 return new Utf8BytesScanner(file, includeComments: includeComments); | 28 return new Utf8BytesScanner(file, includeComments: includeComments); |
14 } else { | 29 } else { |
15 return new StringScanner(file, includeComments: includeComments); | 30 return new StringScanner(file, includeComments: includeComments); |
(...skipping 1146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1162 | 1177 |
1163 PrecedenceInfo closeBraceInfoFor(BeginGroupToken begin) { | 1178 PrecedenceInfo closeBraceInfoFor(BeginGroupToken begin) { |
1164 return const { | 1179 return const { |
1165 '(': CLOSE_PAREN_INFO, | 1180 '(': CLOSE_PAREN_INFO, |
1166 '[': CLOSE_SQUARE_BRACKET_INFO, | 1181 '[': CLOSE_SQUARE_BRACKET_INFO, |
1167 '{': CLOSE_CURLY_BRACKET_INFO, | 1182 '{': CLOSE_CURLY_BRACKET_INFO, |
1168 '<': GT_INFO, | 1183 '<': GT_INFO, |
1169 r'${': CLOSE_CURLY_BRACKET_INFO, | 1184 r'${': CLOSE_CURLY_BRACKET_INFO, |
1170 }[begin.value]; | 1185 }[begin.value]; |
1171 } | 1186 } |
OLD | NEW |