eric6/QScintilla/Lexers/LexerCMake.py

changeset 6942
2602857055c5
parent 6874
5a3a39442711
child 7229
53054eb5b15a
equal deleted inserted replaced
6941:f99d60d6b59b 6942:2602857055c5
1 # -*- coding: utf-8 -*-
2
3 # Copyright (c) 2007 - 2019 Detlev Offenbach <detlev@die-offenbachs.de>
4 #
5
6 """
7 Module implementing a CMake lexer with some additional methods.
8 """
9
10 from __future__ import unicode_literals
11
12 from PyQt5.Qsci import QsciLexerCMake
13
14 from .Lexer import Lexer
15 import Preferences
16
17
18 class LexerCMake(Lexer, QsciLexerCMake):
19 """
20 Subclass to implement some additional lexer dependant methods.
21 """
22 def __init__(self, parent=None):
23 """
24 Constructor
25
26 @param parent parent widget of this lexer
27 """
28 QsciLexerCMake.__init__(self, parent)
29 Lexer.__init__(self)
30
31 self.commentString = "#"
32
33 self.keywordSetDescriptions = [
34 self.tr("Commands"),
35 self.tr("Parameters"),
36 self.tr("User defined"),
37 ]
38
39 def initProperties(self):
40 """
41 Public slot to initialize the properties.
42 """
43 self.setFoldAtElse(Preferences.getEditor("CMakeFoldAtElse"))
44
45 def isCommentStyle(self, style):
46 """
47 Public method to check, if a style is a comment style.
48
49 @param style style to check (integer)
50 @return flag indicating a comment style (boolean)
51 """
52 return style in [QsciLexerCMake.Comment]
53
54 def isStringStyle(self, style):
55 """
56 Public method to check, if a style is a string style.
57
58 @param style style to check (integer)
59 @return flag indicating a string style (boolean)
60 """
61 return style in [QsciLexerCMake.String]
62
63 def defaultKeywords(self, kwSet):
64 """
65 Public method to get the default keywords.
66
67 @param kwSet number of the keyword set (integer)
68 @return string giving the keywords (string) or None
69 """
70 return QsciLexerCMake.keywords(self, kwSet)

eric ide

mercurial