Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(32)

Side by Side Diff: pkg/front_end/test/scanner_fasta_test.dart

Issue 2738693004: Parse script tags with Fasta. (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « pkg/front_end/lib/src/fasta/source/diet_listener.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/analyzer/token_utils.dart'; 5 import 'package:front_end/src/fasta/analyzer/token_utils.dart';
6 import 'package:front_end/src/fasta/scanner/error_token.dart' as fasta; 6 import 'package:front_end/src/fasta/scanner/error_token.dart' as fasta;
7 import 'package:front_end/src/fasta/scanner/keyword.dart' as fasta; 7 import 'package:front_end/src/fasta/scanner/keyword.dart' as fasta;
8 import 'package:front_end/src/fasta/scanner/string_scanner.dart' as fasta; 8 import 'package:front_end/src/fasta/scanner/string_scanner.dart' as fasta;
9 import 'package:front_end/src/fasta/scanner/token.dart' as fasta; 9 import 'package:front_end/src/fasta/scanner/token.dart' as fasta;
10 import 'package:front_end/src/fasta/scanner/token_constants.dart' as fasta; 10 import 'package:front_end/src/fasta/scanner/token_constants.dart' as fasta;
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 } 180 }
181 181
182 @override 182 @override
183 @failingTest 183 @failingTest
184 void test_mismatched_opener() { 184 void test_mismatched_opener() {
185 // TODO(paulberry,ahe): Fasta and analyzer recover this error differently. 185 // TODO(paulberry,ahe): Fasta and analyzer recover this error differently.
186 // Figure out which recovery technique we want the front end to use. 186 // Figure out which recovery technique we want the front end to use.
187 super.test_mismatched_opener(); 187 super.test_mismatched_opener();
188 } 188 }
189 189
190 @override
191 @failingTest
192 void test_scriptTag_withArgs() {
193 // TODO(paulberry,ahe): script tags are needed by analyzer.
194 super.test_scriptTag_withArgs();
195 }
196
197 void test_next_previous() { 190 void test_next_previous() {
198 const source = 'int a; /*1*/ /*2*/ /*3*/ B f(){if (a < 2) {}}'; 191 const source = 'int a; /*1*/ /*2*/ /*3*/ B f(){if (a < 2) {}}';
199 fasta.Token token = 192 fasta.Token token =
200 new fasta.StringScanner(source, includeComments: true).tokenize(); 193 new fasta.StringScanner(source, includeComments: true).tokenize();
201 while (!token.isEof) { 194 while (!token.isEof) {
202 expect(token.next.previousToken, token); 195 expect(token.next.previousToken, token);
203 fasta.Token commentToken = token.precedingComments; 196 fasta.Token commentToken = token.precedingComments;
204 while (commentToken != null) { 197 while (commentToken != null) {
205 if (commentToken.next != null) { 198 if (commentToken.next != null) {
206 expect(commentToken.next.previousToken, commentToken); 199 expect(commentToken.next.previousToken, commentToken);
207 } 200 }
208 commentToken = commentToken.next; 201 commentToken = commentToken.next;
209 } 202 }
210 token = token.next; 203 token = token.next;
211 } 204 }
212 } 205 }
213 206
214 @override 207 @override
215 @failingTest 208 @failingTest
216 void test_scriptTag_withoutSpace() {
217 // TODO(paulberry,ahe): script tags are needed by analyzer.
218 super.test_scriptTag_withoutSpace();
219 }
220
221 @override
222 @failingTest
223 void test_scriptTag_withSpace() {
224 // TODO(paulberry,ahe): script tags are needed by analyzer.
225 super.test_scriptTag_withSpace();
226 }
227
228 @override
229 @failingTest
230 void test_string_multi_unterminated() { 209 void test_string_multi_unterminated() {
231 // TODO(paulberry,ahe): bad error recovery. 210 // TODO(paulberry,ahe): bad error recovery.
232 super.test_string_multi_unterminated(); 211 super.test_string_multi_unterminated();
233 } 212 }
234 213
235 @override 214 @override
236 @failingTest 215 @failingTest
237 void test_string_multi_unterminated_interpolation_block() { 216 void test_string_multi_unterminated_interpolation_block() {
238 // TODO(paulberry,ahe): bad error recovery. 217 // TODO(paulberry,ahe): bad error recovery.
239 super.test_string_multi_unterminated_interpolation_block(); 218 super.test_string_multi_unterminated_interpolation_block();
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 final ErrorListener _listener; 475 final ErrorListener _listener;
497 476
498 ToAnalyzerTokenStreamConverter_WithListener(this._listener); 477 ToAnalyzerTokenStreamConverter_WithListener(this._listener);
499 478
500 @override 479 @override
501 void reportError( 480 void reportError(
502 ScannerErrorCode errorCode, int offset, List<Object> arguments) { 481 ScannerErrorCode errorCode, int offset, List<Object> arguments) {
503 _listener.errors.add(new TestError(offset, errorCode, arguments)); 482 _listener.errors.add(new TestError(offset, errorCode, arguments));
504 } 483 }
505 } 484 }
OLDNEW
« no previous file with comments | « pkg/front_end/lib/src/fasta/source/diet_listener.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698