eric6/QScintilla/Lexers/LexerSQL.py

changeset 8243
cc717c2ae956
parent 7923
91e843545d9a
equal deleted inserted replaced
8242:aa713ac50c0d 8243:cc717c2ae956
4 # 4 #
5 5
6 """ 6 """
7 Module implementing a SQL lexer with some additional methods. 7 Module implementing a SQL lexer with some additional methods.
8 """ 8 """
9
10 import contextlib
9 11
10 from PyQt5.Qsci import QsciLexerSQL 12 from PyQt5.Qsci import QsciLexerSQL
11 13
12 from .Lexer import Lexer 14 from .Lexer import Lexer
13 import Preferences 15 import Preferences
44 Public slot to initialize the properties. 46 Public slot to initialize the properties.
45 """ 47 """
46 self.setFoldComments(Preferences.getEditor("SqlFoldComment")) 48 self.setFoldComments(Preferences.getEditor("SqlFoldComment"))
47 self.setBackslashEscapes(Preferences.getEditor("SqlBackslashEscapes")) 49 self.setBackslashEscapes(Preferences.getEditor("SqlBackslashEscapes"))
48 self.setFoldCompact(Preferences.getEditor("AllFoldCompact")) 50 self.setFoldCompact(Preferences.getEditor("AllFoldCompact"))
49 try: 51 with contextlib.suppress(AttributeError):
50 self.setDottedWords(Preferences.getEditor("SqlDottedWords")) 52 self.setDottedWords(Preferences.getEditor("SqlDottedWords"))
51 self.setFoldAtElse(Preferences.getEditor("SqlFoldAtElse")) 53 self.setFoldAtElse(Preferences.getEditor("SqlFoldAtElse"))
52 self.setFoldOnlyBegin(Preferences.getEditor("SqlFoldOnlyBegin")) 54 self.setFoldOnlyBegin(Preferences.getEditor("SqlFoldOnlyBegin"))
53 self.setHashComments(Preferences.getEditor("SqlHashComments")) 55 self.setHashComments(Preferences.getEditor("SqlHashComments"))
54 self.setQuotedIdentifiers( 56 self.setQuotedIdentifiers(
55 Preferences.getEditor("SqlQuotedIdentifiers")) 57 Preferences.getEditor("SqlQuotedIdentifiers"))
56 except AttributeError:
57 pass
58 58
59 def isCommentStyle(self, style): 59 def isCommentStyle(self, style):
60 """ 60 """
61 Public method to check, if a style is a comment style. 61 Public method to check, if a style is a comment style.
62 62

eric ide

mercurial