From 330ffb3642c71079333f7f73cf4d1140c8c0a3d9 Mon Sep 17 00:00:00 2001 From: Jon Bratseth Date: Sat, 28 May 2022 11:58:33 +0200 Subject: Grammar fixes --- .../intellij/src/main/bnf/ai/vespa/intellij/schema/parser/sd.bnf | 5 ++--- .../ai/vespa/intellij/schema/findUsages/SdFindUsagesProvider.java | 3 ++- .../intellij/src/main/jflex/ai/vespa/intellij/schema/lexer/sd.flex | 4 +--- 3 files changed, 5 insertions(+), 7 deletions(-) (limited to 'integration') 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; } -- cgit v1.2.3