Skip to content

Commit 06f2b7d

Browse files
committed
Lubos had directed to link identifiers of length=1
Missed a few because they were in-flight with enhancements -- or just plain missed, as with PlainSymbolTokenizer.
1 parent 5cab2bd commit 06f2b7d

File tree

15 files changed

+296
-214
lines changed

15 files changed

+296
-214
lines changed

opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/ada/AdaAnalyzer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,11 @@ protected AdaAnalyzer(AnalyzerFactory factory) {
5151
* Gets a version number to be used to tag processed documents so that
5252
* re-analysis can be re-done later if a stored version number is different
5353
* from the current implementation.
54-
* @return 20190118_00
54+
* @return 20190118_01
5555
*/
5656
@Override
5757
protected int getSpecializedVersionNo() {
58-
return 20190118_00; // Edit comment above too!
58+
return 20190118_01; // Edit comment above too!
5959
}
6060

6161
/**

opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/fortran/FortranAnalyzer.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
/*
2121
* Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
22-
* Portions Copyright (c) 2017, Chris Fraire <[email protected]>.
22+
* Portions Copyright (c) 2017-2019, Chris Fraire <[email protected]>.
2323
*/
2424
package org.opengrok.indexer.analysis.fortran;
2525

@@ -45,11 +45,11 @@ public class FortranAnalyzer extends AbstractSourceCodeAnalyzer {
4545
* Gets a version number to be used to tag processed documents so that
4646
* re-analysis can be re-done later if a stored version number is different
4747
* from the current implementation.
48-
* @return 20180208_00
48+
* @return 20190118_00
4949
*/
5050
@Override
5151
protected int getSpecializedVersionNo() {
52-
return 20180208_00; // Edit comment above too!
52+
return 20190118_00; // Edit comment above too!
5353
}
5454

5555
/**

opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/perl/PerlAnalyzer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,11 @@ protected PerlAnalyzer(AnalyzerFactory factory) {
4949
* Gets a version number to be used to tag processed documents so that
5050
* re-analysis can be re-done later if a stored version number is different
5151
* from the current implementation.
52-
* @return 20190118_00
52+
* @return 20190118_01
5353
*/
5454
@Override
5555
protected int getSpecializedVersionNo() {
56-
return 20190118_00; // Edit comment above too!
56+
return 20190118_01; // Edit comment above too!
5757
}
5858

5959
/**

opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/ruby/RubyAnalyzer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,11 @@ protected RubyAnalyzer(AnalyzerFactory factory) {
5050
* Gets a version number to be used to tag processed documents so that
5151
* re-analysis can be re-done later if a stored version number is different
5252
* from the current implementation.
53-
* @return 20190118_00
53+
* @return 20190118_01
5454
*/
5555
@Override
5656
protected int getSpecializedVersionNo() {
57-
return 20190118_00; // Edit comment above too!
57+
return 20190118_01; // Edit comment above too!
5858
}
5959

6060
/**

opengrok-indexer/src/main/resources/analysis/ada/AdaXref.lex

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
package org.opengrok.indexer.analysis.ada;
3030

3131
import java.io.IOException;
32+
import java.util.Set;
3233
import org.opengrok.indexer.web.HtmlConsts;
3334
%%
3435
%public
@@ -51,18 +52,9 @@ import org.opengrok.indexer.web.HtmlConsts;
5152

5253
@Override
5354
public boolean offerSymbol(String value, int captureOffset,
54-
boolean ignoreKwd)
55-
throws IOException {
56-
if (ignoreKwd) {
57-
if (value.length() > 1) {
58-
return onFilteredSymbolMatched(value, yychar, null, false);
59-
} else {
60-
onNonSymbolMatched(value, yychar);
61-
return false;
62-
}
63-
} else {
64-
return onFilteredSymbolMatched(value, yychar, Consts.kwd, false);
65-
}
55+
boolean ignoreKwd) throws IOException {
56+
Set<String> keywords = ignoreKwd ? null : Consts.kwd;
57+
return onFilteredSymbolMatched(value, yychar, keywords, false);
6658
}
6759

6860
@Override

opengrok-indexer/src/main/resources/analysis/fortran/FortranXref.lex

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
/*
2121
* Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved.
22-
* Portions Copyright (c) 2017, Chris Fraire <[email protected]>.
22+
* Portions Copyright (c) 2017, 2019, Chris Fraire <[email protected]>.
2323
*/
2424

2525
/*
@@ -86,13 +86,7 @@ File = [a-zA-Z]{FNameChar}* ".inc"
8686

8787
{Identifier} {
8888
chkLOC();
89-
String id = yytext();
90-
// For historical reasons, FortranXref doesn't link identifiers of length=1
91-
if (id.length() > 1) {
92-
onFilteredSymbolMatched(id, yychar, Consts.kwd, false);
93-
} else {
94-
onNonSymbolMatched(id, yychar);
95-
}
89+
onFilteredSymbolMatched(yytext(), yychar, Consts.kwd, false);
9690
}
9791

9892
"<" ({File}|{FPath}) ">" {

opengrok-indexer/src/main/resources/analysis/perl/PerlXref.lex

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
package org.opengrok.indexer.analysis.perl;
3030

3131
import java.io.IOException;
32+
import java.util.Set;
3233
import java.util.regex.Pattern;
3334
import org.opengrok.indexer.web.HtmlConsts;
3435
%%
@@ -51,18 +52,9 @@ import org.opengrok.indexer.web.HtmlConsts;
5152

5253
@Override
5354
public boolean offerSymbol(String value, int captureOffset,
54-
boolean ignoreKwd)
55-
throws IOException {
56-
if (ignoreKwd) {
57-
if (value.length() > 1) {
58-
return onFilteredSymbolMatched(value, yychar, null);
59-
} else {
60-
onNonSymbolMatched(value, yychar);
61-
return false;
62-
}
63-
} else {
64-
return onFilteredSymbolMatched(value, yychar, Consts.kwd);
65-
}
55+
boolean ignoreKwd) throws IOException {
56+
Set<String> keywords = ignoreKwd ? null : Consts.kwd;
57+
return onFilteredSymbolMatched(value, yychar, keywords);
6658
}
6759

6860
@Override

opengrok-indexer/src/main/resources/analysis/plain/PlainSymbolTokenizer.lex

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
/*
2121
* Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
22-
* Portions Copyright (c) 2017, Chris Fraire <[email protected]>.
22+
* Portions Copyright (c) 2017, 2019, Chris Fraire <[email protected]>.
2323
*/
2424

2525
package org.opengrok.indexer.analysis.plain;
@@ -39,8 +39,7 @@ import org.opengrok.indexer.analysis.JFlexSymbolMatcher;
3939
%char
4040

4141
%%
42-
//TODO decide if we should let one char symbols
43-
[a-zA-Z_] [a-zA-Z0-9_]+ {
42+
[a-zA-Z_] [a-zA-Z0-9_]* {
4443
onSymbolMatched(yytext(), yychar);
4544
return yystate();
4645
}

opengrok-indexer/src/main/resources/analysis/ruby/RubySymbolTokenizer.lex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ import org.opengrok.indexer.web.HtmlConsts;
6464
public boolean offerSymbol(String value, int captureOffset,
6565
boolean ignoreKwd)
6666
throws IOException {
67-
if (nameLength(value) <= 1) {
67+
if (nameLength(value) <= 0) {
6868
lastSymbol = null;
6969
} else if (ignoreKwd || !Consts.kwd.contains(value)) {
7070
lastSymbol = value;

opengrok-indexer/src/main/resources/analysis/ruby/RubyXref.lex

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

3131
import java.io.IOException;
32+
import java.util.Set;
3233
import java.util.regex.Pattern;
3334
import org.opengrok.indexer.web.HtmlConsts;
3435
%%
@@ -51,16 +52,13 @@ import org.opengrok.indexer.web.HtmlConsts;
5152

5253
@Override
5354
public boolean offerSymbol(String value, int captureOffset,
54-
boolean ignoreKwd)
55-
throws IOException {
56-
if (nameLength(value) <= 1) {
55+
boolean ignoreKwd) throws IOException {
56+
if (nameLength(value) <= 0) {
5757
onNonSymbolMatched(value, yychar);
5858
return false;
59-
} else if (ignoreKwd) {
60-
return onFilteredSymbolMatched(value, yychar, null);
61-
} else {
62-
return onFilteredSymbolMatched(value, yychar, Consts.kwd);
6359
}
60+
Set<String> keywords = ignoreKwd ? null : Consts.kwd;
61+
return onFilteredSymbolMatched(value, yychar, keywords);
6462
}
6563

6664
@Override

0 commit comments

Comments
 (0)