diff options
author | Jon Bratseth <bratseth@gmail.com> | 2022-05-29 14:42:28 +0200 |
---|---|---|
committer | Jon Bratseth <bratseth@gmail.com> | 2022-05-29 14:42:28 +0200 |
commit | e2fc27c64bd4eaff7841caecdbd75e04534add4e (patch) | |
tree | 0c2a5e863aa2f81b72cc3e5f77535c856bd211b5 /integration/intellij | |
parent | bdbb54df9a0cc4058cb7cae17b2ef7c157f77321 (diff) |
Grammar fixes
Diffstat (limited to 'integration/intellij')
-rw-r--r-- | integration/intellij/src/main/bnf/ai/vespa/intellij/schema/parser/sd.bnf | 16 |
1 files changed, 8 insertions, 8 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 a013024b9b6..61140c76ba2 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 @@ -117,9 +117,9 @@ RankingExpression ::= RenameExpr | LiteralOrGenerateTensorExpr | FilePathExpr | FilePathExpr ::= file ':' (FilePath | WordWrapper) -IfFunctionExpr ::= "if" '(' (NL)* RankingExpression (NL)* COMMA (NL)* RankingExpression (NL)* COMMA (NL)* RankingExpression ')' +IfFunctionExpr ::= "if" '(' (NL)* RankingExpression CommaSeparator RankingExpression CommaSeparator RankingExpression ')' -InListRankingExpr ::= RankingExpression "in" '[' RankingExpression (COMMA RankingExpression)* ']' +InListRankingExpr ::= RankingExpression "in" '[' RankingExpression (CommaSeparator RankingExpression)* ']' BinaryExpr ::= RankingExpression (NL)* ( ArithmeticOperator | ComparisonOperator) (NL)* RankingExpression ArithmeticOperator ::= '+' | '-' | '*' | '/' | '%' | '^' | "||" | "&&" @@ -131,10 +131,10 @@ UnaryOperator ::= '!' | '-' RankFeatureExpr ::= RankFeature // The rename function allows lists of identifiers as arguments -RenameExpr ::= "rename" '(' RankingExpression ',' ( Arguments | ArgumentDefinition ) ',' ( Arguments | ArgumentDefinition ) ')' +RenameExpr ::= "rename" '(' RankingExpression CommaSeparator ( Arguments | ArgumentDefinition ) CommaSeparator ( Arguments | ArgumentDefinition ) ')' // Rough parsing but hard to do better due to greediness: If this is a lambda arg expressions must be identifiers -FunctionCallOrLambdaExpr ::= IdentifierVal (NL)* '(' RankingExpression ( (NL)* COMMA RankingExpression)* ')' ('.' IdentifierVal)? +FunctionCallOrLambdaExpr ::= IdentifierVal (NL)* '(' RankingExpression ( CommaSeparator RankingExpression)* ')' ('.' IdentifierVal)? ParenthesisedExpr? // This turns the function call into a lambda ParenthesisedExpr ::= (NL)* '(' (NL)* RankingExpression (NL)* ')' (NL)* @@ -146,7 +146,7 @@ SliceExpr ::= RankingExpression ( SliceKey | SliceIndex | FullTensorAddress ) SliceKey ::= BlockStart Label BlockEnd SliceIndex ::= '[' RankingExpression ']' -FullTensorAddress ::= BlockStart KeyValue ( (NL)* ',' (NL)* KeyValue )* BlockEnd +FullTensorAddress ::= BlockStart KeyValue ( CommaSeparator KeyValue )* BlockEnd KeyValue ::= IdentifierVal ':' ( RankingExpression | Label ) @@ -160,7 +160,7 @@ LiteralOrGenerateTensorExpr ::= TensorType ( TensorValue ::= MappedTensorValue | ArrayTensorValues MappedTensorValue ::= BlockStart MappedTensorBlock ( ',' MappedTensorBlock )* BlockEnd MappedTensorBlock ::= TensorAddress ':' ( TensorCellValue | ArrayTensorValues ) -ArrayTensorValues ::= (NL)* '[' (NL)* ( TensorCellValue | ArrayTensorValues ) ( (NL)* ',' (NL)* ( TensorCellValue | ArrayTensorValues ) )* (NL)* ']' (NL)* +ArrayTensorValues ::= (NL)* '[' (NL)* ( TensorCellValue | ArrayTensorValues ) ( CommaSeparator ( TensorCellValue | ArrayTensorValues ) )* (NL)* ']' (NL)* TensorAddress ::= Label | FullTensorAddress TensorCellValue ::= RankingExpression @@ -222,7 +222,7 @@ FunctionDefinition ::= (function | macro) inline? IdentifierVal Arguments implements=["ai.vespa.intellij.schema.psi.SdFunctionDefinitionInterface" "ai.vespa.intellij.schema.psi.SdNamedElement"] } -Arguments ::= '()' | ( '(' ArgumentDefinition ((NL)* COMMA (NL)* ArgumentDefinition)* ')' ) +Arguments ::= '()' | ( '(' ArgumentDefinition (CommaSeparator ArgumentDefinition)* ')' ) ArgumentDefinition ::= IdentifierVal { mixin="ai.vespa.intellij.schema.psi.impl.SdNamedElementImpl" @@ -375,7 +375,7 @@ DottedIdentifierWithDash ::= IdentifierWithDashVal ('.' IdentifierWithDashVal)* BlockStart ::= (NL)* '{' (NL)* BlockEnd ::= (NL)* '}' (NL)* - +CommaSeparator ::= (NL)* COMMA (NL)* AnyNumber ::= ('-')? ( FLOAT_REG | INTEGER_REG) // Those lists of keywords (KeywordOrIdentifier and KeywordNotIdentifier) have to be synchronized with sd.flex file. |