diff options
author | Jon Bratseth <bratseth@gmail.com> | 2022-02-13 12:18:58 +0100 |
---|---|---|
committer | Jon Bratseth <bratseth@gmail.com> | 2022-02-13 12:18:58 +0100 |
commit | 05a4c4765c83b2d727650001d7ac9b7cc968e653 (patch) | |
tree | a398f551a0583523c318fc4d0e2eb7e767602222 /integration | |
parent | 627c32b8f4be7447f06635aaa0056d231030cf97 (diff) |
Parse tensor slice
Diffstat (limited to 'integration')
4 files changed, 23 insertions, 10 deletions
diff --git a/integration/intellij/build.gradle b/integration/intellij/build.gradle index 5529d3d7c15..53959d45a87 100644 --- a/integration/intellij/build.gradle +++ b/integration/intellij/build.gradle @@ -36,7 +36,7 @@ compileJava { } group 'ai.vespa' -version '1.0.3' // Also update pom.xml version if this is changed +version '1.1.0' // Also update pom.xml version if this is changed sourceCompatibility = 11 diff --git a/integration/intellij/pom.xml b/integration/intellij/pom.xml index 866f1887443..6f84c430db3 100644 --- a/integration/intellij/pom.xml +++ b/integration/intellij/pom.xml @@ -9,7 +9,7 @@ <relativePath>../parent/pom.xml</relativePath> </parent> <artifactId>vespa-intellij</artifactId> <!-- Not used - plugin is build by gradle --> - <version>1.0.3</version> <!-- See copy-zip below, which depends on this being the same as the v. in build.gradle --> + <version>1.1.0</version> <!-- See copy-zip below, which depends on this being the same as the v. in build.gradle --> <description> Maven wrapper for the gradle build of this IntelliJ plugin. </description> 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 a0c3d22f5a7..330c074fde8 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 @@ -38,7 +38,7 @@ ARITHMETIC_OPERATOR = 'regexp:[\-+*/%]' INTEGER_REG = 'regexp:[0-9]+' FLOAT_REG = 'regexp:[0-9]+[.][0-9]+[e]?' - STRING_REG = 'regexp:\"([^\"\\]*(\\.[^\"\\]*)*)\"' + STRING_REG = 'regexp:\"([^\"\\]*(\\.[^\"\\]*)*)\"' // TODO: Should also support single-quotes WORD_REG = 'regexp:\w+' ] } @@ -108,13 +108,15 @@ AnnotationFieldDefinition ::= field IdentifierVal type FieldTypeName '{' '}' //------------------------- //--- Expressions rules --- +// Note - these must end by "Expr" - see this line above: extends(".*Expr")=RankingExpression //------------------------- -RankingExpression ::= FilePathExpr | ParenthesisedExpr | BooleanExpr | ArithmeticExpr | IfFunctionExpr | - QueryDefinitionExpr | FunctionCallExpr | InListRankingExpr | PrimitiveExpr | TensorExpr +RankingExpression ::= FilePathExpr | ParenthesisedExpr | BooleanExpr | ArithmeticExpr | IfFunctionExpr | + QueryDefinitionExpr | FunctionCallExpr | InListRankingExpr | PrimitiveExpr | SliceExpr FilePathExpr ::= file ':' (FilePath | WordWrapper) -IfFunctionExpr ::= "if" '(' (InListRankingExpr | RankingExpression) COMMA RankingExpression COMMA RankingExpression ')' +IfFunctionExpr ::= "if" '(' RankingExpression COMMA RankingExpression COMMA RankingExpression ')' + InListRankingExpr ::= RankingExpression "in" '[' RankingExpression (COMMA RankingExpression)* ']' BooleanExpr ::= RankingExpression COMPARISON_OPERATOR RankingExpression @@ -127,9 +129,19 @@ FunctionCallExpr ::= IdentifierWithDashVal '(' RankingExpression (COMMA RankingE ParenthesisedExpr ::= '(' RankingExpression ')' -PrimitiveExpr ::= (('-')? INTEGER_REG) | (('-')? FLOAT_REG) | IdentifierVal | RankFeature | STRING_REG +PrimitiveExpr ::= ( (('-')? INTEGER_REG) | (('-')? FLOAT_REG) | IdentifierVal | RankFeature | STRING_REG ) + +SliceExpr ::= RankingExpression ( MapSlice | IndexSlice | TensorAddress ) + +MapSlice ::= '{' Label '}' + +IndexSlice ::= '[' RankingExpression ']' + +TensorAddress ::= '{' KeyValue ( ',' KeyValue )* '}' + +KeyValue ::= IdentifierVal ':' ( Label | RankingExpression ) -TensorExpr ::= RankingExpression '{' IdentifierVal '}' +Label ::= IdentifierVal | STRING_REG //------------------------- //-- Rank Profile rules --- diff --git a/integration/intellij/src/test/applications/rankprofilemodularity/test.sd b/integration/intellij/src/test/applications/rankprofilemodularity/test.sd index 78645fd4cce..ad977f56051 100644 --- a/integration/intellij/src/test/applications/rankprofilemodularity/test.sd +++ b/integration/intellij/src/test/applications/rankprofilemodularity/test.sd @@ -20,8 +20,9 @@ schema test { expression: nativeRank } - function tensorFunction(myTensor) { - expression: myTensor{key} + function tensorFunction(tensor1, tensor2, tensor3, tensor4, tensor) { + expression: tensor1{key} + tensor2[1] + tensor3{key:key1,x:1} + tensor4{key:key1,x:(3-2)} + + tensor1{"key"} + tensor3{key:"key1",x:1} } } |