summaryrefslogtreecommitdiffstats
path: root/integration
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@gmail.com>2022-05-28 10:18:47 +0200
committerJon Bratseth <bratseth@gmail.com>2022-05-28 10:18:47 +0200
commit8f4c6cc6e30440aca13f8a54daad73a35dc6cbd0 (patch)
tree2f5fb4d31c6160a66e47430d643b5be15ae9209d /integration
parent18f1e316be6d49e273d3495bf3dec5f27a26505c (diff)
Grammar fixes
Diffstat (limited to 'integration')
-rw-r--r--integration/intellij/src/main/bnf/ai/vespa/intellij/schema/parser/sd.bnf22
-rw-r--r--integration/intellij/src/main/jflex/ai/vespa/intellij/schema/lexer/sd.flex4
2 files changed, 13 insertions, 13 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 1208db2995a..527888cf95c 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
@@ -29,7 +29,7 @@
// NOTE: As far as I (Jon) can tell these are not used. Edit the ones in sd.flex instead.
tokens = [
ID_REG = 'regexp:[a-zA-Z_][a-zA-Z0-9_]*'
- ID_WITH_DASH_REG = 'regexp:[a-zA-Z_][a-zA-Z0-9_-]*'
+ ID_WITH_DASH_REG = 'regexp:[a-zA-Z_][a-zA-Z0-9_-]*[a-zA-Z0-9_]'
WHITE_SPACE = 'regexp:\s+'
COMMENT = 'regexp:#.*'
SYMBOL = 'regexp:[!$|:{}().\[\]]'
@@ -136,12 +136,12 @@ RankFeatureExpr ::= RankFeature
RenameExpr ::= "rename" '(' RankingExpression ',' ( Arguments | ArgumentDefinition ) ',' ( Arguments | ArgumentDefinition ) ')'
// 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)?
+FunctionCallOrLambdaExpr ::= IdentifierVal '(' RankingExpression (COMMA RankingExpression)* ')' ('.' IdentifierVal)?
ParenthesisedExpr? // This turns the function call into a lambda
ParenthesisedExpr ::= '(' RankingExpression ')'
-PrimitiveExpr ::= ( (('-')? INTEGER_REG) | (('-')? FLOAT_REG) | IdentifierVal | RankFeature | STRING_REG )
+PrimitiveExpr ::= ( INTEGER_REG | FLOAT_REG | IdentifierVal | RankFeature | STRING_REG )
SliceExpr ::= RankingExpression ( SliceKey | SliceIndex | FullTensorAddress )
@@ -183,17 +183,17 @@ private RankProfileBodyOptions ::= MatchPhaseDefinition | NumThreadsDefinition |
MatchPhaseDefinition ::= match-phase '{' MatchPhaseBody '}'
MatchPhaseBody ::= MatchPhaseBodyOptions+
-MatchPhaseBodyOptions ::= (attribute ':' DottedIdentifier) | (order ':' (ascending | descending)) | (max-hits ':' ('-')? INTEGER_REG)
- | DiversityDefinition | (evaluation-point ':' ('-')? FLOAT_REG) |
- (pre-post-filter-tipping-point ':' ('-')? FLOAT_REG) // Does not support zero-or-one occurrences
+MatchPhaseBodyOptions ::= (attribute ':' DottedIdentifier) | (order ':' (ascending | descending)) | (max-hits ':' INTEGER_REG)
+ | DiversityDefinition | (evaluation-point ':' FLOAT_REG) |
+ (pre-post-filter-tipping-point ':' FLOAT_REG) // Does not support zero-or-one occurrences
DiversityDefinition ::= diversity '{' DiversityBody '}'
DiversityBody ::= DiversityBodyOptions*
-private DiversityBodyOptions ::= (attribute ':' DottedIdentifier) | (min-groups ':' ('-')? INTEGER_REG) | (cutoff-factor ':' ('-')? FLOAT_REG) |
+private DiversityBodyOptions ::= (attribute ':' DottedIdentifier) | (min-groups ':' INTEGER_REG) | (cutoff-factor ':' FLOAT_REG) |
(cutoff-strategy ':' (strict | loose))
private NumThreadsDefinition ::= num-threads-per-search ':' INTEGER_REG
-private TermwiseLimitDefinition ::= termwise-limit ':' ('-')? (FLOAT_REG | INTEGER_REG)
-private MinHitsDefinition ::= min-hits-per-thread ':' ('-')? INTEGER_REG
+private TermwiseLimitDefinition ::= termwise-limit ':' (FLOAT_REG | INTEGER_REG)
+private MinHitsDefinition ::= min-hits-per-thread ':' INTEGER_REG
private NumSearchPartitionDefinition ::= num-search-partition ':' INTEGER_REG
FieldWeightDefinition ::= weight DottedIdentifier ':' INTEGER_REG
StrictDefinition ::= strict ':' (true | false)
@@ -204,7 +204,7 @@ InputDefinition ::= ( QueryFeature | IdentifierVal)
FirstPhaseDefinition ::= first-phase '{' FirstPhaseBody '}' { mixin="ai.vespa.intellij.schema.psi.impl.SdFirstPhaseDefinitionMixin" }
FirstPhaseBody ::= FirstPhaseBodyOptions* // Does not support zero-or-one occurrences
-private FirstPhaseBodyOptions ::= (keep-rank-count ':' INTEGER_REG) | (rank-score-drop-limit ':' ('-')? (FLOAT_REG | INTEGER_REG)) | ExpressionDefinition
+private FirstPhaseBodyOptions ::= (keep-rank-count ':' INTEGER_REG) | (rank-score-drop-limit ':' (FLOAT_REG | INTEGER_REG)) | ExpressionDefinition
ExpressionDefinition ::= expression ((':' RankingExpression) | ('{' RankingExpression* '}'))
@@ -215,7 +215,7 @@ private SecondPhaseBodyOptions ::= (rerank-count ':' INTEGER_REG) | ExpressionDe
RankPropertiesDefinition ::= rank-properties '{' RankPropertiesBody '}'
RankPropertiesBody ::= (RankPropertiesKey ':' RankPropertiesValue)+
RankPropertiesKey ::= (IdentifierWithDashVal | STRING_REG | '(' | ')' | '.' | COMMA | '$' | INTEGER_REG)+
-RankPropertiesValue ::= (('-')? INTEGER_REG) | (('-')? FLOAT_REG) | WORD_REG | DottedIdentifier | STRING_REG
+RankPropertiesValue ::= INTEGER_REG | FLOAT_REG | WORD_REG | DottedIdentifier | STRING_REG
FunctionDefinition ::= (function | macro) inline? IdentifierVal Arguments
'{' ExpressionDefinition '}'
diff --git a/integration/intellij/src/main/jflex/ai/vespa/intellij/schema/lexer/sd.flex b/integration/intellij/src/main/jflex/ai/vespa/intellij/schema/lexer/sd.flex
index b1077f9187c..2af89b1fe27 100644
--- a/integration/intellij/src/main/jflex/ai/vespa/intellij/schema/lexer/sd.flex
+++ b/integration/intellij/src/main/jflex/ai/vespa/intellij/schema/lexer/sd.flex
@@ -29,12 +29,12 @@ import static com.intellij.psi.TokenType.WHITE_SPACE; // Pre-defined whitespace
//**--------- REGEXES ---------**//
// If some character sequence is matched to this regex, it will be treated as an IDENTIFIER.
ID=[a-zA-Z_][a-zA-Z0-9_]*
-ID_WITH_DASH = [a-zA-Z_][a-zA-Z0-9_-]*
+ID_WITH_DASH = [a-zA-Z_][a-zA-Z0-9_-]*[a-zA-Z0-9_]
// If some character sequence is matched to this regex, it will be treated as a WHITE_SPACE.
WHITE_SPACE=[ \t\n\x0B\f\r]+
COMMENT=#.*
-SYMBOL= [!$|:{}().\[\]]
+SYMBOL= [;!$|:{}().\[\]]
COMMA= [,]
//BLOCK_START= \{
//BLOCK_END= \}