| OLD | NEW |
| 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 'package:front_end/src/fasta/scanner/precedence.dart'; | 5 import 'package:front_end/src/fasta/scanner/precedence.dart'; |
| 6 import 'package:front_end/src/fasta/scanner/string_scanner.dart'; | 6 import 'package:front_end/src/fasta/scanner/string_scanner.dart'; |
| 7 import 'package:front_end/src/fasta/scanner/token.dart' as fasta; | 7 import 'package:front_end/src/fasta/scanner/token.dart' as fasta; |
| 8 import 'package:front_end/src/scanner/token.dart'; | 8 import 'package:front_end/src/scanner/token.dart'; |
| 9 import 'package:test/test.dart'; | 9 import 'package:test/test.dart'; |
| 10 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 10 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 | 99 |
| 100 void assertInfo(check(String source, fasta.Token token), | 100 void assertInfo(check(String source, fasta.Token token), |
| 101 {bool includeLazyAssignmentOperators: true}) { | 101 {bool includeLazyAssignmentOperators: true}) { |
| 102 void assertLexeme(String source) { | 102 void assertLexeme(String source) { |
| 103 if (source == null || source.isEmpty) return; | 103 if (source == null || source.isEmpty) return; |
| 104 var scanner = new StringScanner(source, includeComments: true); | 104 var scanner = new StringScanner(source, includeComments: true); |
| 105 var token = scanner.tokenize(); | 105 var token = scanner.tokenize(); |
| 106 check(source, token); | 106 check(source, token); |
| 107 } | 107 } |
| 108 | 108 |
| 109 for (PrecedenceInfo info in PrecedenceInfo.all) { | 109 for (TokenType info in TokenType.all) { |
| 110 assertLexeme(info.value); | 110 assertLexeme(info.value); |
| 111 } | 111 } |
| 112 for (TokenType tt in allTokenTypes) { | 112 for (TokenType tt in allTokenTypes) { |
| 113 assertLexeme(tt.lexeme); | 113 assertLexeme(tt.lexeme); |
| 114 } | 114 } |
| 115 assertLexeme('1.0'); // DOUBLE | 115 assertLexeme('1.0'); // DOUBLE |
| 116 assertLexeme('0xA'); // HEXADECIMAL | 116 assertLexeme('0xA'); // HEXADECIMAL |
| 117 assertLexeme('1'); // INT | 117 assertLexeme('1'); // INT |
| 118 assertLexeme('var'); // KEYWORD | 118 assertLexeme('var'); // KEYWORD |
| 119 assertLexeme('#!/'); // SCRIPT_TAG | 119 assertLexeme('#!/'); // SCRIPT_TAG |
| (...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 505 assertLexeme('var', TokenType.KEYWORD); | 505 assertLexeme('var', TokenType.KEYWORD); |
| 506 assertLexeme('#!/', TokenType.SCRIPT_TAG); | 506 assertLexeme('#!/', TokenType.SCRIPT_TAG); |
| 507 assertLexeme('"foo"', TokenType.STRING); | 507 assertLexeme('"foo"', TokenType.STRING); |
| 508 | 508 |
| 509 expect(STRING_INTERPOLATION_INFO, | 509 expect(STRING_INTERPOLATION_INFO, |
| 510 same(TokenType.STRING_INTERPOLATION_EXPRESSION)); | 510 same(TokenType.STRING_INTERPOLATION_EXPRESSION)); |
| 511 expect(STRING_INTERPOLATION_IDENTIFIER_INFO, | 511 expect(STRING_INTERPOLATION_IDENTIFIER_INFO, |
| 512 same(TokenType.STRING_INTERPOLATION_IDENTIFIER)); | 512 same(TokenType.STRING_INTERPOLATION_IDENTIFIER)); |
| 513 } | 513 } |
| 514 } | 514 } |
| OLD | NEW |