7 Module implementing a CPP lexer with some additional methods. |
7 Module implementing a CPP lexer with some additional methods. |
8 """ |
8 """ |
9 |
9 |
10 from __future__ import unicode_literals |
10 from __future__ import unicode_literals |
11 |
11 |
12 from PyQt5.QtCore import QCoreApplication |
|
13 from PyQt5.Qsci import QsciLexerCPP, QsciScintilla |
12 from PyQt5.Qsci import QsciLexerCPP, QsciScintilla |
14 |
13 |
15 from .SubstyledLexer import SubstyledLexer |
14 from .SubstyledLexer import SubstyledLexer |
16 import Preferences |
15 import Preferences |
17 |
16 |
44 |
43 |
45 ############################################################## |
44 ############################################################## |
46 ## default sub-style definitions |
45 ## default sub-style definitions |
47 ############################################################## |
46 ############################################################## |
48 |
47 |
|
48 diffToSecondary = 0x40 |
|
49 # This may need to be changed to be in line with Scintilla C++ lexer. |
|
50 |
49 # list of style numbers, that support sub-styling |
51 # list of style numbers, that support sub-styling |
50 self.baseStyles = [11, 17, 75, 81] |
52 self.baseStyles = [11, 17, 11 + diffToSecondary, 17 + diffToSecondary] |
51 |
53 |
52 self.defaultSubStyles = { |
54 self.defaultSubStyles = { |
53 11: { |
55 11: { |
54 0: { |
56 0: { |
55 "Description": QCoreApplication.translate( |
57 "Description": self.tr("Additional Identifier"), |
56 "LexerCPP", "Extra Identifiers"), |
|
57 "Words": "std map string vector", |
58 "Words": "std map string vector", |
58 "Style": { |
59 "Style": { |
59 "fore": 0xEE00AA, |
60 "fore": 0xEE00AA, |
60 } |
61 } |
61 }, |
62 }, |
62 }, |
63 }, |
63 17: { |
64 17: { |
64 0: { |
65 0: { |
65 "Description": QCoreApplication.translate( |
66 "Description": self.tr("Additional JavaDoc keyword"), |
66 "LexerCPP", "Extra Doc Comment Keywords"), |
|
67 "Words": "check", |
67 "Words": "check", |
68 "Style": { |
68 "Style": { |
69 "fore": 0x00AAEE, |
69 "fore": 0x00AAEE, |
70 } |
70 } |
71 }, |
71 }, |
72 }, |
72 }, |
73 75: { |
73 11 + diffToSecondary: { |
74 0: { |
74 0: { |
75 "Description": QCoreApplication.translate( |
75 "Description": self.tr("Inactive additional identifier"), |
76 "LexerCPP", "Inactive Extra Identifiers"), |
|
77 "Words": "std map string vector", |
76 "Words": "std map string vector", |
78 "Style": { |
77 "Style": { |
79 "fore": 0xBB6666, |
78 "fore": 0xBB6666, |
80 } |
79 } |
81 }, |
80 }, |
82 }, |
81 }, |
83 81: { |
82 17 + diffToSecondary: { |
84 0: { |
83 0: { |
85 "Description": QCoreApplication.translate( |
84 "Description": self.tr( |
86 "LexerCPP", "Inactive Extra Doc Comment Keywords"), |
85 "Inactive additional JavaDoc keyword"), |
87 "Words": "check", |
86 "Words": "check", |
88 "Style": { |
87 "Style": { |
89 "fore": 0x6699AA, |
88 "fore": 0x6699AA, |
90 } |
89 } |
91 }, |
90 }, |