From de7ed16f71b54ab4ddc7d40ce67f918dfb9b5180 Mon Sep 17 00:00:00 2001 From: Patrick Arminio Date: Fri, 31 Dec 2021 13:29:26 +0100 Subject: [PATCH] Add docstring --- rich/syntax.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/rich/syntax.py b/rich/syntax.py index 7dd5922a3..759351907 100644 --- a/rich/syntax.py +++ b/rich/syntax.py @@ -351,6 +351,11 @@ def _get_token_color(self, token_type: TokenType) -> Optional[Color]: @property def lexer(self) -> Optional[Lexer]: + """The lexer for this syntax, or None if no lexer was found. + + Tries to find the lexer by name if a string was passed to the constructor. + """ + if isinstance(self._lexer, Lexer): return self._lexer try: