aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@gmail.com>2024-03-04 15:50:03 +0100
committerGitHub <noreply@github.com>2024-03-04 15:50:03 +0100
commit277650b0550123dfc541977a055c2e6ee39d5083 (patch)
treee805cbdb6711c24306df13bbf60945b3b0d194b1
parentfff9eb914506e3c0a2e4536adfd2036b7f69f7f2 (diff)
parenta7ef19bb93d5359ebc7405b1fe59d0599d8d1d32 (diff)
Merge pull request #30451 from vespa-engine/arnej/detect-inputs-on-same-line
track inputs vs newlines and warn on missing newlines
-rw-r--r--config-model/src/main/javacc/SchemaParser.jj22
1 files changed, 19 insertions, 3 deletions
diff --git a/config-model/src/main/javacc/SchemaParser.jj b/config-model/src/main/javacc/SchemaParser.jj
index 7d251bd3514..255cc3cde70 100644
--- a/config-model/src/main/javacc/SchemaParser.jj
+++ b/config-model/src/main/javacc/SchemaParser.jj
@@ -2006,14 +2006,27 @@ void inputs(ParsedRankProfile profile) :
{
Reference reference;
TensorType type;
+ List<Reference> seenInputs = new ArrayList<>();
}
{
<INPUTS> <LBRACE> (<NL>)*
- ( input(profile) (<NL>)*) *
+ (
+ reference = input(profile) { seenInputs.add(reference); }
+ (<NL> { seenInputs.add(null); })*
+ )*
<RBRACE>
+ {
+ Reference last = null;
+ for (Reference current : seenInputs) {
+ if (last != null && current != null) {
+ deployLogger.logApplicationPackage(Level.WARNING, "Expected newline between inputs " + last + " and " + current);
+ }
+ last = current;
+ }
+ }
}
-void input(ParsedRankProfile profile) :
+Reference input(ParsedRankProfile profile) :
{
Reference reference;
InputType type = new InputType(TensorType.empty, false);
@@ -2021,7 +2034,10 @@ void input(ParsedRankProfile profile) :
}
{
reference = inputName() ( type = valueType(reference))? ( <COLON> (<NL>)* defaultValue = tensorValue(type.tensorType()) )?
- { profile.addInput(reference, new RankProfile.Input(reference, type, Optional.ofNullable(defaultValue))); }
+ {
+ profile.addInput(reference, new RankProfile.Input(reference, type, Optional.ofNullable(defaultValue)));
+ return reference;
+ }
}
/** Returns the reference "query(name)" for both "query(name)" and "name". */