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