| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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/base/errors.dart'; | 5 import 'package:front_end/src/base/errors.dart'; |
| 6 import 'package:front_end/src/base/jenkins_smi_hash.dart'; | 6 import 'package:front_end/src/base/jenkins_smi_hash.dart'; |
| 7 import 'package:front_end/src/scanner/errors.dart'; | 7 import 'package:front_end/src/scanner/errors.dart'; |
| 8 import 'package:front_end/src/scanner/reader.dart'; | 8 import 'package:front_end/src/scanner/reader.dart'; |
| 9 import 'package:front_end/src/scanner/scanner.dart'; | 9 import 'package:front_end/src/scanner/scanner.dart'; |
| 10 import 'package:front_end/src/scanner/token.dart'; | 10 import 'package:front_end/src/scanner/token.dart'; |
| (...skipping 765 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 776 var openParen = _scan('([)') as BeginToken; | 776 var openParen = _scan('([)') as BeginToken; |
| 777 var openBracket = openParen.next as BeginToken; | 777 var openBracket = openParen.next as BeginToken; |
| 778 var closeParen = openBracket.next; | 778 var closeParen = openBracket.next; |
| 779 expect(closeParen.next.type, TokenType.EOF); | 779 expect(closeParen.next.type, TokenType.EOF); |
| 780 expect(openParen.endToken, isNull); | 780 expect(openParen.endToken, isNull); |
| 781 expect(openBracket.endToken, isNull); | 781 expect(openBracket.endToken, isNull); |
| 782 } | 782 } |
| 783 | 783 |
| 784 void test_mismatched_opener_in_interpolation() { | 784 void test_mismatched_opener_in_interpolation() { |
| 785 // In an interpolation expression, analyzer considers a closing `}` to | 785 // In an interpolation expression, analyzer considers a closing `}` to |
| 786 // always matche the preceding unmatched `{`, even if there are intervening | 786 // always match the preceding unmatched `{`, even if there are intervening |
| 787 // unmatched tokens, which means that `"${({(}}"` parses as though the open | 787 // unmatched tokens, which means that `"${({(}}"` parses as though the open |
| 788 // parens are unmatched but everything else is matched. | 788 // parens are unmatched but everything else is matched. |
| 789 var stringStart = _scan(r'"${({(}}"'); | 789 var stringStart = _scan(r'"${({(}}"'); |
| 790 var interpolationStart = stringStart.next as BeginToken; | 790 var interpolationStart = stringStart.next as BeginToken; |
| 791 var openParen1 = interpolationStart.next as BeginToken; | 791 var openParen1 = interpolationStart.next as BeginToken; |
| 792 var openBrace = openParen1.next as BeginToken; | 792 var openBrace = openParen1.next as BeginToken; |
| 793 var openParen2 = openBrace.next as BeginToken; | 793 var openParen2 = openBrace.next as BeginToken; |
| 794 var closeBrace = openParen2.next; | 794 var closeBrace = openParen2.next; |
| 795 var interpolationEnd = closeBrace.next; | 795 var interpolationEnd = closeBrace.next; |
| 796 var stringEnd = interpolationEnd.next; | 796 var stringEnd = interpolationEnd.next; |
| (...skipping 715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1512 _TestScanner(CharacterReader reader, [this.listener]) : super(reader); | 1512 _TestScanner(CharacterReader reader, [this.listener]) : super(reader); |
| 1513 | 1513 |
| 1514 @override | 1514 @override |
| 1515 void reportError( | 1515 void reportError( |
| 1516 ScannerErrorCode errorCode, int offset, List<Object> arguments) { | 1516 ScannerErrorCode errorCode, int offset, List<Object> arguments) { |
| 1517 if (listener != null) { | 1517 if (listener != null) { |
| 1518 listener.errors.add(new TestError(offset, errorCode, arguments)); | 1518 listener.errors.add(new TestError(offset, errorCode, arguments)); |
| 1519 } | 1519 } |
| 1520 } | 1520 } |
| 1521 } | 1521 } |
| OLD | NEW |