aboutsummaryrefslogtreecommitdiffstats
path: root/container-search/src/main
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@vespa.ai>2023-07-16 22:37:41 +0200
committerJon Bratseth <bratseth@vespa.ai>2023-07-16 22:37:41 +0200
commit5dc8c434f2be1d19e2a2f8e05180c2965e35f09e (patch)
tree3d80db7f7adca745c56dca86cfa69faf4baecaad /container-search/src/main
parent8eb009d276f9ab6b6774d8a4f44575f502def059 (diff)
Support comparison productions
Diffstat (limited to 'container-search/src/main')
-rw-r--r--container-search/src/main/javacc/com/yahoo/prelude/semantics/parser/SemanticsParser.jj16
1 files changed, 13 insertions, 3 deletions
diff --git a/container-search/src/main/javacc/com/yahoo/prelude/semantics/parser/SemanticsParser.jj b/container-search/src/main/javacc/com/yahoo/prelude/semantics/parser/SemanticsParser.jj
index 39ea6435393..a5953964b39 100644
--- a/container-search/src/main/javacc/com/yahoo/prelude/semantics/parser/SemanticsParser.jj
+++ b/container-search/src/main/javacc/com/yahoo/prelude/semantics/parser/SemanticsParser.jj
@@ -274,7 +274,8 @@ TermProduction nonphraseTermProduction() :
TermProduction termProduction;
}
{
- ( termProduction = referenceTermProduction() |
+ ( LOOKAHEAD(2)
+ termProduction = referenceTermProduction() |
termProduction = literalTermProduction() )
{
return termProduction;
@@ -314,8 +315,10 @@ ReferenceTermProduction referenceTermProduction() :
{
String reference;
boolean produceAll = false;
+ String comparisonPrefix = "";
}
{
+ ( comparisonPrefix = comparisonPrefix() )?
<LEFTSQUAREBRACKET>
reference = referenceIdentifier()
(<STAR> { produceAll = true; })?
@@ -326,10 +329,17 @@ ReferenceTermProduction referenceTermProduction() :
LiteralTermProduction literalTermProduction() :
{
String literal;
+ String comparisonPrefix = "";
}
{
- literal = identifier()
- { return new LiteralTermProduction(literal); }
+ ( ( comparisonPrefix = comparisonPrefix() )? literal = identifier() )
+ { return new LiteralTermProduction(comparisonPrefix + literal); }
+}
+
+String comparisonPrefix() : {}
+{
+ <SMALLER> { return "<"; } |
+ <LARGER> { return ">"; }
}
TermType termType() :