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

Side by Side Diff: pkg/analyzer/test/generated/parser_test.dart

Issue 1847093002: Issue 26146. Get next token after '{' or '}' while skipping interpolations. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 8 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/analyzer/lib/src/generated/parser.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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 library analyzer.test.generated.parser_test; 5 library analyzer.test.generated.parser_test;
6 6
7 import 'package:analyzer/dart/ast/ast.dart'; 7 import 'package:analyzer/dart/ast/ast.dart';
8 import 'package:analyzer/dart/ast/token.dart'; 8 import 'package:analyzer/dart/ast/token.dart';
9 import 'package:analyzer/dart/ast/visitor.dart'; 9 import 'package:analyzer/dart/ast/visitor.dart';
10 import 'package:analyzer/src/dart/ast/token.dart'; 10 import 'package:analyzer/src/dart/ast/token.dart';
(...skipping 2015 matching lines...) Expand 10 before | Expand all | Expand 10 after
2026 void test_staticTopLevelDeclaration_typedef() { 2026 void test_staticTopLevelDeclaration_typedef() {
2027 ParserTestCase.parseCompilationUnit( 2027 ParserTestCase.parseCompilationUnit(
2028 "static typedef F();", [ParserErrorCode.STATIC_TOP_LEVEL_DECLARATION]); 2028 "static typedef F();", [ParserErrorCode.STATIC_TOP_LEVEL_DECLARATION]);
2029 } 2029 }
2030 2030
2031 void test_staticTopLevelDeclaration_variable() { 2031 void test_staticTopLevelDeclaration_variable() {
2032 ParserTestCase.parseCompilationUnit( 2032 ParserTestCase.parseCompilationUnit(
2033 "static var x;", [ParserErrorCode.STATIC_TOP_LEVEL_DECLARATION]); 2033 "static var x;", [ParserErrorCode.STATIC_TOP_LEVEL_DECLARATION]);
2034 } 2034 }
2035 2035
2036 void test_string_unterminated_interpolation_block() {
2037 ParserTestCase.parseCompilationUnit(
2038 r'''
2039 m() {
2040 {
2041 '${${
2042 ''',
2043 [
2044 ScannerErrorCode.UNTERMINATED_STRING_LITERAL,
2045 ParserErrorCode.EXPECTED_TOKEN,
2046 ParserErrorCode.EXPECTED_TOKEN,
2047 ParserErrorCode.EXPECTED_TOKEN,
2048 ParserErrorCode.EXPECTED_TOKEN,
2049 ParserErrorCode.EXPECTED_TOKEN,
2050 ParserErrorCode.EXPECTED_TOKEN,
2051 ]);
2052 }
2053
2036 void test_switchHasCaseAfterDefaultCase() { 2054 void test_switchHasCaseAfterDefaultCase() {
2037 parse4( 2055 parse4(
2038 "parseSwitchStatement", 2056 "parseSwitchStatement",
2039 "switch (a) {default: return 0; case 1: return 1;}", 2057 "switch (a) {default: return 0; case 1: return 1;}",
2040 [ParserErrorCode.SWITCH_HAS_CASE_AFTER_DEFAULT_CASE]); 2058 [ParserErrorCode.SWITCH_HAS_CASE_AFTER_DEFAULT_CASE]);
2041 } 2059 }
2042 2060
2043 void test_switchHasCaseAfterDefaultCase_repeated() { 2061 void test_switchHasCaseAfterDefaultCase_repeated() {
2044 parse4("parseSwitchStatement", 2062 parse4("parseSwitchStatement",
2045 "switch (a) {default: return 0; case 1: return 1; case 2: return 2;}", [ 2063 "switch (a) {default: return 0; case 1: return 1; case 2: return 2;}", [
(...skipping 8964 matching lines...) Expand 10 before | Expand all | Expand 10 after
11010 new Scanner(null, new CharSequenceReader(source), listener); 11028 new Scanner(null, new CharSequenceReader(source), listener);
11011 Token tokenStream = scanner.tokenize(); 11029 Token tokenStream = scanner.tokenize();
11012 // 11030 //
11013 // Parse the source. 11031 // Parse the source.
11014 // 11032 //
11015 Parser parser = new Parser(null, listener); 11033 Parser parser = new Parser(null, listener);
11016 return invokeParserMethodImpl( 11034 return invokeParserMethodImpl(
11017 parser, methodName, <Object>[tokenStream], tokenStream) as Token; 11035 parser, methodName, <Object>[tokenStream], tokenStream) as Token;
11018 } 11036 }
11019 } 11037 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/generated/parser.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698