diff options
author | Jon Bratseth <bratseth@gmail.com> | 2022-05-27 14:11:42 +0200 |
---|---|---|
committer | Jon Bratseth <bratseth@gmail.com> | 2022-05-27 14:11:42 +0200 |
commit | 9b01bb77dcc3adf5127644f392ed36c5966eec72 (patch) | |
tree | 9da47adb73c7dd7cac98b136a5327cbc22ad3409 /integration | |
parent | 8a2d52aeca57a67c669fc745057456d0f19e57cb (diff) |
Grammar fixes
Diffstat (limited to 'integration')
-rw-r--r-- | integration/intellij/src/main/bnf/ai/vespa/intellij/schema/parser/sd.bnf | 11 | ||||
-rw-r--r-- | integration/intellij/src/main/jflex/ai/vespa/intellij/schema/lexer/sd.flex | 4 |
2 files changed, 9 insertions, 6 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 d90e46ec953..bcb34dd4552 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 @@ -25,7 +25,8 @@ tokenTypeClass="ai.vespa.intellij.schema.psi.SdTokenType" // Class which will be used to create leaf nodes. extends(".*Expr")=RankingExpression // Here to deal with left-recursion that happens in expressions - + + // 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_-]*' @@ -35,10 +36,10 @@ COMMA = 'regexp:[,]' //BLOCK_START = '{' //BLOCK_END = '}' - INTEGER_REG = 'regexp:[0-9]+' - FLOAT_REG = 'regexp:[0-9]+[.][0-9]+[e]?' + INTEGER_REG = 'regexp:[\-]?[0-9]+' + FLOAT_REG = 'regexp:[\-]?[0-9]+[.][0-9]+[e]?' STRING_REG = 'regexp:\"([^\"\\]*(\\.[^\"\\]*)*)\"' - STRING_REG_SINGLE_QUOTE = "regexp:'([^'\\]*(\\.[^'\\]*)*)'" // TODO: This appears not to work + STRING_REG_SINGLE_QUOTE = "regexp:'([^'\\]*(\\.[^'\\]*)*)'" WORD_REG = 'regexp:\w+' ] } @@ -199,7 +200,7 @@ StrictDefinition ::= strict ':' (true | false) InputsDefinition ::= inputs '{' InputDefinition* '}' InputDefinition ::= ( QueryFeature | IdentifierVal) (':')? - ( TensorType | "double" )? (':' ( TensorValue | FLOAT_REG | INTEGER_REG) )? + ( TensorType | "double" )? (':'? ( FLOAT_REG | INTEGER_REG | TensorValue ) )? FirstPhaseDefinition ::= first-phase '{' FirstPhaseBody '}' { mixin="ai.vespa.intellij.schema.psi.impl.SdFirstPhaseDefinitionMixin" } FirstPhaseBody ::= FirstPhaseBodyOptions* // Does not support zero-or-one occurrences 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 3947a9fb2eb..b1077f9187c 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 @@ -38,9 +38,10 @@ SYMBOL= [!$|:{}().\[\]] COMMA= [,] //BLOCK_START= \{ //BLOCK_END= \} -INTEGER = [0-9]+ +INTEGER = [-]?[0-9]+ FLOAT = {INTEGER}[.][0-9]+[e]? STRING = \"([^\"\\]*(\\.[^\"\\]*)*)\" +STRING_SINGLE_QUOTE = '([^'\\]*(\\.[^'\\]*)*)' WORD = \w+ @@ -249,6 +250,7 @@ WORD = \w+ {FLOAT} { return FLOAT_REG; } {WORD} { return WORD_REG; } {STRING} { return STRING_REG; } + {STRING_SINGLE_QUOTE} { return STRING_REG_SINGLE_QUOTE; } } |