|
1 # -*- coding: utf-8 -*- |
|
2 |
|
3 # Copyright (c) 2005 - 2022 Detlev Offenbach <detlev@die-offenbachs.de> |
|
4 # |
|
5 |
|
6 """ |
|
7 Module implementing a Makefile lexer with some additional methods. |
|
8 """ |
|
9 |
|
10 from PyQt6.Qsci import QsciLexerMakefile |
|
11 |
|
12 from .Lexer import Lexer |
|
13 |
|
14 |
|
15 class LexerMakefile(Lexer, QsciLexerMakefile): |
|
16 """ |
|
17 Subclass to implement some additional lexer dependant methods. |
|
18 """ |
|
19 def __init__(self, parent=None): |
|
20 """ |
|
21 Constructor |
|
22 |
|
23 @param parent parent widget of this lexer |
|
24 """ |
|
25 QsciLexerMakefile.__init__(self, parent) |
|
26 Lexer.__init__(self) |
|
27 |
|
28 self.commentString = "#" |
|
29 self._alwaysKeepTabs = True |
|
30 |
|
31 self.keywordSetDescriptions = [] |
|
32 |
|
33 def isCommentStyle(self, style): |
|
34 """ |
|
35 Public method to check, if a style is a comment style. |
|
36 |
|
37 @param style style to check (integer) |
|
38 @return flag indicating a comment style (boolean) |
|
39 """ |
|
40 return style in [QsciLexerMakefile.Comment] |
|
41 |
|
42 def isStringStyle(self, style): |
|
43 """ |
|
44 Public method to check, if a style is a string style. |
|
45 |
|
46 @param style style to check (integer) |
|
47 @return flag indicating a string style (boolean) |
|
48 """ |
|
49 return False |
|
50 |
|
51 def defaultKeywords(self, kwSet): |
|
52 """ |
|
53 Public method to get the default keywords. |
|
54 |
|
55 @param kwSet number of the keyword set (integer) |
|
56 @return string giving the keywords (string) or None |
|
57 """ |
|
58 return QsciLexerMakefile.keywords(self, kwSet) |