Skip to content

Commit f9ce6f6

Browse files
committed
Fix to also link URI for COMMENT,RSTRING
1 parent 5d812ae commit f9ce6f6

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

src/org/opensolaris/opengrok/analysis/rust/RustXref.lex

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
package org.opensolaris.opengrok.analysis.rust;
3131

3232
import org.opensolaris.opengrok.analysis.JFlexXrefSimple;
33+
import org.opensolaris.opengrok.util.StringUtils;
3334
import org.opensolaris.opengrok.web.HtmlConsts;
3435
import org.opensolaris.opengrok.web.Util;
3536
%%
@@ -202,11 +203,19 @@ File = [a-zA-Z]{FNameChar}* "." ([Rr][Ss] | [Cc][Oo][Nn][Ff] | [Tt][Xx][Tt] |
202203
out.write("</a>");
203204
}
204205

206+
{FNameChar}+ "@" {FNameChar}+ "." {FNameChar}+ {
207+
writeEMailAddress(yytext());
208+
}
209+
}
210+
211+
<STRING, RSTRING, SCOMMENT> {
205212
{BrowseableURI} {
206213
appendLink(yytext(), true);
207214
}
215+
}
208216

209-
{FNameChar}+ "@" {FNameChar}+ "." {FNameChar}+ {
210-
writeEMailAddress(yytext());
217+
<COMMENT> {
218+
{BrowseableURI} {
219+
appendLink(yytext(), true, StringUtils.END_C_COMMENT);
211220
}
212221
}

test/org/opensolaris/opengrok/analysis/rust/sample.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,3 +152,4 @@ mod tests {
152152
/* /* */ /** */
153153
pub mod dummy_item {} /*! */ */
154154
}
155+
/*http://example.com*/

test/org/opensolaris/opengrok/analysis/rust/sample_xref.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,5 +160,6 @@
160160
<a class="l" name="152" href="#152">152</a><span class='fold-space'>&nbsp;</span> <span class="c">/* /* */ /** */
161161
<a class="l" name="153" href="#153">153</a><span class='fold-space'>&nbsp;</span> pub mod dummy_item {} /*! */ */</span>
162162
<a class="l" name="154" href="#154">154</a><span class='fold-space'>&nbsp;</span>&#125;
163-
<a class="l" name="155" href="#155">155</a><span class='fold-space'>&nbsp;</span></body>
163+
<a class="l" name="155" href="#155">155</a><span class='fold-space'>&nbsp;</span><span class="c">/*<a href="http://example.com">http://example.com</a>*/</span>
164+
<a class="l" name="156" href="#156">156</a><span class='fold-space'>&nbsp;</span></body>
164165
</html>

0 commit comments

Comments
 (0)