aboutsummaryrefslogtreecommitdiffstats
path: root/searchlib/src/main/javacc
diff options
context:
space:
mode:
authorLester Solbakken <lesters@oath.com>2021-01-07 14:32:45 +0100
committerLester Solbakken <lesters@oath.com>2021-01-07 14:32:45 +0100
commitd4ab3f6f55ba33bf4095158521493451a1828d65 (patch)
tree56e8a7f0c2a3bd5f4b4fbed62ab98aa27b50c68f /searchlib/src/main/javacc
parentf064d4c32d0b80bc72b60d708a27201281cceac9 (diff)
Revert "Allow expressions as arguments"
This reverts commit 3578f2b70312e681b11db97e6ead8997e2dd7d3c.
Diffstat (limited to 'searchlib/src/main/javacc')
-rwxr-xr-xsearchlib/src/main/javacc/RankingExpressionParser.jj22
1 files changed, 21 insertions, 1 deletions
diff --git a/searchlib/src/main/javacc/RankingExpressionParser.jj b/searchlib/src/main/javacc/RankingExpressionParser.jj
index 36b1f9627bb..09880b8dfc3 100755
--- a/searchlib/src/main/javacc/RankingExpressionParser.jj
+++ b/searchlib/src/main/javacc/RankingExpressionParser.jj
@@ -328,10 +328,30 @@ List<ExpressionNode> args() :
ExpressionNode argument;
}
{
- ( ( argument = expression() { arguments.add(argument); } ( <COMMA> argument = expression() { arguments.add(argument); } )* )? )
+ ( ( argument = arg() { arguments.add(argument); } ( <COMMA> argument = arg() { arguments.add(argument); } )* )? )
{ return arguments; }
}
+// TODO: Replace use of this for function arguments with value()
+// For that to work with the current search execution framework
+// we need to generate another function for the argument such that we can replace
+// instances of the argument with the reference to that function in the same way
+// as we replace by constants/names today (this can make for some fun combinatorial explosion).
+// We should also stop doing function expansion in the toString of a function.
+// - Jon 2014-05-02
+ExpressionNode arg() :
+{
+ ExpressionNode ret;
+ String name;
+ Function fnc;
+}
+{
+ ( ret = constantPrimitive() |
+ LOOKAHEAD(2) ret = feature() |
+ name = identifier() { ret = new NameNode(name); } )
+ { return ret; }
+}
+
ExpressionNode function() :
{
ExpressionNode function;