summaryrefslogtreecommitdiffstats
path: root/integration
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@gmail.com>2022-05-27 14:11:42 +0200
committerJon Bratseth <bratseth@gmail.com>2022-05-27 14:11:42 +0200
commit9b01bb77dcc3adf5127644f392ed36c5966eec72 (patch)
tree9da47adb73c7dd7cac98b136a5327cbc22ad3409 /integration
parent8a2d52aeca57a67c669fc745057456d0f19e57cb (diff)
Grammar fixes
Diffstat (limited to 'integration')
-rw-r--r--integration/intellij/src/main/bnf/ai/vespa/intellij/schema/parser/sd.bnf11
-rw-r--r--integration/intellij/src/main/jflex/ai/vespa/intellij/schema/lexer/sd.flex4
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; }
}