summaryrefslogtreecommitdiffstats
path: root/config-model/src/main/javacc
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@gmail.com>2022-05-11 11:17:06 +0200
committerJon Bratseth <bratseth@gmail.com>2022-05-11 11:17:06 +0200
commit57d93307b70651fa6fd74f1fabbf15dadc53841e (patch)
treeafacf2da33905defada2faf81723ede32776ffaf /config-model/src/main/javacc
parent4f5504d75359bc182fa25f0dc0f85354241c4f7f (diff)
Allow names with and without constant()/query() wrapping
Diffstat (limited to 'config-model/src/main/javacc')
-rw-r--r--config-model/src/main/javacc/IntermediateParser.jj41
1 files changed, 24 insertions, 17 deletions
diff --git a/config-model/src/main/javacc/IntermediateParser.jj b/config-model/src/main/javacc/IntermediateParser.jj
index c6898cdad0f..887bdb7f789 100644
--- a/config-model/src/main/javacc/IntermediateParser.jj
+++ b/config-model/src/main/javacc/IntermediateParser.jj
@@ -2080,10 +2080,24 @@ void input(ParsedRankProfile profile) :
Tensor defaultValue = null;
}
{
- reference = queryFeature() ( type = valueType(reference))? ( <COLON> (<NL>)* defaultValue = tensorValue(type) )?
+ reference = inputName() ( type = valueType(reference))? ( <COLON> (<NL>)* defaultValue = tensorValue(type) )?
{ profile.addInput(reference, new RankProfile.Input(reference, type, Optional.ofNullable(defaultValue))); }
}
+/** Returns the reference "query(name)" for both "query(name)" and "name". */
+Reference inputName() :
+{
+ String name;
+}
+{
+ (
+ ( <QUERY> "(" name = identifier() ")" )
+ |
+ name = identifier()
+ )
+ { return FeatureNames.asQueryFeature(name); }
+}
+
TensorType valueType(Reference reference) :
{
TensorType type;
@@ -2098,19 +2112,10 @@ TensorType valueType(Reference reference) :
{ return type; }
}
-Reference queryFeature() :
-{
- String argument;
-}
-{
- <QUERY> "(" argument = identifier() ")"
- { return Reference.simple("query", argument); }
-}
-
/**
- * This rule consumes a summary-features block of a rank profile.
+ * Consumes a summary-features block of a rank profile.
*
- * @param profile The rank profile to modify.
+ * @param profile the rank profile to modify
*/
void summaryFeatures(ParsedRankProfile profile) :
{
@@ -2143,9 +2148,9 @@ void strict(ParsedRankProfile profile) :
}
/**
- * This rule consumes a match-features block of a rank profile.
+ * Consumes a match-features block of a rank profile.
*
- * @param profile The rank profile to modify.
+ * @param profile the rank profile to modify
*/
void matchFeatures(ParsedRankProfile profile) :
{
@@ -2465,9 +2470,11 @@ Reference constantName() :
String name;
}
{
- ( <CONSTANT> "(" name = identifier() ")" )
- |
- name = identifier()
+ (
+ ( <CONSTANT> "(" name = identifier() ")" )
+ |
+ name = identifier()
+ )
{ return FeatureNames.asConstantFeature(name); }
}