Skip to content

Commit 348ddc2

Browse files
committed
Fix to fine-tune URI link for Lua QSTRING
1 parent cf1f6cb commit 348ddc2

File tree

3 files changed

+21
-2
lines changed

3 files changed

+21
-2
lines changed

src/org/opensolaris/opengrok/analysis/lua/LuaXref.lex

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
package org.opensolaris.opengrok.analysis.lua;
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

@@ -186,8 +187,18 @@ File = [a-zA-Z]{FNameChar}* "." ([Ll][Uu][Aa] | [Tt][Xx][Tt] |
186187
out.write(path);
187188
out.write("</a>");
188189
}
190+
{FNameChar}+ "@" {FNameChar}+ "." {FNameChar}+ {
191+
writeEMailAddress(yytext());
192+
}
193+
}
194+
195+
<STRING, LSTRING, COMMENT, SCOMMENT> {
189196
{BrowseableURI} {
190197
appendLink(yytext(), true);
191198
}
192-
{FNameChar}+ "@" {FNameChar}+ "." {FNameChar}+ { writeEMailAddress(yytext()); }
199+
}
200+
<QSTRING> {
201+
{BrowseableURI} {
202+
appendLink(yytext(), true, StringUtils.APOS_NO_BSESC);
203+
}
193204
}

test/org/opensolaris/opengrok/analysis/lua/sample.lua

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,3 +359,7 @@ end
359359

360360

361361
return _M
362+
return 'http://example.com?a='
363+
return [=[http://example.com?a=]=]
364+
return "http://example.com?a="
365+
return 'http://example.com?a=\'b\''

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,5 +367,9 @@
367367
<a class="l" name="359" href="#359">359</a>
368368
<a class="hl" name="360" href="#360">360</a>
369369
<a class="l" name="361" href="#361">361</a><b>return</b> <a href="/source/s?defs=_M" class="intelliWindow-symbol" data-definition-place="undefined-in-file">_M</a>
370-
<a class="l" name="362" href="#362">362</a></body>
370+
<a class="l" name="362" href="#362">362</a><b>return</b> <span class="s">&apos;<a href="http://example.com?a=">http://example.com?a=</a>&apos;</span>
371+
<a class="l" name="363" href="#363">363</a><b>return</b> <span class="s">[=[<a href="http://example.com?a=">http://example.com?a=</a>]=]</span>
372+
<a class="l" name="364" href="#364">364</a><b>return</b> <span class="s">&quot;<a href="http://example.com?a=">http://example.com?a=</a>&quot;</span>
373+
<a class="l" name="365" href="#365">365</a><b>return</b> <span class="s">&apos;<a href="http://example.com?a=">http://example.com?a=</a>\&apos;b\&apos;&apos;</span>
374+
<a class="l" name="366" href="#366">366</a></body>
371375
</html>

0 commit comments

Comments
 (0)