Skip to content

Commit 8612ae2

Browse files
committed
lexer changes
1 parent 3c7f8a9 commit 8612ae2

File tree

4 files changed

+17
-1
lines changed

4 files changed

+17
-1
lines changed

x-pack/plugin/esql/src/main/antlr/lexer/From.g4

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ lexer grammar From;
1111
//
1212
FROM : 'from' -> pushMode(FROM_MODE);
1313

14-
DEV_TIME_SERIES : {this.isDevVersion()}? 'ts' -> pushMode(FROM_MODE);
14+
DEV_TIME_SERIES : {this.hasMetricsCommand()}? 'ts' -> pushMode(FROM_MODE);
1515

1616
mode FROM_MODE;
1717
FROM_PIPE : PIPE -> type(PIPE), popMode;

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/parser/EsqlConfig.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,15 @@
88
package org.elasticsearch.xpack.esql.parser;
99

1010
import org.elasticsearch.Build;
11+
import org.elasticsearch.xpack.esql.action.EsqlCapabilities;
1112

1213
class EsqlConfig {
1314

1415
// versioning information
1516
boolean devVersion = Build.current().isSnapshot();
1617

18+
boolean metricsCommand = EsqlCapabilities.Cap.METRICS_COMMAND.isEnabled();
19+
1720
public boolean isDevVersion() {
1821
return devVersion;
1922
}
@@ -25,4 +28,12 @@ boolean isReleaseVersion() {
2528
public void setDevVersion(boolean dev) {
2629
this.devVersion = dev;
2730
}
31+
32+
public boolean hasMetricsCommand() {
33+
return metricsCommand;
34+
}
35+
36+
public void setMetricsCommand(boolean metricsCommand) {
37+
this.metricsCommand = metricsCommand;
38+
}
2839
}

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/parser/LexerConfig.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ boolean isDevVersion() {
2828
return config == null || config.isDevVersion();
2929
}
3030

31+
boolean hasMetricsCommand() {
32+
return config == null || config.hasMetricsCommand();
33+
}
34+
3135
void setEsqlConfig(EsqlConfig config) {
3236
this.config = config;
3337
}

x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/parser/GrammarInDevelopmentParsingTests.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ private EsqlParser parser() {
4545

4646
// manually disable dev mode (make it production)
4747
config.setDevVersion(false);
48+
config.setMetricsCommand(false);
4849
return parser;
4950
}
5051
}

0 commit comments

Comments
 (0)