Skip to content

Commit 22f29ea

Browse files
committed
Fix to fine-tune URI link for Java COMMENT,JAVADOC,QSTRING
1 parent 07e6c35 commit 22f29ea

File tree

3 files changed

+23
-6
lines changed

3 files changed

+23
-6
lines changed

src/org/opensolaris/opengrok/analysis/java/JavaXref.lex

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
package org.opensolaris.opengrok.analysis.java;
3030

3131
import org.opensolaris.opengrok.analysis.JFlexXrefSimple;
32+
import org.opensolaris.opengrok.util.StringUtils;
3233
import org.opensolaris.opengrok.web.HtmlConsts;
3334
import org.opensolaris.opengrok.web.Util;
3435
%%
@@ -183,7 +184,7 @@ ParamName = {Identifier} | "<" {Identifier} ">"
183184
[^\n] { writeUnicodeChar(yycharat(0)); }
184185
}
185186

186-
<STRING, COMMENT, SCOMMENT, STRING, QSTRING, JAVADOC> {
187+
<STRING, COMMENT, SCOMMENT, QSTRING, JAVADOC> {
187188
{FPath}
188189
{ out.write(Util.breadcrumbPath(urlPrefix+"path=",yytext(),'/'));}
189190

@@ -197,12 +198,26 @@ ParamName = {Identifier} | "<" {Identifier} ">"
197198
out.write(path);
198199
out.write("</a>");}
199200

200-
{BrowseableURI} {
201-
appendLink(yytext(), true);
202-
}
203-
204201
{FNameChar}+ "@" {FNameChar}+ "." {FNameChar}+
205202
{
206203
writeEMailAddress(yytext());
207204
}
208205
}
206+
207+
<STRING, SCOMMENT> {
208+
{BrowseableURI} {
209+
appendLink(yytext(), true);
210+
}
211+
}
212+
213+
<COMMENT, JAVADOC> {
214+
{BrowseableURI} {
215+
appendLink(yytext(), true, StringUtils.END_C_COMMENT);
216+
}
217+
}
218+
219+
<QSTRING> {
220+
{BrowseableURI} {
221+
appendLink(yytext(), true, StringUtils.APOS_NO_BSESC);
222+
}
223+
}

test/org/opensolaris/opengrok/analysis/java/Sample.jav

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,4 @@ public class Sample {
7474
}
7575

7676
}
77+
/*http://example.com*/

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,5 +82,6 @@
8282
<a class="l" name="74" href="#74">74</a><span class='fold-space'>&nbsp;</span> &#125;
8383
</span><a class="l" name="75" href="#75">75</a><span class='fold-space'>&nbsp;</span>
8484
<a class="l" name="76" href="#76">76</a><span class='fold-space'>&nbsp;</span>&#125;
85-
<a class="l" name="77" href="#77">77</a><span class='fold-space'>&nbsp;</span></body>
85+
<a class="l" name="77" href="#77">77</a><span class='fold-space'>&nbsp;</span><span class="c">/*<a href="http://example.com">http://example.com</a>*/</span>
86+
<a class="l" name="78" href="#78">78</a><span class='fold-space'>&nbsp;</span></body>
8687
</html>

0 commit comments

Comments
 (0)