summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@oath.com>2021-03-19 13:55:21 +0100
committerGitHub <noreply@github.com>2021-03-19 13:55:21 +0100
commit2ae36302b553f85ffb50d91a390b4c5f04c26e42 (patch)
treef71746a4a808dfde8f4d980fcac40fc8a01fe25c
parent263a665335309681bba612624127b1323ed6fec7 (diff)
parentbcd73cb92c9ab6df5001386cebfc3cb2d0247db8 (diff)
Merge pull request #17047 from vespa-engine/bratseth/dash-in-source
Allow dash in ident as it is legal in source names
-rw-r--r--container-search/src/main/antlr4/com/yahoo/search/yql/yqlplus.g42
-rw-r--r--container-search/src/test/java/com/yahoo/search/yql/YqlParserTestCase.java6
2 files changed, 7 insertions, 1 deletions
diff --git a/container-search/src/main/antlr4/com/yahoo/search/yql/yqlplus.g4 b/container-search/src/main/antlr4/com/yahoo/search/yql/yqlplus.g4
index 8a6f2cf9e87..b7d443ea56c 100644
--- a/container-search/src/main/antlr4/com/yahoo/search/yql/yqlplus.g4
+++ b/container-search/src/main/antlr4/com/yahoo/search/yql/yqlplus.g4
@@ -131,7 +131,7 @@ options {
* LEXER RULES
*------------------------------------------------------------------*/
-ID : ('a'..'z'|'A'..'Z'|'_') ('a'..'z'|'A'..'Z'|'0'..'9'|'_'|':')*
+ID : ('a'..'z'|'A'..'Z'|'_') ('a'..'z'|'A'..'Z'|'0'..'9'|'_'|':'|'-')*
;
LONG_INT : '-'?'0'..'9'+ ('L'|'l')
diff --git a/container-search/src/test/java/com/yahoo/search/yql/YqlParserTestCase.java b/container-search/src/test/java/com/yahoo/search/yql/YqlParserTestCase.java
index 750afa2a37c..24c8e040051 100644
--- a/container-search/src/test/java/com/yahoo/search/yql/YqlParserTestCase.java
+++ b/container-search/src/test/java/com/yahoo/search/yql/YqlParserTestCase.java
@@ -693,6 +693,12 @@ public class YqlParserTestCase {
}
@Test
+ public void testSourcesWithDash() {
+ assertSources("select foo from source-a where price <= 500;",
+ Arrays.asList("source-a"));
+ }
+
+ @Test
public void testWildCardSources() {
assertSources("select foo from sources * where price <= 500;",
Collections.<String>emptyList());