aboutsummaryrefslogtreecommitdiffstats
path: root/integration
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@gmail.com>2022-05-28 11:58:33 +0200
committerJon Bratseth <bratseth@gmail.com>2022-05-28 11:58:33 +0200
commit330ffb3642c71079333f7f73cf4d1140c8c0a3d9 (patch)
treea95b1967eecda4b2cf2eb74d8888159d708ed562 /integration
parent8f4c6cc6e30440aca13f8a54daad73a35dc6cbd0 (diff)
Grammar fixes
Diffstat (limited to 'integration')
-rw-r--r--integration/intellij/src/main/bnf/ai/vespa/intellij/schema/parser/sd.bnf5
-rw-r--r--integration/intellij/src/main/java/ai/vespa/intellij/schema/findUsages/SdFindUsagesProvider.java3
-rw-r--r--integration/intellij/src/main/jflex/ai/vespa/intellij/schema/lexer/sd.flex4
3 files changed, 5 insertions, 7 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 527888cf95c..28d84ce123c 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,6 @@
// 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_-]*[a-zA-Z0-9_]'
WHITE_SPACE = 'regexp:\s+'
COMMENT = 'regexp:#.*'
SYMBOL = 'regexp:[!$|:{}().\[\]]'
@@ -366,14 +365,14 @@ WeightedSetProperty ::= create-if-nonexistent | remove-if-zero
DictionaryDefinition ::= dictionary ((':' DictionarySetting) | ('{' DictionarySetting* '}'))
DictionarySetting ::= hash | btree | cased | uncased
-private WordWrapper ::= KeywordOrIdentifier | KeywordNotIdentifier | ID_REG | ID_WITH_DASH_REG | WORD_REG
+private WordWrapper ::= KeywordOrIdentifier | KeywordNotIdentifier | ID_REG | IdentifierWithDashVal | WORD_REG
IdentifierVal ::= KeywordOrIdentifier | ID_REG { mixin="ai.vespa.intellij.schema.psi.impl.SdIdentifierMixin"
implements=["ai.vespa.intellij.schema.psi.SdIdentifier"]
}
DottedIdentifier ::= IdentifierVal ('.' IdentifierVal)*
-IdentifierWithDashVal ::= ID_WITH_DASH_REG | IdentifierVal { mixin="ai.vespa.intellij.schema.psi.impl.SdIdentifierMixin"
+IdentifierWithDashVal ::= IdentifierVal ('-' IdentifierVal)* { mixin="ai.vespa.intellij.schema.psi.impl.SdIdentifierMixin"
implements=["ai.vespa.intellij.schema.psi.SdIdentifier"]
}
DottedIdentifierWithDash ::= IdentifierWithDashVal ('.' IdentifierWithDashVal)*
diff --git a/integration/intellij/src/main/java/ai/vespa/intellij/schema/findUsages/SdFindUsagesProvider.java b/integration/intellij/src/main/java/ai/vespa/intellij/schema/findUsages/SdFindUsagesProvider.java
index f131fc58376..f2f60dfb7f3 100644
--- a/integration/intellij/src/main/java/ai/vespa/intellij/schema/findUsages/SdFindUsagesProvider.java
+++ b/integration/intellij/src/main/java/ai/vespa/intellij/schema/findUsages/SdFindUsagesProvider.java
@@ -24,7 +24,8 @@ public class SdFindUsagesProvider implements FindUsagesProvider {
public WordsScanner getWordsScanner() {
// TODO: Not used at the moment (?) as we search by brute force
return new DefaultWordsScanner(new SdLexerAdapter(),
- TokenSet.create(SdTypes.ID_REG, SdTypes.ID_WITH_DASH_REG, SdTypes.IDENTIFIER_VAL,
+ TokenSet.create(SdTypes.ID_REG,
+ SdTypes.IDENTIFIER_VAL,
SdTypes.IDENTIFIER_WITH_DASH_VAL),
TokenSet.create(SdTypes.COMMENT),
TokenSet.create(SdTypes.STRING_REG, SdTypes.INTEGER_REG, SdTypes.FLOAT_REG));
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 2af89b1fe27..e73b3e1b643 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,7 +29,6 @@ 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_-]*[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]+
@@ -237,8 +236,7 @@ WORD = \w+
// Here we check for character sequences which matches regular expressions defined above.
{ID} { return ID_REG; }
- {ID_WITH_DASH} { return ID_WITH_DASH_REG; }
-
+
{WHITE_SPACE} { return WHITE_SPACE; }
{COMMENT} { return COMMENT; }