Skip to content

Commit f16319a

Browse files
committed
Fix to fine-tune URI link for Golang COMMENT,QSTRING
1 parent 7a5b489 commit f16319a

File tree

4 files changed

+24
-4
lines changed

4 files changed

+24
-4
lines changed

src/org/opensolaris/opengrok/analysis/golang/GolangSymbolTokenizer.lex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@
2727
*/
2828

2929
package org.opensolaris.opengrok.analysis.golang;
30+
3031
import org.opensolaris.opengrok.analysis.JFlexTokenizer;
3132

3233
/**
3334
* @author Patrick Lundquist
3435
*/
35-
3636
%%
3737
%public
3838
%class GolangSymbolTokenizer

src/org/opensolaris/opengrok/analysis/golang/GolangXref.lex

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,15 @@
2727
*/
2828

2929
package org.opensolaris.opengrok.analysis.golang;
30+
3031
import org.opensolaris.opengrok.analysis.JFlexXrefSimple;
32+
import org.opensolaris.opengrok.util.StringUtils;
3133
import org.opensolaris.opengrok.web.HtmlConsts;
3234
import org.opensolaris.opengrok.web.Util;
3335

3436
/**
3537
* @author Patrick Lundquist
3638
*/
37-
3839
%%
3940
%public
4041
%class GolangXref
@@ -152,8 +153,23 @@ File = [a-zA-Z]{FNameChar}* "." ([Gg][Oo] | [Tt][Xx][Tt] | [Hh][Tt][Mm][Ll]? |
152153
out.write(path);
153154
out.write("</a>");
154155
}
156+
{FNameChar}+ "@" {FNameChar}+ "." {FNameChar}+ { writeEMailAddress(yytext()); }
157+
}
158+
159+
<STRING, SCOMMENT> {
155160
{BrowseableURI} {
156161
appendLink(yytext(), true);
157162
}
158-
{FNameChar}+ "@" {FNameChar}+ "." {FNameChar}+ { writeEMailAddress(yytext()); }
163+
}
164+
165+
<COMMENT> {
166+
{BrowseableURI} {
167+
appendLink(yytext(), true, StringUtils.END_C_COMMENT);
168+
}
169+
}
170+
171+
<QSTRING> {
172+
{BrowseableURI} {
173+
appendLink(yytext(), true, StringUtils.APOS_NO_BSESC);
174+
}
159175
}

test/org/opensolaris/opengrok/analysis/golang/sample.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,3 +137,5 @@ func (r *Reader) readFromCommand(shell string, cmd string) bool {
137137
r.feed(out)
138138
return listCommand.Wait() == nil
139139
}
140+
/*http://example.com*/
141+
import ('http://example.com')

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,5 +145,7 @@
145145
<a class="l" name="137" href="#137">137</a> <a href="/source/s?defs=r" class="intelliWindow-symbol" data-definition-place="undefined-in-file">r</a>.<a class="d intelliWindow-symbol" href="#feed" data-definition-place="defined-in-file">feed</a>(<a href="/source/s?defs=out" class="intelliWindow-symbol" data-definition-place="undefined-in-file">out</a>)
146146
<a class="l" name="138" href="#138">138</a> <b>return</b> <a href="/source/s?defs=listCommand" class="intelliWindow-symbol" data-definition-place="undefined-in-file">listCommand</a>.<a href="/source/s?defs=Wait" class="intelliWindow-symbol" data-definition-place="undefined-in-file">Wait</a>() == <b>nil</b>
147147
<a class="l" name="139" href="#139">139</a>}
148-
<a class="hl" name="140" href="#140">140</a></body>
148+
<a class="hl" name="140" href="#140">140</a><span class="c">/*<a href="http://example.com">http://example.com</a>*/</span>
149+
<a class="l" name="141" href="#141">141</a><b>import</b> (<span class="s">&apos;<a href="http://example.com">http://example.com</a>&apos;</span>)
150+
<a class="l" name="142" href="#142">142</a></body>
149151
</html>

0 commit comments

Comments
 (0)