OLD | NEW |
---|---|
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 /** | 5 /** |
6 * The cached lookup-table to associate doc comments with spans. The outer map | 6 * The cached lookup-table to associate doc comments with spans. The outer map |
7 * is from filenames to doc comments in that file. The inner map maps from the | 7 * is from filenames to doc comments in that file. The inner map maps from the |
8 * token positions to doc comments. Each position is the starting offset of the | 8 * token positions to doc comments. Each position is the starting offset of the |
9 * next non-comment token *following* the doc comment. For example, the position | 9 * next non-comment token *following* the doc comment. For example, the position |
10 * for this comment would be the position of the "class" token below. | 10 * for this comment would be the position of the "class" token below. |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
95 return comments; | 95 return comments; |
96 } | 96 } |
97 | 97 |
98 /** | 98 /** |
99 * Pulls the raw text out of a doc comment (i.e. removes the comment | 99 * Pulls the raw text out of a doc comment (i.e. removes the comment |
100 * characters). | 100 * characters). |
101 */ | 101 */ |
102 stripComment(String comment) { | 102 stripComment(String comment) { |
103 StringBuffer buf = new StringBuffer(); | 103 StringBuffer buf = new StringBuffer(); |
104 | 104 |
105 for (final line in comment.split('\n')) { | 105 for (var line in comment.split('\n')) { |
Siggi Cherem (dart-lang)
2012/02/23 23:15:47
wow... if you haven't, let's make sure we add a bu
Bob Nystrom
2012/02/23 23:54:38
Done. http://code.google.com/p/dart/issues/detail?
| |
106 line = line.trim(); | 106 line = line.trim(); |
107 if (line.startsWith('/**')) line = line.substring(3); | 107 if (line.startsWith('/**')) line = line.substring(3); |
108 if (line.endsWith('*/')) line = line.substring(0, line.length - 2); | 108 if (line.endsWith('*/')) line = line.substring(0, line.length - 2); |
109 line = line.trim(); | 109 line = line.trim(); |
110 if (line.startsWith('* ')) { | 110 if (line.startsWith('* ')) { |
111 line = line.substring(2); | 111 line = line.substring(2); |
112 } else if (line.startsWith('*')) { | 112 } else if (line.startsWith('*')) { |
113 line = line.substring(1); | 113 line = line.substring(1); |
114 } | 114 } |
115 | 115 |
116 buf.add(line); | 116 buf.add(line); |
117 buf.add('\n'); | 117 buf.add('\n'); |
118 } | 118 } |
119 | 119 |
120 return buf.toString(); | 120 return buf.toString(); |
121 } | 121 } |
122 } | 122 } |
OLD | NEW |