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

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

Issue 1536483002: Skip comments code blocks indented with 4 spaces. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years 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
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/element/element.dart'; 7 import 'package:analyzer/dart/element/element.dart';
8 import 'package:analyzer/dart/element/type.dart'; 8 import 'package:analyzer/dart/element/type.dart';
9 import 'package:analyzer/src/dart/element/element.dart'; 9 import 'package:analyzer/src/dart/element/element.dart';
10 import 'package:analyzer/src/generated/ast.dart'; 10 import 'package:analyzer/src/generated/ast.dart';
(...skipping 6746 matching lines...) Expand 10 before | Expand all | Expand 10 after
6757 reference = references[1]; 6757 reference = references[1];
6758 expect(reference, isNotNull); 6758 expect(reference, isNotNull);
6759 expect(reference.identifier, isNotNull); 6759 expect(reference.identifier, isNotNull);
6760 expect(reference.offset, 20); 6760 expect(reference.offset, 20);
6761 reference = references[2]; 6761 reference = references[2];
6762 expect(reference, isNotNull); 6762 expect(reference, isNotNull);
6763 expect(reference.identifier, isNotNull); 6763 expect(reference.identifier, isNotNull);
6764 expect(reference.offset, 35); 6764 expect(reference.offset, 35);
6765 } 6765 }
6766 6766
6767 void test_parseCommentReferences_skipCodeBlock_4spaces_block() {
6768 List<DocumentationCommentToken> tokens = <DocumentationCommentToken>[
6769 new DocumentationCommentToken(TokenType.MULTI_LINE_COMMENT,
6770 "/**\n * a[i]\n * non-code line\n */", 3)
6771 ];
6772 List<CommentReference> references =
6773 parse("parseCommentReferences", <Object>[tokens], "");
6774 expect(references, isEmpty);
6775 }
6776
6777 void test_parseCommentReferences_skipCodeBlock_4spaces_lines() {
6778 List<DocumentationCommentToken> tokens = <DocumentationCommentToken>[
6779 new DocumentationCommentToken(
6780 TokenType.SINGLE_LINE_COMMENT, "/// Code block:", 0),
6781 new DocumentationCommentToken(
6782 TokenType.SINGLE_LINE_COMMENT, "/// a[i] == b[i]", 0)
6783 ];
6784 List<CommentReference> references =
6785 parse("parseCommentReferences", <Object>[tokens], "");
6786 expect(references, isEmpty);
6787 }
6788
6767 void test_parseCommentReferences_skipCodeBlock_bracketed() { 6789 void test_parseCommentReferences_skipCodeBlock_bracketed() {
6768 List<DocumentationCommentToken> tokens = <DocumentationCommentToken>[ 6790 List<DocumentationCommentToken> tokens = <DocumentationCommentToken>[
6769 new DocumentationCommentToken( 6791 new DocumentationCommentToken(
6770 TokenType.MULTI_LINE_COMMENT, "/** [:xxx [a] yyy:] [b] zzz */", 3) 6792 TokenType.MULTI_LINE_COMMENT, "/** [:xxx [a] yyy:] [b] zzz */", 3)
6771 ]; 6793 ];
6772 List<CommentReference> references = 6794 List<CommentReference> references =
6773 parse("parseCommentReferences", <Object>[tokens], ""); 6795 parse("parseCommentReferences", <Object>[tokens], "");
6774 expect(references, hasLength(1)); 6796 expect(references, hasLength(1));
6775 CommentReference reference = references[0]; 6797 CommentReference reference = references[0];
6776 expect(reference, isNotNull); 6798 expect(reference, isNotNull);
(...skipping 4555 matching lines...) Expand 10 before | Expand all | Expand 10 after
11332 new Scanner(null, new CharSequenceReader(source), listener); 11354 new Scanner(null, new CharSequenceReader(source), listener);
11333 Token tokenStream = scanner.tokenize(); 11355 Token tokenStream = scanner.tokenize();
11334 // 11356 //
11335 // Parse the source. 11357 // Parse the source.
11336 // 11358 //
11337 Parser parser = new Parser(null, listener); 11359 Parser parser = new Parser(null, listener);
11338 return invokeParserMethodImpl( 11360 return invokeParserMethodImpl(
11339 parser, methodName, <Object>[tokenStream], tokenStream) as Token; 11361 parser, methodName, <Object>[tokenStream], tokenStream) as Token;
11340 } 11362 }
11341 } 11363 }
OLDNEW
« pkg/analyzer/lib/src/generated/parser.dart ('K') | « 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