| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 part of dartdoc; | 5 part of dartdoc; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * The cached lookup-table to associate doc comments with spans. The outer map | 8 * The cached lookup-table to associate doc comments with spans. The outer map |
| 9 * is from filenames to doc comments in that file. The inner map maps from the | 9 * is from filenames to doc comments in that file. The inner map maps from the |
| 10 * token positions to doc comments. Each position is the starting offset of the | 10 * token positions to doc comments. Each position is the starting offset of the |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 if (text.startsWith('/**')) { | 71 if (text.startsWith('/**')) { |
| 72 // Remember that we've encountered a doc comment. | 72 // Remember that we've encountered a doc comment. |
| 73 lastComment = stripComment(token.slowToString()); | 73 lastComment = stripComment(token.slowToString()); |
| 74 } else if (text.startsWith('///')) { | 74 } else if (text.startsWith('///')) { |
| 75 var line = text.substring(3); | 75 var line = text.substring(3); |
| 76 // Allow a leading space. | 76 // Allow a leading space. |
| 77 if (line.startsWith(' ')) line = line.substring(1); | 77 if (line.startsWith(' ')) line = line.substring(1); |
| 78 if (lastComment == null) { | 78 if (lastComment == null) { |
| 79 lastComment = line; | 79 lastComment = line; |
| 80 } else { | 80 } else { |
| 81 lastComment = '$lastComment$line'; | 81 lastComment = '$lastComment\n$line'; |
| 82 } | 82 } |
| 83 } | 83 } |
| 84 } else if (token.kind == dart2js.HASH_TOKEN) { | 84 } else if (token.kind == dart2js.HASH_TOKEN) { |
| 85 // Look for `library` to find the library comment. | 85 // Look for `library` to find the library comment. |
| 86 final next = token.next; | 86 final next = token.next; |
| 87 if ((lastComment != null) && (next.stringValue == 'library')) { | 87 if ((lastComment != null) && (next.stringValue == 'library')) { |
| 88 _libraryComments[source.sourceUri.toString()] = lastComment; | 88 _libraryComments[source.sourceUri.toString()] = lastComment; |
| 89 lastComment = null; | 89 lastComment = null; |
| 90 } | 90 } |
| 91 } else if (lastComment != null) { | 91 } else if (lastComment != null) { |
| (...skipping 28 matching lines...) Expand all Loading... |
| 120 line = line.substring(1); | 120 line = line.substring(1); |
| 121 } | 121 } |
| 122 | 122 |
| 123 buf.add(line); | 123 buf.add(line); |
| 124 buf.add('\n'); | 124 buf.add('\n'); |
| 125 } | 125 } |
| 126 | 126 |
| 127 return buf.toString(); | 127 return buf.toString(); |
| 128 } | 128 } |
| 129 } | 129 } |
| OLD | NEW |