summaryrefslogtreecommitdiffstats
path: root/integration/intellij/src
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@gmail.com>2022-04-25 18:32:59 +0200
committerJon Bratseth <bratseth@gmail.com>2022-04-25 18:32:59 +0200
commit70b52e53733914702e38f82cb0308e8024fbacef (patch)
tree134f8f319ca94908c577d04dd979f180b22c9245 /integration/intellij/src
parent2d2a7d4a0bd306c7f9056fe80514af2e3a7d2661 (diff)
Faster lambda parsing
Diffstat (limited to 'integration/intellij/src')
-rw-r--r--integration/intellij/src/main/bnf/ai/vespa/intellij/schema/parser/sd.bnf8
1 files changed, 5 insertions, 3 deletions
diff --git a/integration/intellij/src/main/bnf/ai/vespa/intellij/schema/parser/sd.bnf b/integration/intellij/src/main/bnf/ai/vespa/intellij/schema/parser/sd.bnf
index cb4bc024c86..b0e0e5e61dc 100644
--- a/integration/intellij/src/main/bnf/ai/vespa/intellij/schema/parser/sd.bnf
+++ b/integration/intellij/src/main/bnf/ai/vespa/intellij/schema/parser/sd.bnf
@@ -111,7 +111,7 @@ AnnotationFieldDefinition ::= field IdentifierVal type FieldTypeName '{' '}'
// The *Expr alternatives are consumed greedily so order matters.
//-------------------------
RankingExpression ::= LiteralTensorExpr | FilePathExpr | ParenthesisedExpr | BooleanExpr | ArithmeticExpr | IfFunctionExpr |
- QueryDefinitionExpr | FunctionCallExpr | InListRankingExpr | PrimitiveExpr | SliceExpr | LambdaExpr
+ QueryDefinitionExpr | FunctionCallOrLambdaExpr | InListRankingExpr | PrimitiveExpr | SliceExpr
FilePathExpr ::= file ':' (FilePath | WordWrapper)
@@ -129,7 +129,9 @@ ArithmeticOperator ::= '+' | '-' | '*' | '/' | '%' | '^' | "||" | "&&"
QueryDefinitionExpr ::= QueryDefinition | ItemRawScoreDefinition
-FunctionCallExpr ::= IdentifierWithDashVal '(' RankingExpression (COMMA RankingExpression)* ')' ('.' IdentifierWithDashVal)?
+// Rough parsing but hard to do better due to greediness: If this is a lambda arg expressions must be identifiers
+FunctionCallOrLambdaExpr ::= IdentifierWithDashVal '(' RankingExpression (COMMA RankingExpression)* ')' ('.' IdentifierWithDashVal)?
+ ParenthesisedExpr? // This turns the function call into a lambda
ParenthesisedExpr ::= '(' RankingExpression ')'
@@ -152,7 +154,7 @@ TensorValue ::= CellAddress ':' RankingExpression
CellAddress ::= Label | FullTensorAddress
-LambdaExp ::= FunctionCallExpr ParenthesisedExpr
+LambdaExpr ::= IdentifierWithDashVal '(' IdentifierVal (COMMA IdentifierVal)* ')' ParenthesisedExpr
//-------------------------
//-- Rank Profile rules ---