Skip to content

Commit d051e17

Browse files
idodeclareVladimir Kotal
authored andcommitted
Upgrade to JFlex 1.8.2
1 parent cff3e28 commit d051e17

28 files changed

+292
-219
lines changed

Dockerfile

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# Copyright (c) 2018, 2020 Oracle and/or its affiliates. All rights reserved.
2+
# Portions Copyright (c) 2020, Chris Fraire <[email protected]>.
23

34
FROM ubuntu:bionic as build
45

@@ -19,10 +20,6 @@ RUN sed -i 's:<module>opengrok-tools</module>::g' /mvn/pom.xml
1920

2021
RUN mkdir -p /mvn/opengrok-indexer/target/jflex-sources
2122
RUN mkdir -p /mvn/opengrok-web/src/main/webapp
22-
COPY opengrok-indexer/jflex-tt.txt /mvn/opengrok-indexer/jflex-tt.txt
23-
COPY opengrok-indexer/jflex-tt-end.txt /mvn/opengrok-indexer/jflex-tt-end.txt
24-
COPY opengrok-indexer/jflex-code.txt /mvn/opengrok-indexer/jflex-code.txt
25-
COPY opengrok-indexer/jflex-code-end.txt /mvn/opengrok-indexer/jflex-code-end.txt
2623
RUN mkdir -p /mvn/opengrok-web/src/main/webapp/WEB-INF/ && touch /mvn/opengrok-web/src/main/webapp/WEB-INF/web.xml
2724

2825
# dummy build to cache the dependencies

dev/checkstyle/suppressions.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Portions Copyright (c) 2018-2020, Chris Fraire <[email protected]>.
3434
|ObjectPool\.java|ObjectValidator\.java|ObjectFactory\.java|AbstractObjectPool\.java|
3535
|BlockingObjectPool\.java|OGKTextVecField\.java|OGKTextField\.java|
3636
|LazilyInstantiate\.java|PortChecker\.java|CloseableReentrantReadWriteLock\.java|
37-
|ResourceLock\.java" />
37+
|ResourceLock\.java|ZeroReader\.java" />
3838

3939
<suppress checks="ParameterNumber" files="CtagsReader\.java|Definitions\.java|
4040
|JFlexXrefUtils\.java|FileAnalyzerFactory\.java|SearchController\.java|

opengrok-indexer/jflex-code-end.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

opengrok-indexer/jflex-code.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

opengrok-indexer/jflex-tt-end.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

opengrok-indexer/jflex-tt.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

opengrok-indexer/pom.xml

Lines changed: 2 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ information: Portions Copyright [yyyy] [name of copyright owner]
1919
CDDL HEADER END
2020
2121
Copyright (c) 2010, 2020, Oracle and/or its affiliates. All rights reserved.
22-
Portions Copyright (c) 2017-2019, Chris Fraire <[email protected]>.
22+
Portions Copyright (c) 2017-2020, Chris Fraire <[email protected]>.
2323
Portions Copyright (c) 2020-2020, Lubos Kosco <[email protected]>.
2424
2525
-->
@@ -203,7 +203,7 @@ Portions Copyright (c) 2020-2020, Lubos Kosco <[email protected]>.
203203
<plugin>
204204
<groupId>de.jflex</groupId>
205205
<artifactId>jflex-maven-plugin</artifactId>
206-
<version>1.7.0</version>
206+
<version>1.8.2</version>
207207
<executions>
208208
<execution>
209209
<goals>
@@ -292,90 +292,6 @@ Portions Copyright (c) 2020-2020, Lubos Kosco <[email protected]>.
292292
<quiet>false</quiet>
293293
</configuration>
294294
</execution>
295-
<execution>
296-
<!-- patches jflex generated files to stop increasing buffer beyond token size that lucene accepts
297-
https://github.com/OpenGrok/OpenGrok/issues/1170 make parsers stop producing tokens > 32766 chars
298-
at least for PlainFullTokenizer, PlainSymbolTokenizer, JavaScriptSymbolTokenizer, JavaSymbolTokenizer
299-
use below
300-
-->
301-
<id>replace-in-jflex-sources</id>
302-
<phase>generate-sources</phase>
303-
<goals>
304-
<goal>replace</goal>
305-
</goals>
306-
<configuration>
307-
<filesToInclude>
308-
${basedir}/target/generated-sources/jflex/org/opengrok/indexer/analysis/java/JavaSymbolTokenizer.java,${basedir}/target/generated-sources/jflex/org/opengrok/indexer/analysis/javascript/JavaScriptSymbolTokenizer.java,${basedir}/target/generated-sources/jflex/org/opengrok/indexer/analysis/json/JsonSymbolTokenizer.java,${basedir}/target/generated-sources/jflex/org/opengrok/indexer/analysis/plain/PlainFullTokenizer.java,${basedir}/target/generated-sources/jflex/org/opengrok/indexer/analysis/plain/PlainSymbolTokenizer.java
309-
</filesToInclude>
310-
<replacements>
311-
<!--
312-
needed for HTML 5 compliance (javadoc in JDK 11)
313-
workaround for https://github.com/jflex-de/jflex/issues/534
314-
-->
315-
<replacement>
316-
<tokenFile>${basedir}/jflex-tt.txt</tokenFile>
317-
<valueFile>${basedir}/jflex-code.txt</valueFile>
318-
</replacement>
319-
<replacement>
320-
<tokenFile>${basedir}/jflex-tt-end.txt</tokenFile>
321-
<valueFile>${basedir}/jflex-code-end.txt</valueFile>
322-
</replacement>
323-
324-
<replacement>
325-
<token>private static final int ZZ_BUFFERSIZE =</token>
326-
<value>private int ZZ_BUFFERSIZE =</value>
327-
</replacement>
328-
<replacement>
329-
<token>int requested = zzBuffer\.length - zzEndRead;</token>
330-
<value>int requested = zzBuffer.length - zzEndRead - zzFinalHighSurrogate;</value>
331-
</replacement>
332-
<replacement>
333-
<token>(zzFinalHighSurrogate = 1;)(\r?\n)</token>
334-
<value>$1$2 if (numRead == 1) { return true; }$2</value>
335-
</replacement>
336-
<replacement>
337-
<token>[ \t]*/\* is the buffer big enough\? \*/\s+if \(zzCurrentPos >= zzBuffer\.length.*?\}[ \t]*\r?\n</token>
338-
<value></value>
339-
</replacement>
340-
<!-- also revert 0 character check that got in with 1.6.1 : https://github.com/jflex-de/jflex/blob/master/jflex/examples/zero-reader/README.md -->
341-
<replacement>
342-
<token>[ \t]*/\* not supposed to occur according to specification of java\.io\.Reader \*/\s+if \(numRead == 0.*?\}[ \t]*\r?\n</token>
343-
<value></value>
344-
</replacement>
345-
</replacements>
346-
<regexFlags>
347-
<regexFlag>DOTALL</regexFlag>
348-
</regexFlags>
349-
</configuration>
350-
</execution>
351-
352-
<execution>
353-
<!--
354-
needed for HTML 5 compliance (javadoc in JDK 11)
355-
workaround for https://github.com/jflex-de/jflex/issues/534
356-
-->
357-
<id>replace-tt-with-code-in-jflex-sources</id>
358-
<phase>generate-sources</phase>
359-
360-
<goals>
361-
<goal>replace</goal>
362-
</goals>
363-
<configuration>
364-
<filesToInclude>
365-
${basedir}/target/generated-sources/jflex/**/*.java
366-
</filesToInclude>
367-
<replacements>
368-
<replacement>
369-
<tokenFile>${basedir}/jflex-tt.txt</tokenFile>
370-
<valueFile>${basedir}/jflex-code.txt</valueFile>
371-
</replacement>
372-
<replacement>
373-
<tokenFile>${basedir}/jflex-tt-end.txt</tokenFile>
374-
<valueFile>${basedir}/jflex-code-end.txt</valueFile>
375-
</replacement>
376-
</replacements>
377-
</configuration>
378-
</execution>
379295
</executions>
380296
</plugin>
381297
<plugin>

opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/DisjointSpanChangedEvent.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*/
1919

2020
/*
21-
* Copyright (c) 2017, Chris Fraire <[email protected]>.
21+
* Copyright (c) 2017, 2020, Chris Fraire <[email protected]>.
2222
*/
2323

2424
package org.opengrok.indexer.analysis;
@@ -31,16 +31,15 @@ public class DisjointSpanChangedEvent {
3131

3232
private final Object source;
3333
private final String className;
34-
private final int position;
34+
private final long position;
3535

3636
/**
3737
* Initializes an immutable instance of {@link DisjointSpanChangedEvent}.
3838
* @param source the event source
3939
* @param className the span class name
4040
* @param position the span position
4141
*/
42-
public DisjointSpanChangedEvent(Object source, String className,
43-
int position) {
42+
public DisjointSpanChangedEvent(Object source, String className, long position) {
4443
this.source = source;
4544
this.className = className;
4645
this.position = position;
@@ -66,7 +65,7 @@ public String getDisjointSpanClassName() {
6665
* Gets the span position.
6766
* @return the initial value
6867
*/
69-
public int getPosition() {
68+
public long getPosition() {
7069
return position;
7170
}
7271
}

opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/JFlexStackingLexer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
/*
2121
* Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved.
2222
* Portions Copyright 2011 Jens Elkner.
23-
* Portions Copyright (c) 2017, 2019, Chris Fraire <[email protected]>.
23+
* Portions Copyright (c) 2017, 2019-2020, Chris Fraire <[email protected]>.
2424
*/
2525

2626
package org.opengrok.indexer.analysis;
@@ -50,7 +50,7 @@ public interface JFlexStackingLexer extends JFlexLexer {
5050
/**
5151
* Gets the yychar value.
5252
*/
53-
int getYYCHAR();
53+
long getYYCHAR();
5454

5555
/**
5656
* Gets the YYEOF value.

0 commit comments

Comments
 (0)