diff options
author | gjoranv <gjoranv@gmail.com> | 2018-08-28 10:39:23 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-28 10:39:23 +0200 |
commit | f65816fe02f63a3fabacd96b28960446df587848 (patch) | |
tree | 48729122f3deb8d8662d86dc94dd673fabcbc366 | |
parent | dfb3d41713fb28ad4aaf19487db1cefb4e00a099 (diff) | |
parent | e6264beb644bfc534b1ea0f0945b6eb0c3cc1a16 (diff) |
Merge pull request #6679 from vespa-engine/gjoranv/javacc-plugin
Gjoranv/javacc plugin
24 files changed, 80 insertions, 134 deletions
diff --git a/config-model/pom.xml b/config-model/pom.xml index e78c7f5c0fd..e8415b3a67b 100644 --- a/config-model/pom.xml +++ b/config-model/pom.xml @@ -498,19 +498,17 @@ </executions> </plugin> <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>javacc-maven-plugin</artifactId> + <groupId>com.helger.maven</groupId> + <artifactId>ph-javacc-maven-plugin</artifactId> + <version>4.0.3</version> <executions> <execution> - <id>javacc</id> + <phase>generate-sources</phase> <goals> <goal>javacc</goal> </goals> </execution> </executions> - <configuration> - <sourceDirectory>src/main/javacc</sourceDirectory> - </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/SearchBuilder.java b/config-model/src/main/java/com/yahoo/searchdefinition/SearchBuilder.java index 8ca82008e8b..91f86bb1c2a 100644 --- a/config-model/src/main/java/com/yahoo/searchdefinition/SearchBuilder.java +++ b/config-model/src/main/java/com/yahoo/searchdefinition/SearchBuilder.java @@ -14,7 +14,7 @@ import com.yahoo.searchdefinition.document.SDDocumentType; import com.yahoo.searchdefinition.parser.ParseException; import com.yahoo.searchdefinition.parser.SDParser; import com.yahoo.searchdefinition.parser.SimpleCharStream; -import com.yahoo.searchdefinition.parser.TokenMgrError; +import com.yahoo.searchdefinition.parser.TokenMgrException; import com.yahoo.searchdefinition.processing.Processing; import com.yahoo.vespa.documentmodel.DocumentModel; import com.yahoo.vespa.model.container.search.QueryProfiles; @@ -151,7 +151,7 @@ public class SearchBuilder { SimpleCharStream stream = new SimpleCharStream(str); try { search = new SDParser(stream, deployLogger, app, rankProfileRegistry).search(docTypeMgr, searchDefDir); - } catch (TokenMgrError e) { + } catch (TokenMgrException e) { throw new ParseException("Unknown symbol: " + e.getMessage()); } catch (ParseException pe) { throw new ParseException(stream.formatException(Exceptions.toMessageString(pe))); diff --git a/config-model/src/main/javacc/SDParser.jj b/config-model/src/main/javacc/SDParser.jj index 12e61dea450..2c4c9a47fec 100644 --- a/config-model/src/main/javacc/SDParser.jj +++ b/config-model/src/main/javacc/SDParser.jj @@ -1772,7 +1772,7 @@ Object indexBody(IndexOperation index) : | <ALIAS> <COLON> str = identifier() { index.addAlias(str); } | <STEMMING> <COLON> str = identifier() { index.setStemming(str); } | <RISE> { - throw new ParseException("'index:rise' is no longer an option. Use 'indexing:attribute' instead. " + + if (true) throw new ParseException("'index:rise' is no longer an option. Use 'indexing:attribute' instead. " + "If it is a weighted set field you should also add 'attribute:fast-search'." + "This change will require refeeding."); } diff --git a/container-search/pom.xml b/container-search/pom.xml index cdfcdb2434a..0b5edf8637f 100644 --- a/container-search/pom.xml +++ b/container-search/pom.xml @@ -173,19 +173,15 @@ </configuration> </plugin> <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>javacc-maven-plugin</artifactId> - <version>2.4</version> + <groupId>com.helger.maven</groupId> + <artifactId>ph-javacc-maven-plugin</artifactId> + <version>4.0.3</version> <executions> <execution> - <id>javacc</id> + <phase>generate-sources</phase> <goals> <goal>javacc</goal> </goals> - <configuration> - <lookAhead>1</lookAhead> - <isStatic>false</isStatic> - </configuration> </execution> </executions> </plugin> diff --git a/container-search/src/main/java/com/yahoo/search/grouping/request/GroupingOperation.java b/container-search/src/main/java/com/yahoo/search/grouping/request/GroupingOperation.java index 93619913b4f..c825f3c61de 100644 --- a/container-search/src/main/java/com/yahoo/search/grouping/request/GroupingOperation.java +++ b/container-search/src/main/java/com/yahoo/search/grouping/request/GroupingOperation.java @@ -6,7 +6,7 @@ import com.yahoo.collections.LazySet; import com.yahoo.search.grouping.request.parser.GroupingParser; import com.yahoo.search.grouping.request.parser.GroupingParserInput; import com.yahoo.search.grouping.request.parser.ParseException; -import com.yahoo.search.grouping.request.parser.TokenMgrError; +import com.yahoo.search.grouping.request.parser.TokenMgrException; import java.util.*; @@ -617,7 +617,7 @@ public abstract class GroupingOperation extends GroupingNode { GroupingParserInput input = new GroupingParserInput(str); try { return new GroupingParser(input).requestList(); - } catch (ParseException | TokenMgrError e) { + } catch (ParseException | TokenMgrException e) { throw new IllegalArgumentException(input.formatException(e.getMessage()), e); } } diff --git a/container-search/src/main/java/com/yahoo/search/query/textserialize/TextSerialize.java b/container-search/src/main/java/com/yahoo/search/query/textserialize/TextSerialize.java index f44dab92fc7..08af2b02dea 100644 --- a/container-search/src/main/java/com/yahoo/search/query/textserialize/TextSerialize.java +++ b/container-search/src/main/java/com/yahoo/search/query/textserialize/TextSerialize.java @@ -6,7 +6,7 @@ import com.yahoo.search.query.textserialize.item.ItemContext; import com.yahoo.search.query.textserialize.item.ItemFormHandler; import com.yahoo.search.query.textserialize.parser.ParseException; import com.yahoo.search.query.textserialize.parser.Parser; -import com.yahoo.search.query.textserialize.parser.TokenMgrError; +import com.yahoo.search.query.textserialize.parser.TokenMgrException; import com.yahoo.search.query.textserialize.serializer.QueryTreeSerializer; import java.io.StringReader; @@ -28,9 +28,7 @@ public class TextSerialize { "(type = " + result.getClass() + ")"); } return (Item) result; - } catch (ParseException e) { - throw new RuntimeException(e); - } catch (TokenMgrError e) { + } catch (ParseException | TokenMgrException e) { throw new RuntimeException(e); } } diff --git a/container-search/src/main/java/com/yahoo/search/querytransform/BooleanSearcher.java b/container-search/src/main/java/com/yahoo/search/querytransform/BooleanSearcher.java index 605b959c5d7..21bc22d7002 100644 --- a/container-search/src/main/java/com/yahoo/search/querytransform/BooleanSearcher.java +++ b/container-search/src/main/java/com/yahoo/search/querytransform/BooleanSearcher.java @@ -8,7 +8,7 @@ import com.yahoo.processing.request.CompoundName; import com.yahoo.search.Query; import com.yahoo.search.Result; import com.yahoo.search.Searcher; -import com.yahoo.search.grouping.request.parser.TokenMgrError; +import com.yahoo.search.grouping.request.parser.TokenMgrException; import com.yahoo.search.result.ErrorMessage; import com.yahoo.search.searchchain.Execution; @@ -57,7 +57,7 @@ public class BooleanSearcher extends Searcher { if (query.isTraceable(4)) { query.trace("BooleanSearcher: Added boolean operator", true, 4); } - } catch (TokenMgrError e) { + } catch (TokenMgrException e) { return new Result(query, ErrorMessage.createInvalidQueryParameter(toMessageString(e))); } } else { diff --git a/container-search/src/main/java/com/yahoo/vespa/streamingvisitors/VdsStreamingSearcher.java b/container-search/src/main/java/com/yahoo/vespa/streamingvisitors/VdsStreamingSearcher.java index 360d16080d0..53c170301fc 100644 --- a/container-search/src/main/java/com/yahoo/vespa/streamingvisitors/VdsStreamingSearcher.java +++ b/container-search/src/main/java/com/yahoo/vespa/streamingvisitors/VdsStreamingSearcher.java @@ -10,7 +10,7 @@ import java.util.logging.Logger; import com.yahoo.document.DocumentId; import com.yahoo.document.idstring.IdString; import com.yahoo.document.select.parser.ParseException; -import com.yahoo.document.select.parser.TokenMgrError; +import com.yahoo.document.select.parser.TokenMgrException; import com.yahoo.fs4.DocsumPacket; import com.yahoo.fs4.Packet; import com.yahoo.fs4.QueryPacket; @@ -134,7 +134,7 @@ public class VdsStreamingSearcher extends VespaBackEndSearcher { } catch (ParseException e) { return new Result(query, ErrorMessage.createBackendCommunicationError( "Failed to parse document selection string: " + e.getMessage() + "'.")); - } catch (TokenMgrError e) { + } catch (TokenMgrException e) { return new Result(query, ErrorMessage.createBackendCommunicationError( "Failed to tokenize document selection string: " + e.getMessage() + "'.")); } catch (TimeoutException e) { diff --git a/container-search/src/test/java/com/yahoo/search/grouping/request/GroupingOperationTestCase.java b/container-search/src/test/java/com/yahoo/search/grouping/request/GroupingOperationTestCase.java index cc834002fd8..1851f59c824 100644 --- a/container-search/src/test/java/com/yahoo/search/grouping/request/GroupingOperationTestCase.java +++ b/container-search/src/test/java/com/yahoo/search/grouping/request/GroupingOperationTestCase.java @@ -2,7 +2,7 @@ package com.yahoo.search.grouping.request; import com.yahoo.search.grouping.request.parser.ParseException; -import com.yahoo.search.grouping.request.parser.TokenMgrError; +import com.yahoo.search.grouping.request.parser.TokenMgrException; import org.junit.Test; import java.util.List; @@ -130,7 +130,7 @@ public class GroupingOperationTestCase { GroupingOperation.fromString("all(foo)"); fail(); } catch (IllegalArgumentException e) { - assertTrue(e.getMessage().startsWith("Encountered \"foo\" at line 1, column 5.\n")); + assertTrue(e.getMessage().startsWith("Encountered \" <IDENTIFIER> \"foo \"\" at line 1, column 5.\n")); assertTrue(e.getCause() instanceof ParseException); } } @@ -142,7 +142,7 @@ public class GroupingOperationTestCase { fail(); } catch (IllegalArgumentException e) { assertTrue(e.getMessage().startsWith("Lexical error at line 1, column 6.")); - assertTrue(e.getCause() instanceof TokenMgrError); + assertTrue(e.getCause() instanceof TokenMgrException); } } } diff --git a/container-search/src/test/java/com/yahoo/search/grouping/request/parser/GroupingParserTestCase.java b/container-search/src/test/java/com/yahoo/search/grouping/request/parser/GroupingParserTestCase.java index db1f2f59e8d..2c43873036e 100644 --- a/container-search/src/test/java/com/yahoo/search/grouping/request/parser/GroupingParserTestCase.java +++ b/container-search/src/test/java/com/yahoo/search/grouping/request/parser/GroupingParserTestCase.java @@ -167,15 +167,15 @@ public class GroupingParserTestCase { String expected = "all(group(foo) each(output(max(bar))))"; assertParse(" all(group(foo)each(output(max(bar))))", expected); - assertIllegalArgument("all (group(foo)each(output(max(bar))))", "Encountered \" \" at line 1, column 4."); + assertIllegalArgument("all (group(foo)each(output(max(bar))))", "Encountered \" <SPACE> \" \"\" at line 1, column 4."); assertParse("all( group(foo)each(output(max(bar))))", expected); - assertIllegalArgument("all(group (foo)each(output(max(bar))))", "Encountered \" \" at line 1, column 10."); + assertIllegalArgument("all(group (foo)each(output(max(bar))))", "Encountered \" <SPACE> \" \"\" at line 1, column 10."); assertParse("all(group( foo)each(output(max(bar))))", expected); assertParse("all(group(foo )each(output(max(bar))))", expected); assertParse("all(group(foo) each(output(max(bar))))", expected); - assertIllegalArgument("all(group(foo)each (output(max(bar))))", "Encountered \" \" at line 1, column 19."); + assertIllegalArgument("all(group(foo)each (output(max(bar))))", "Encountered \" <SPACE> \" \"\" at line 1, column 19."); assertParse("all(group(foo)each( output(max(bar))))", expected); - assertIllegalArgument("all(group(foo)each(output (max(bar))))", "Encountered \" \" at line 1, column 26."); + assertIllegalArgument("all(group(foo)each(output (max(bar))))", "Encountered \" <SPACE> \" \"\" at line 1, column 26."); assertParse("all(group(foo)each(output( max(bar))))", expected); assertParse("all(group(foo)each(output(max(bar))))", expected); assertParse("all(group(foo)each(output(max( bar))))", expected); @@ -333,7 +333,7 @@ public class GroupingParserTestCase { assertIllegalArgument("all(group(predefined(foo, bucket<-inf, inf>)))", "Bucket type mismatch, cannot both be infinity"); assertIllegalArgument("all(group(predefined(foo, bucket<inf, -inf>)))", - "Encountered \"inf\" at line 1, column 34."); + "Encountered \" \"inf\" \"inf \"\" at line 1, column 34."); assertIllegalArgument("all(group(predefined(foo, bucket(2, 1))))", "Bucket to-value can not be less than from-value."); @@ -342,7 +342,7 @@ public class GroupingParserTestCase { assertIllegalArgument("all(group(predefined(foo, bucket(b, a))))", "Bucket to-value can not be less than from-value."); assertIllegalArgument("all(group(predefined(foo, bucket(b, -inf))))", - "Encountered \"-inf\" at line 1, column 37."); + "Encountered \" \"-inf\" \"-inf \"\" at line 1, column 37."); assertIllegalArgument("all(group(predefined(foo, bucket(c, d), bucket(a, b))))", "Buckets must be monotonically increasing, got bucket[\"c\", \"d\"> before bucket[\"a\", \"b\">."); assertIllegalArgument("all(group(predefined(foo, bucket(c, d), bucket(-inf, e))))", @@ -386,19 +386,19 @@ public class GroupingParserTestCase { " each() as(baz))", "all(group(a) each(each() as(foo) each() as(bar)) each() as(baz))"); - assertIllegalArgument("all() as(foo)", "Encountered \"as\" at line 1, column 7."); - assertIllegalArgument("all(all() as(foo))", "Encountered \"as\" at line 1, column 11."); - assertIllegalArgument("each(all() as(foo))", "Encountered \"as\" at line 1, column 12."); + assertIllegalArgument("all() as(foo)", "Encountered \" \"as\" \"as \"\" at line 1, column 7."); + assertIllegalArgument("all(all() as(foo))", "Encountered \" \"as\" \"as \"\" at line 1, column 11."); + assertIllegalArgument("each(all() as(foo))", "Encountered \" \"as\" \"as \"\" at line 1, column 12."); } @Test public void testAttributeName() { assertParse("all(group(foo))"); assertIllegalArgument("all(group(foo.))", - "Encountered \")\" at line 1, column 15."); + "Encountered \" \")\" \") \"\" at line 1, column 15."); assertParse("all(group(foo.bar))"); assertIllegalArgument("all(group(foo.bar.))", - "Encountered \")\" at line 1, column 19."); + "Encountered \" \")\" \") \"\" at line 1, column 19."); assertParse("all(group(foo.bar.baz))"); } @@ -410,7 +410,7 @@ public class GroupingParserTestCase { "all(output(min(a) as(foo), max(b) as(bar)))"); assertIllegalArgument("all(output(min(a)) as(foo))", - "Encountered \"as\" at line 1, column 20."); + "Encountered \" \"as\" \"as \"\" at line 1, column 20."); } @Test @@ -423,11 +423,11 @@ public class GroupingParserTestCase { @Test public void testParseBadRequest() { assertIllegalArgument("output(count())", - "Encountered \"output\" at line 1, column 1."); + "Encountered \" \"output\" \"output \"\" at line 1, column 1."); assertIllegalArgument("each(output(count()))", "Expression 'count()' not applicable for single hit."); assertIllegalArgument("all(output(count())))", - "Encountered \")\" at line 1, column 21."); + "Encountered \" \")\" \") \"\" at line 1, column 21."); } @Test @@ -541,16 +541,16 @@ public class GroupingParserTestCase { assertParse("all(group(debugwait(artist, 3.3, true)))"); assertParse("all(group(debugwait(artist, 3.3, false)))"); assertIllegalArgument("all(group(debugwait(artist, -3.3, true)))", - "Encountered \"-\" at line 1, column 29"); + "Encountered \" \"-\" \"- \"\" at line 1, column 29"); assertIllegalArgument("all(group(debugwait(artist, 3.3, lol)))", - "Encountered \"lol\" at line 1, column 34"); + "Encountered \" <IDENTIFIER> \"lol \"\" at line 1, column 34"); assertParse("all(group(artist) each(output(stddev(simple))))"); } @Test public void requireThatParseExceptionMessagesContainErrorMarker() { assertIllegalArgument("foo", - "Encountered \"foo\" at line 1, column 1.\n" + + "Encountered \" <IDENTIFIER> \"foo \"\" at line 1, column 1.\n" + "Was expecting one of:\n" + " <SPACE> ...\n" + " \"all\" ...\n" + @@ -560,7 +560,7 @@ public class GroupingParserTestCase { "foo\n" + "^"); assertIllegalArgument("\n foo", - "Encountered \"foo\" at line 2, column 2.\n" + + "Encountered \" <IDENTIFIER> \"foo \"\" at line 2, column 2.\n" + "Was expecting one of:\n" + " <SPACE> ...\n" + " \"all\" ...\n" + diff --git a/container-search/src/test/java/com/yahoo/vespa/streamingvisitors/VdsStreamingSearcherTestCase.java b/container-search/src/test/java/com/yahoo/vespa/streamingvisitors/VdsStreamingSearcherTestCase.java index d767d06104c..c8c653d67ed 100644 --- a/container-search/src/test/java/com/yahoo/vespa/streamingvisitors/VdsStreamingSearcherTestCase.java +++ b/container-search/src/test/java/com/yahoo/vespa/streamingvisitors/VdsStreamingSearcherTestCase.java @@ -2,7 +2,7 @@ package com.yahoo.vespa.streamingvisitors; import com.yahoo.config.subscription.ConfigGetter; -import com.yahoo.document.select.parser.TokenMgrError; +import com.yahoo.document.select.parser.TokenMgrException; import com.yahoo.messagebus.routing.Route; import com.yahoo.prelude.fastsearch.DocumentdbInfoConfig; import com.yahoo.document.select.parser.ParseException; @@ -55,7 +55,7 @@ public class VdsStreamingSearcherTestCase { if (queryString.compareTo("parseexception") == 0) { throw new ParseException("Parsing failed"); } else if (queryString.compareTo("tokenizeexception") == 0) { - throw new TokenMgrError("Tokenization failed", 0); + throw new TokenMgrException("Tokenization failed", 0); } else if (queryString.compareTo("interruptedexception") == 0) { throw new InterruptedException("Interrupted"); } else if (queryString.compareTo("timeoutexception") == 0) { diff --git a/document/pom.xml b/document/pom.xml index 10f71218422..9357e87bb76 100644 --- a/document/pom.xml +++ b/document/pom.xml @@ -112,18 +112,15 @@ </executions> </plugin> <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>javacc-maven-plugin</artifactId> + <groupId>com.helger.maven</groupId> + <artifactId>ph-javacc-maven-plugin</artifactId> + <version>4.0.3</version> <executions> <execution> - <id>javacc</id> + <phase>generate-sources</phase> <goals> <goal>javacc</goal> </goals> - <configuration> - <lookAhead>1</lookAhead> - <isStatic>false</isStatic> - </configuration> </execution> </executions> </plugin> diff --git a/document/src/main/java/com/yahoo/document/select/BucketSelector.java b/document/src/main/java/com/yahoo/document/select/BucketSelector.java index a3dfed98378..41a0d9fd87b 100644 --- a/document/src/main/java/com/yahoo/document/select/BucketSelector.java +++ b/document/src/main/java/com/yahoo/document/select/BucketSelector.java @@ -5,7 +5,7 @@ import com.yahoo.document.BucketIdFactory; import com.yahoo.document.select.parser.ParseException; import com.yahoo.document.select.parser.SelectInput; import com.yahoo.document.select.parser.SelectParser; -import com.yahoo.document.select.parser.TokenMgrError; +import com.yahoo.document.select.parser.TokenMgrException; import com.yahoo.document.select.simple.SelectionParser; /** @@ -53,7 +53,7 @@ public class BucketSelector { SelectParser parser = new SelectParser(new SelectInput(selector)); return parser.expression().getBucketSet(factory); } - } catch (TokenMgrError e) { + } catch (TokenMgrException e) { ParseException t = new ParseException(); throw (ParseException) t.initCause(e); } catch (RuntimeException e) { diff --git a/document/src/main/java/com/yahoo/document/select/DocumentSelector.java b/document/src/main/java/com/yahoo/document/select/DocumentSelector.java index 270b70b92d3..7f5b92ea233 100644 --- a/document/src/main/java/com/yahoo/document/select/DocumentSelector.java +++ b/document/src/main/java/com/yahoo/document/select/DocumentSelector.java @@ -5,7 +5,7 @@ import com.yahoo.document.DocumentOperation; import com.yahoo.document.select.parser.ParseException; import com.yahoo.document.select.parser.SelectInput; import com.yahoo.document.select.parser.SelectParser; -import com.yahoo.document.select.parser.TokenMgrError; +import com.yahoo.document.select.parser.TokenMgrException; import com.yahoo.document.select.rule.ExpressionNode; /** @@ -32,7 +32,7 @@ public class DocumentSelector { try { SelectParser parser = new SelectParser(input); expression = parser.expression(); - } catch (TokenMgrError e) { + } catch (TokenMgrException e) { ParseException t = new ParseException("Tokenization error parsing document selector '" + selector + "'"); throw (ParseException)t.initCause(e); } catch (RuntimeException | ParseException e) { diff --git a/document/src/test/java/com/yahoo/document/select/DocumentSelectorTestCase.java b/document/src/test/java/com/yahoo/document/select/DocumentSelectorTestCase.java index 54f3870fdfd..1764079e897 100644 --- a/document/src/test/java/com/yahoo/document/select/DocumentSelectorTestCase.java +++ b/document/src/test/java/com/yahoo/document/select/DocumentSelectorTestCase.java @@ -5,7 +5,7 @@ import com.yahoo.document.*; import com.yahoo.document.datatypes.*; import com.yahoo.document.select.convert.SelectionExpressionConverter; import com.yahoo.document.select.parser.ParseException; -import com.yahoo.document.select.parser.TokenMgrError; +import com.yahoo.document.select.parser.TokenMgrException; import com.yahoo.yolean.Exceptions; import org.junit.Before; import org.junit.Test; @@ -817,7 +817,7 @@ public class DocumentSelectorTestCase { } catch (ParseException e) { Throwable t = e; - if (t.getCause() instanceof TokenMgrError) { + if (t.getCause() instanceof TokenMgrException) { t = t.getCause(); } assertEquals(expectedError, Exceptions.toMessageString(t).substring(0, expectedError.length())); diff --git a/documentapi/pom.xml b/documentapi/pom.xml index 3781dfd93ac..059adf65e17 100644 --- a/documentapi/pom.xml +++ b/documentapi/pom.xml @@ -94,18 +94,15 @@ </configuration> </plugin> <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>javacc-maven-plugin</artifactId> + <groupId>com.helger.maven</groupId> + <artifactId>ph-javacc-maven-plugin</artifactId> + <version>4.0.3</version> <executions> <execution> - <id>javacc</id> + <phase>generate-sources</phase> <goals> <goal>javacc</goal> </goals> - <configuration> - <lookAhead>1</lookAhead> - <isStatic>false</isStatic> - </configuration> </execution> </executions> </plugin> diff --git a/indexinglanguage/pom.xml b/indexinglanguage/pom.xml index f0aba8d9476..5b234c4695f 100644 --- a/indexinglanguage/pom.xml +++ b/indexinglanguage/pom.xml @@ -87,18 +87,15 @@ </executions> </plugin> <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>javacc-maven-plugin</artifactId> + <groupId>com.helger.maven</groupId> + <artifactId>ph-javacc-maven-plugin</artifactId> + <version>4.0.3</version> <executions> <execution> - <id>javacc</id> + <phase>generate-sources</phase> <goals> <goal>javacc</goal> </goals> - <configuration> - <lookAhead>1</lookAhead> - <isStatic>false</isStatic> - </configuration> </execution> </executions> </plugin> diff --git a/indexinglanguage/src/main/java/com/yahoo/vespa/indexinglanguage/ScriptParser.java b/indexinglanguage/src/main/java/com/yahoo/vespa/indexinglanguage/ScriptParser.java index ed8b0918bf3..0bc82535ad8 100644 --- a/indexinglanguage/src/main/java/com/yahoo/vespa/indexinglanguage/ScriptParser.java +++ b/indexinglanguage/src/main/java/com/yahoo/vespa/indexinglanguage/ScriptParser.java @@ -8,7 +8,7 @@ import com.yahoo.vespa.indexinglanguage.expressions.StatementExpression; import com.yahoo.vespa.indexinglanguage.parser.CharStream; import com.yahoo.vespa.indexinglanguage.parser.IndexingParser; import com.yahoo.vespa.indexinglanguage.parser.ParseException; -import com.yahoo.vespa.indexinglanguage.parser.TokenMgrError; +import com.yahoo.vespa.indexinglanguage.parser.TokenMgrException; /** * @author Simon Thoresen Hult @@ -43,7 +43,7 @@ public final class ScriptParser { try { return parser.statement(); } - catch (TokenMgrError e) { + catch (TokenMgrException e) { throw new ParseException(e.getMessage()); } } diff --git a/metrics/pom.xml b/metrics/pom.xml index 628ab66552d..55556c2cb37 100644 --- a/metrics/pom.xml +++ b/metrics/pom.xml @@ -94,23 +94,6 @@ </executions> </plugin> <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>javacc-maven-plugin</artifactId> - <version>2.6</version> - <executions> - <execution> - <id>javacc</id> - <goals> - <goal>javacc</goal> - </goals> - <configuration> - <lookAhead>1</lookAhead> - <isStatic>false</isStatic> - </configuration> - </execution> - </executions> - </plugin> - <plugin> <groupId>com.yahoo.vespa</groupId> <artifactId>config-class-plugin</artifactId> <version>${project.version}</version> diff --git a/searchlib/pom.xml b/searchlib/pom.xml index 108a17e3638..f3785881265 100644 --- a/searchlib/pom.xml +++ b/searchlib/pom.xml @@ -84,18 +84,15 @@ </configuration> </plugin> <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>javacc-maven-plugin</artifactId> + <groupId>com.helger.maven</groupId> + <artifactId>ph-javacc-maven-plugin</artifactId> + <version>4.0.3</version> <executions> <execution> - <id>javacc</id> + <phase>generate-sources</phase> <goals> <goal>javacc</goal> </goals> - <configuration> - <lookAhead>1</lookAhead> - <isStatic>false</isStatic> - </configuration> </execution> </executions> </plugin> diff --git a/searchlib/src/main/java/com/yahoo/searchlib/rankingexpression/FeatureList.java b/searchlib/src/main/java/com/yahoo/searchlib/rankingexpression/FeatureList.java index 85c7731a298..8b5a1fbf687 100755 --- a/searchlib/src/main/java/com/yahoo/searchlib/rankingexpression/FeatureList.java +++ b/searchlib/src/main/java/com/yahoo/searchlib/rankingexpression/FeatureList.java @@ -4,7 +4,7 @@ package com.yahoo.searchlib.rankingexpression; import com.google.common.annotations.Beta; import com.yahoo.searchlib.rankingexpression.parser.ParseException; import com.yahoo.searchlib.rankingexpression.parser.RankingExpressionParser; -import com.yahoo.searchlib.rankingexpression.parser.TokenMgrError; +import com.yahoo.searchlib.rankingexpression.parser.TokenMgrException; import com.yahoo.searchlib.rankingexpression.rule.ReferenceNode; import java.io.*; @@ -65,7 +65,7 @@ public class FeatureList implements Iterable<ReferenceNode> { try { lst = new RankingExpressionParser(reader).featureList(); } - catch (TokenMgrError e) { + catch (TokenMgrException e) { ParseException t = new ParseException(); throw (ParseException)t.initCause(e); } diff --git a/searchlib/src/main/java/com/yahoo/searchlib/rankingexpression/RankingExpression.java b/searchlib/src/main/java/com/yahoo/searchlib/rankingexpression/RankingExpression.java index 34445a31ac3..ed82ba20fbe 100755 --- a/searchlib/src/main/java/com/yahoo/searchlib/rankingexpression/RankingExpression.java +++ b/searchlib/src/main/java/com/yahoo/searchlib/rankingexpression/RankingExpression.java @@ -5,7 +5,7 @@ import com.yahoo.searchlib.rankingexpression.evaluation.Context; import com.yahoo.searchlib.rankingexpression.evaluation.Value; import com.yahoo.searchlib.rankingexpression.parser.ParseException; import com.yahoo.searchlib.rankingexpression.parser.RankingExpressionParser; -import com.yahoo.searchlib.rankingexpression.parser.TokenMgrError; +import com.yahoo.searchlib.rankingexpression.parser.TokenMgrException; import com.yahoo.searchlib.rankingexpression.rule.ExpressionNode; import com.yahoo.searchlib.rankingexpression.rule.SerializationContext; import com.yahoo.tensor.TensorType; @@ -177,7 +177,7 @@ public class RankingExpression implements Serializable { try { return new RankingExpressionParser(reader).rankingExpression(); } - catch (TokenMgrError e) { + catch (TokenMgrException e) { throw new ParseException(e.getMessage()); } } diff --git a/vdslib/pom.xml b/vdslib/pom.xml index 5063489ed66..d2fedcb1143 100644 --- a/vdslib/pom.xml +++ b/vdslib/pom.xml @@ -65,23 +65,6 @@ </configuration> </plugin> <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>javacc-maven-plugin</artifactId> - <version>2.6</version> - <executions> - <execution> - <id>javacc</id> - <goals> - <goal>javacc</goal> - </goals> - <configuration> - <lookAhead>1</lookAhead> - <isStatic>false</isStatic> - </configuration> - </execution> - </executions> - </plugin> - <plugin> <groupId>com.yahoo.vespa</groupId> <artifactId>config-class-plugin</artifactId> <version>${project.version}</version> diff --git a/vespajlib/src/main/java/com/yahoo/javacc/FastCharStream.java b/vespajlib/src/main/java/com/yahoo/javacc/FastCharStream.java index 4084115eb8f..57376734030 100644 --- a/vespajlib/src/main/java/com/yahoo/javacc/FastCharStream.java +++ b/vespajlib/src/main/java/com/yahoo/javacc/FastCharStream.java @@ -14,6 +14,8 @@ public class FastCharStream { private final char[] inputArr; private int tokenPos = 0; private int readPos = 0; + private int tabSize = 1; + private boolean trackLineColumn = true; public FastCharStream(String input) { this.inputStr = input; @@ -27,16 +29,6 @@ public class FastCharStream { return inputArr[readPos++]; } - @Deprecated - public int getColumn() { - return getEndColumn(); - } - - @Deprecated - public int getLine() { - return getEndLine(); - } - public int getEndColumn() { return readPos + 1; } @@ -75,6 +67,14 @@ public class FastCharStream { } + public void setTabSize(int i) { tabSize = i; } + + public int getTabSize() { return tabSize; } + + public void setTrackLineColumn(boolean tlc) { trackLineColumn = tlc; } + + public boolean getTrackLineColumn() { return trackLineColumn; } + public String formatException(String parseException) { int errPos = findErrPos(parseException); if (errPos < 0 || errPos > inputArr.length + 1) { |