src/eric7/QScintilla/Lexers/LexerTeX.py

branch
eric7
changeset 9221
bf71ee032bb4
parent 9209
b99e7fd55fd3
child 9413
80c06d472826
equal deleted inserted replaced
9220:e9e7eca7efee 9221:bf71ee032bb4
17 17
18 class LexerTeX(Lexer, QsciLexerTeX): 18 class LexerTeX(Lexer, QsciLexerTeX):
19 """ 19 """
20 Subclass to implement some additional lexer dependant methods. 20 Subclass to implement some additional lexer dependant methods.
21 """ 21 """
22
22 def __init__(self, parent=None): 23 def __init__(self, parent=None):
23 """ 24 """
24 Constructor 25 Constructor
25 26
26 @param parent parent widget of this lexer 27 @param parent parent widget of this lexer
27 """ 28 """
28 QsciLexerTeX.__init__(self, parent) 29 QsciLexerTeX.__init__(self, parent)
29 Lexer.__init__(self) 30 Lexer.__init__(self)
30 31
31 self.commentString = "%" 32 self.commentString = "%"
32 33
33 self.keywordSetDescriptions = [ 34 self.keywordSetDescriptions = [
34 self.tr("TeX, eTeX, pdfTeX, Omega"), 35 self.tr("TeX, eTeX, pdfTeX, Omega"),
35 self.tr("ConTeXt Dutch"), 36 self.tr("ConTeXt Dutch"),
36 self.tr("ConTeXt English"), 37 self.tr("ConTeXt English"),
37 self.tr("ConTeXt German"), 38 self.tr("ConTeXt German"),
38 self.tr("ConTeXt Czech"), 39 self.tr("ConTeXt Czech"),
39 self.tr("ConTeXt Italian"), 40 self.tr("ConTeXt Italian"),
40 self.tr("ConTeXt Romanian"), 41 self.tr("ConTeXt Romanian"),
41 self.tr("LaTeX"), 42 self.tr("LaTeX"),
42 ] 43 ]
43 44
44 def initProperties(self): 45 def initProperties(self):
45 """ 46 """
46 Public slot to initialize the properties. 47 Public slot to initialize the properties.
47 """ 48 """
48 with contextlib.suppress(AttributeError): 49 with contextlib.suppress(AttributeError):
49 self.setFoldCompact(Preferences.getEditor("AllFoldCompact")) 50 self.setFoldCompact(Preferences.getEditor("AllFoldCompact"))
50 self.setFoldComments(Preferences.getEditor("TexFoldComment")) 51 self.setFoldComments(Preferences.getEditor("TexFoldComment"))
51 self.setProcessComments( 52 self.setProcessComments(Preferences.getEditor("TexProcessComments"))
52 Preferences.getEditor("TexProcessComments"))
53 self.setProcessIf(Preferences.getEditor("TexProcessIf")) 53 self.setProcessIf(Preferences.getEditor("TexProcessIf"))
54 54
55 def isCommentStyle(self, style): 55 def isCommentStyle(self, style):
56 """ 56 """
57 Public method to check, if a style is a comment style. 57 Public method to check, if a style is a comment style.
58 58
59 @param style style to check (integer) 59 @param style style to check (integer)
60 @return flag indicating a comment style (boolean) 60 @return flag indicating a comment style (boolean)
61 """ 61 """
62 return False 62 return False
63 63
64 def isStringStyle(self, style): 64 def isStringStyle(self, style):
65 """ 65 """
66 Public method to check, if a style is a string style. 66 Public method to check, if a style is a string style.
67 67
68 @param style style to check (integer) 68 @param style style to check (integer)
69 @return flag indicating a string style (boolean) 69 @return flag indicating a string style (boolean)
70 """ 70 """
71 return style in [QsciLexerTeX.Text] 71 return style in [QsciLexerTeX.Text]
72 72
73 def defaultKeywords(self, kwSet): 73 def defaultKeywords(self, kwSet):
74 """ 74 """
75 Public method to get the default keywords. 75 Public method to get the default keywords.
76 76
77 @param kwSet number of the keyword set (integer) 77 @param kwSet number of the keyword set (integer)
78 @return string giving the keywords (string) or None 78 @return string giving the keywords (string) or None
79 """ 79 """
80 texKeywords = ( 80 texKeywords = (
81 "above abovedisplayshortskip abovedisplayskip " 81 "above abovedisplayshortskip abovedisplayskip "
195 "eTeX newmarks grouptype interactionmode nodetype iftype " 195 "eTeX newmarks grouptype interactionmode nodetype iftype "
196 "tracingall loggingall tracingnone" 196 "tracingall loggingall tracingnone"
197 ) 197 )
198 if kwSet in (1, 2, 3, 4, 5, 6, 7): 198 if kwSet in (1, 2, 3, 4, 5, 6, 7):
199 return ( 199 return (
200 texKeywords + " " + etexKeywords + " " + 200 texKeywords
201 pdftexKeywords + " " + omegaKeywords + " " + macros 201 + " "
202 + etexKeywords
203 + " "
204 + pdftexKeywords
205 + " "
206 + omegaKeywords
207 + " "
208 + macros
202 ) 209 )
203 210
204 if kwSet == 8: 211 if kwSet == 8:
205 return ( 212 return texKeywords + " " + etexKeywords + " " + pdftexKeywords
206 texKeywords + " " + etexKeywords + " " + 213
207 pdftexKeywords
208 )
209
210 return None 214 return None

eric ide

mercurial