set styles for const
from prompt_toolkit.lexers import SimpleLexer
from prompt_toolkit.contrib.regular_languages.lexer import GrammarLexer
+from .redis_grammar import CONST
def get_lexer(command_groups, redis_grammar):
@@ -44,19 +45,9 @@ def get_lexer(command_groups, redis_grammar):
"type": SimpleLexer("class:string"),
"fields": SimpleLexer("class:field"),
"field": SimpleLexer("class:field"),
- # const
- "condition": SimpleLexer("class:const"),
- "operation": SimpleLexer("class:const"),
- "withscores": SimpleLexer("class:const"),
- "limit": SimpleLexer("class:const"),
- "match": SimpleLexer("class:const"),
- "count_const": SimpleLexer("class:const"),
- "type_const": SimpleLexer("class:const"),
- "position_choice": SimpleLexer("class:const"),
- "error": SimpleLexer("class:const"),
- "async": SimpleLexer("class:const"),
}
+ lexers_dict.update({key: SimpleLexer("class:const") for key in CONST})
lexers_dict.update({key: SimpleLexer("class:command") for key in command_groups})
lexer = GrammarLexer(redis_grammar, lexers=lexers_dict)
return lexer
