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 import 'dart:utf'; | 5 import 'dart:utf'; |
6 import '../../../sdk/lib/_internal/compiler/implementation/scanner/scannerlib.da rt'; | 6 import '../../../sdk/lib/_internal/compiler/implementation/scanner/scannerlib.da rt'; |
7 import '../../../sdk/lib/_internal/compiler/implementation/scanner/scanner_imple mentation.dart'; | 7 import '../../../sdk/lib/_internal/compiler/implementation/scanner/scanner_imple mentation.dart'; |
8 import '../../../sdk/lib/_internal/compiler/implementation/util/characters.dart' ; | 8 import '../../../sdk/lib/_internal/compiler/implementation/util/characters.dart' ; |
9 part '../../../sdk/lib/_internal/compiler/implementation/scanner/byte_strings.da rt'; | 9 part '../../../sdk/lib/_internal/compiler/implementation/scanner/byte_strings.da rt'; |
10 part '../../../sdk/lib/_internal/compiler/implementation/scanner/byte_array_scan ner.dart'; | 10 part '../../../sdk/lib/_internal/compiler/implementation/scanner/byte_array_scan ner.dart'; |
11 | 11 |
12 Token scan(List<int> bytes) => new ByteArrayScanner(bytes).tokenize(); | 12 Token scan(List<int> bytes) => new ByteArrayScanner(bytes).tokenize(); |
13 | 13 |
14 bool isRunningOnJavaScript() => 1 === 1.0; | 14 bool isRunningOnJavaScript() => 1 == 1.0; |
Lasse Reichstein Nielsen
2012/11/12 13:10:41
This is true on the VM too, you really do need the
floitsch
2012/11/12 22:18:43
argh.
done.
| |
15 | 15 |
16 main() { | 16 main() { |
17 // Google favorite: "Îñţérñåţîöñåļîžåţîờñ". | 17 // Google favorite: "Îñţérñåţîöñåļîžåţîờñ". |
18 Token token = scan([0xc3, 0x8e, 0xc3, 0xb1, 0xc5, 0xa3, 0xc3, 0xa9, 0x72, | 18 Token token = scan([0xc3, 0x8e, 0xc3, 0xb1, 0xc5, 0xa3, 0xc3, 0xa9, 0x72, |
19 0xc3, 0xb1, 0xc3, 0xa5, 0xc5, 0xa3, 0xc3, 0xae, 0xc3, | 19 0xc3, 0xb1, 0xc3, 0xa5, 0xc5, 0xa3, 0xc3, 0xae, 0xc3, |
20 0xb6, 0xc3, 0xb1, 0xc3, 0xa5, 0xc4, 0xbc, 0xc3, 0xae, | 20 0xb6, 0xc3, 0xb1, 0xc3, 0xa5, 0xc4, 0xbc, 0xc3, 0xae, |
21 0xc5, 0xbe, 0xc3, 0xa5, 0xc5, 0xa3, 0xc3, 0xae, 0xe1, | 21 0xc5, 0xbe, 0xc3, 0xa5, 0xc5, 0xa3, 0xc3, 0xae, 0xe1, |
22 0xbb, 0x9d, 0xc3, 0xb1, $EOF]); | 22 0xbb, 0x9d, 0xc3, 0xb1, $EOF]); |
23 Expect.stringEquals("Îñţérñåţîöñåļîžåţîờñ", token.value.slowToString()); | 23 Expect.stringEquals("Îñţérñåţîöñåļîžåţîờñ", token.value.slowToString()); |
24 | 24 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
56 // "#!" | 56 // "#!" |
57 token = scan([0x23, 0x21, $EOF]); | 57 token = scan([0x23, 0x21, $EOF]); |
58 Expect.equals(token.info, EOF_INFO); // Treated as a comment. | 58 Expect.equals(token.info, EOF_INFO); // Treated as a comment. |
59 | 59 |
60 // Regression test for issue 1761. | 60 // Regression test for issue 1761. |
61 // "#! Hello, World!" | 61 // "#! Hello, World!" |
62 token = scan([0x23, 0x21, 0x20, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x2c, 0x20, | 62 token = scan([0x23, 0x21, 0x20, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x2c, 0x20, |
63 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x21, $EOF]); | 63 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x21, $EOF]); |
64 Expect.equals(token.info, EOF_INFO); // Treated as a comment. | 64 Expect.equals(token.info, EOF_INFO); // Treated as a comment. |
65 } | 65 } |
OLD | NEW |