Skip to content

Commit 36ef0c5

Browse files
committed
Fix conversions accidentally missed
1 parent 56e4f08 commit 36ef0c5

File tree

8 files changed

+27
-29
lines changed

8 files changed

+27
-29
lines changed

src/org/opensolaris/opengrok/analysis/perl/PerlLexHelper.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import java.util.regex.Matcher;
3030
import java.util.regex.Pattern;
3131
import org.opensolaris.opengrok.analysis.Resettable;
32+
import org.opensolaris.opengrok.util.StringUtils;
3233
import org.opensolaris.opengrok.web.HtmlConsts;
3334

3435
/**
@@ -300,10 +301,10 @@ public void setState(String ltpostop, boolean nointerp) {
300301
int state;
301302
boolean nolink = false;
302303

303-
// "no link" for {FNameChar} or {URIChar}, which covers everything in
304-
// the rule for "string links" below
305-
if (ltpostop.matches("^[a-zA-Z0-9_]") ||
306-
ltpostop.matches("^[\\?\\#\\+%&:/\\.@_;=\\$,\\-!~\\*\\\\]")) {
304+
// "no link" for values in the rules for "string links" if `ltpostop'
305+
// is file- or URI-like.
306+
if (StringUtils.startsWithFnameChars(ltpostop) ||
307+
StringUtils.startsWithURIChars(ltpostop)) {
307308
nolink = true;
308309
}
309310

src/org/opensolaris/opengrok/analysis/perl/PerlProductions.lexh

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,7 @@
2626
* Regex productions shared between PerlXref and PerlSymbolTokenizer
2727
*/
2828

29-
WhspChar = [ \t\f]
30-
WhiteSpace = {WhspChar}+
3129
MaybeWhsp = {WhspChar}*
32-
EOL = \r|\n|\r\n
3330
Identifier = [a-zA-Z_] [a-zA-Z0-9_]*
3431
Sigils = ("$" | "@" | "%" | "&" | "*")
3532
WxSigils = [[\W]--[\$\@\%\&\*\"\'\`\#\r\n]]
@@ -63,14 +60,9 @@ SPIdentifier4 = "${^" ( "]" | "[" | [A-Z\^_?\\] ) [a-zA-Z0-9_]* "}"
6360
// mistaken for an SPIdentifier2
6461
ProtoAttr = "(" ( [\\]? {Sigils} | ";" | {WhiteSpace} )* ")"
6562

66-
// see also: PerlLexHelper.setState() which mirrors this regex
67-
URIChar = [\?\#\+\%\&\:\/\.\@\_\;\=\$\,\-\!\~\*\\]
68-
69-
FNameChar = [a-zA-Z0-9_\-\.]
7063
FileExt = ("pl"|"perl"|"pm"|"conf"|"txt"|"htm"|"html"|"xml"|"ini"|"diff"|"patch"|
7164
"PL"|"PERL"|"PM"|"CONF"|"TXT"|"HTM"|"HTML"|"XML"|"INI"|"DIFF"|"PATCH")
7265
File = [a-zA-Z]{FNameChar}* "." {FileExt}
73-
Path = "/"? [a-zA-Z]{FNameChar}* ("/" [a-zA-Z]{FNameChar}*[a-zA-Z0-9])+
7466

7567
Number = (0[xX][0-9a-fA-F]+|[0-9]+\.[0-9]+|[0-9][0-9_]*)([eE][+-]?[0-9]+)?
7668

@@ -189,7 +181,7 @@ Mpunc2IN = ([!=]"~" | [\:\?\=\+\-\<\>] | "=="|"!="|"<="|">="|"<=>"|"=>")
189181
}
190182
}
191183

192-
"<" ({File}|{Path}) ">" {
184+
"<" ({File} | {FPath}) ">" {
193185
maybeIntraState();
194186
if (takeAllContent()) {
195187
takeNonword("<");
@@ -515,7 +507,7 @@ Mpunc2IN = ([!=]"~" | [\:\?\=\+\-\<\>] | "=="|"!="|"<="|">="|"<=>"|"=>")
515507

516508
// "string links" and "comment links"
517509
<SCOMMENT, POD, FMT, QUO, QUOxN, HERE, HERExN, HEREin, HEREinxN> {
518-
{Path} {
510+
{FPath} {
519511
if (takeAllContent()) {
520512
take(Util.breadcrumbPath(getUrlPrefix() + "path=",yytext(),'/'));
521513
}
@@ -533,7 +525,7 @@ Mpunc2IN = ([!=]"~" | [\:\?\=\+\-\<\>] | "=="|"!="|"<="|">="|"<=>"|"=>")
533525
}
534526
}
535527

536-
("http" | "https" | "ftp" ) "://" ({FNameChar}|{URIChar})+[a-zA-Z0-9/] {
528+
{BrowseableURI} {
537529
if (takeAllContent()) {
538530
appendLink(yytext());
539531
}

src/org/opensolaris/opengrok/analysis/perl/PerlSymbolTokenizer.lex

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,4 +136,7 @@ import org.opensolaris.opengrok.web.Util;
136136
protected void writeEMailAddress(String s) { /* noop */ }
137137
%}
138138

139+
%include Common.lexh
140+
%include CommonURI.lexh
141+
%include CommonPath.lexh
139142
%include PerlProductions.lexh

src/org/opensolaris/opengrok/analysis/perl/PerlXref.lex

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,4 +134,7 @@ import org.opensolaris.opengrok.web.Util;
134134
protected String getUrlPrefix() { return urlPrefix; }
135135
%}
136136

137+
%include Common.lexh
138+
%include CommonURI.lexh
139+
%include CommonPath.lexh
137140
%include PerlProductions.lexh

src/org/opensolaris/opengrok/analysis/ruby/RubyLexHelper.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import java.util.regex.Matcher;
3030
import java.util.regex.Pattern;
3131
import org.opensolaris.opengrok.analysis.Resettable;
32+
import org.opensolaris.opengrok.util.StringUtils;
3233
import org.opensolaris.opengrok.web.HtmlConsts;
3334

3435
/**
@@ -247,10 +248,10 @@ public void setState(String postop, boolean nointerp) {
247248
int state;
248249
boolean nolink = false;
249250

250-
// "no link" for {FNameChar} or {URIChar}, which covers everything in
251-
// the rule for "string links" below
252-
if (postop.matches("^[a-zA-Z0-9_]") ||
253-
postop.matches("^[\\?\\#\\+%&:/\\.@_;=\\$,\\-!~\\*\\\\]")) {
251+
// "no link" for values in the rules for "string links" if `postop'
252+
// is file- or URI-like.
253+
if (StringUtils.startsWithFnameChars(postop) ||
254+
StringUtils.startsWithURIChars(postop)) {
254255
nolink = true;
255256
}
256257

src/org/opensolaris/opengrok/analysis/ruby/RubyProductions.lexh

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,7 @@
2626
* Regex productions shared between RubyXref and RubySymbolTokenizer
2727
*/
2828

29-
WhspChar = [ \t\f]
30-
WhiteSpace = {WhspChar}+
3129
MaybeWhsp = {WhspChar}*
32-
EOL = \r|\n|\r\n
3330

3431
/*
3532
* globals_rdoc: Pre-defined variables
@@ -161,14 +158,9 @@ Character_literal_esc = [\\] ([MC][\-][^\s] | "u{" [0-9]+ "}" |
161158

162159
WxSigils = [[\W]--[\$\@\"\'\`\#\r\n]]
163160

164-
// see also: RubyLexHelper.setState() which mirrors this regex
165-
URIChar = [\?\#\+\%\&\:\/\.\@\_\;\=\$\,\-\!\~\*\\]
166-
167-
FNameChar = [a-zA-Z0-9_\-\.]
168161
FileExt = ([Rr][Bb] | [Rr][Uu][Bb][Yy] | [Dd][Ii][Ff][Ff] |
169162
[Pp][Aa][Tt][Cc][Hh])
170163
File = [a-zA-Z]{FNameChar}* "." {FileExt}
171-
Path = "/"? [a-zA-Z]{FNameChar}* ("/" [a-zA-Z]{FNameChar}*[a-zA-Z0-9])+
172164

173165
POD_begin = "=begin"
174166
POD_end = "=end"
@@ -494,7 +486,7 @@ Here_EOF3 = [\`][^\r\n\`]*[\`]
494486

495487
// "string links" and "comment links"
496488
<SCOMMENT, POD, QUO, QUOxN, HERE, HERExN, HEREin, HEREinxN> {
497-
{Path} {
489+
{FPath} {
498490
if (takeAllContent()) {
499491
take(Util.breadcrumbPath(getUrlPrefix() + "path=",yytext(),'/'));
500492
}
@@ -512,7 +504,7 @@ Here_EOF3 = [\`][^\r\n\`]*[\`]
512504
}
513505
}
514506

515-
("http" | "https" | "ftp" ) "://" ({FNameChar}|{URIChar})+[a-zA-Z0-9/] {
507+
{BrowseableURI} {
516508
if (takeAllContent()) {
517509
appendLink(yytext());
518510
}

src/org/opensolaris/opengrok/analysis/ruby/RubySymbolTokenizer.lex

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,4 +151,7 @@ import org.opensolaris.opengrok.web.Util;
151151
protected void writeEMailAddress(String s) { /* noop */ }
152152
%}
153153

154+
%include Common.lexh
155+
%include CommonURI.lexh
156+
%include CommonPath.lexh
154157
%include RubyProductions.lexh

src/org/opensolaris/opengrok/analysis/ruby/RubyXref.lex

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,4 +145,7 @@ import org.opensolaris.opengrok.web.Util;
145145
protected String getUrlPrefix() { return urlPrefix; }
146146
%}
147147

148+
%include Common.lexh
149+
%include CommonURI.lexh
150+
%include CommonPath.lexh
148151
%include RubyProductions.lexh

0 commit comments

Comments
 (0)