OLD | NEW |
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 6516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6527 List<CommentReference> references = | 6527 List<CommentReference> references = |
6528 parse("parseCommentReferences", <Object>[tokens], "") | 6528 parse("parseCommentReferences", <Object>[tokens], "") |
6529 as List<CommentReference>; | 6529 as List<CommentReference>; |
6530 expect(references, hasLength(1)); | 6530 expect(references, hasLength(1)); |
6531 CommentReference reference = references[0]; | 6531 CommentReference reference = references[0]; |
6532 expect(reference, isNotNull); | 6532 expect(reference, isNotNull); |
6533 expect(reference.identifier, isNotNull); | 6533 expect(reference.identifier, isNotNull); |
6534 expect(reference.offset, 16); | 6534 expect(reference.offset, 16); |
6535 } | 6535 } |
6536 | 6536 |
| 6537 void test_parseCommentReferences_skipCodeBlock_gitHub_multiLine() { |
| 6538 List<DocumentationCommentToken> tokens = <DocumentationCommentToken>[ |
| 6539 new DocumentationCommentToken( |
| 6540 TokenType.MULTI_LINE_COMMENT, |
| 6541 r''' |
| 6542 /** |
| 6543 * First. |
| 6544 * ```dart |
| 6545 * Some [int] reference. |
| 6546 * ``` |
| 6547 * Last. |
| 6548 */ |
| 6549 ''', |
| 6550 3) |
| 6551 ]; |
| 6552 List<CommentReference> references = |
| 6553 parse("parseCommentReferences", <Object>[tokens], "") |
| 6554 as List<CommentReference>; |
| 6555 expect(references, isEmpty); |
| 6556 } |
| 6557 |
| 6558 void test_parseCommentReferences_skipCodeBlock_gitHub_multiLine_lines() { |
| 6559 String commentText = r''' |
| 6560 /// First. |
| 6561 /// ```dart |
| 6562 /// Some [int] reference. |
| 6563 /// ``` |
| 6564 /// Last. |
| 6565 '''; |
| 6566 List<DocumentationCommentToken> tokens = commentText |
| 6567 .split('\n') |
| 6568 .map((line) => new DocumentationCommentToken( |
| 6569 TokenType.SINGLE_LINE_COMMENT, line, 0)) |
| 6570 .toList(); |
| 6571 List<CommentReference> references = |
| 6572 parse("parseCommentReferences", <Object>[tokens], "") |
| 6573 as List<CommentReference>; |
| 6574 expect(references, isEmpty); |
| 6575 } |
| 6576 |
6537 void test_parseCommentReferences_skipCodeBlock_gitHub_notTerminated() { | 6577 void test_parseCommentReferences_skipCodeBlock_gitHub_notTerminated() { |
6538 List<DocumentationCommentToken> tokens = <DocumentationCommentToken>[ | 6578 List<DocumentationCommentToken> tokens = <DocumentationCommentToken>[ |
6539 new DocumentationCommentToken( | 6579 new DocumentationCommentToken( |
6540 TokenType.MULTI_LINE_COMMENT, "/** `a[i] and [b] */", 0) | 6580 TokenType.MULTI_LINE_COMMENT, "/** `a[i] and [b] */", 0) |
6541 ]; | 6581 ]; |
6542 List<CommentReference> references = | 6582 List<CommentReference> references = |
6543 parse("parseCommentReferences", <Object>[tokens], "") | 6583 parse("parseCommentReferences", <Object>[tokens], "") |
6544 as List<CommentReference>; | 6584 as List<CommentReference>; |
6545 expect(references, hasLength(2)); | 6585 expect(references, hasLength(2)); |
6546 } | 6586 } |
(...skipping 4801 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11348 new Scanner(null, new CharSequenceReader(source), listener); | 11388 new Scanner(null, new CharSequenceReader(source), listener); |
11349 Token tokenStream = scanner.tokenize(); | 11389 Token tokenStream = scanner.tokenize(); |
11350 // | 11390 // |
11351 // Parse the source. | 11391 // Parse the source. |
11352 // | 11392 // |
11353 Parser parser = new Parser(null, listener); | 11393 Parser parser = new Parser(null, listener); |
11354 return invokeParserMethodImpl( | 11394 return invokeParserMethodImpl( |
11355 parser, methodName, <Object>[tokenStream], tokenStream) as Token; | 11395 parser, methodName, <Object>[tokenStream], tokenStream) as Token; |
11356 } | 11396 } |
11357 } | 11397 } |
OLD | NEW |