eric6/QScintilla/Lexers/LexerCPP.py

Wed, 30 Dec 2020 11:00:44 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Wed, 30 Dec 2020 11:00:44 +0100
branch
maintenance
changeset 7924
8a96736d465e
parent 7781
607a6098cb44
child 8243
cc717c2ae956
permissions
-rw-r--r--

Updated copyright for 2021.

0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2
7924
8a96736d465e Updated copyright for 2021.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7781
diff changeset
3 # Copyright (c) 2002 - 2021 Detlev Offenbach <detlev@die-offenbachs.de>
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
4 #
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
7 Module implementing a CPP lexer with some additional methods.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
8 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9
3656
441956d8fce5 Started porting eric5 to PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3654
diff changeset
10 from PyQt5.Qsci import QsciLexerCPP, QsciScintilla
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
11
6845
4680adb641e0 Lexer: implemented basic support for sub-styles.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
12 from .SubstyledLexer import SubstyledLexer
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
13 import Preferences
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
14
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
15
6845
4680adb641e0 Lexer: implemented basic support for sub-styles.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
16 class LexerCPP(SubstyledLexer, QsciLexerCPP):
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
17 """
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
18 Subclass to implement some additional lexer dependant methods.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
19 """
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
20 def __init__(self, parent=None, caseInsensitiveKeywords=False):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
21 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
22 Constructor
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
23
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
24 @param parent parent widget of this lexer
2965
d133c7edd88a Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
25 @param caseInsensitiveKeywords flag indicating keywords are case
d133c7edd88a Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
26 insensitive (boolean)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
27 """
3462
6d6e7334a787 Fixed an issue with ALL lexers inheriting in the wrong order.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
28 QsciLexerCPP.__init__(self, parent, caseInsensitiveKeywords)
6845
4680adb641e0 Lexer: implemented basic support for sub-styles.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
29 SubstyledLexer.__init__(self)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
30
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
31 self.commentString = "//"
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
32 self.streamCommentString = {
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
33 'start': '/* ',
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
34 'end': ' */'
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
35 }
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
36 self.boxCommentString = {
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
37 'start': '/* ',
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
38 'middle': ' * ',
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
39 'end': ' */'
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
40 }
6845
4680adb641e0 Lexer: implemented basic support for sub-styles.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
41
6874
5a3a39442711 Lexers: extended the keyword set handling by introducing a keyword set description and some set adjustments (harmonized with SciTE).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6868
diff changeset
42 self.keywordSetDescriptions = [
5a3a39442711 Lexers: extended the keyword set handling by introducing a keyword set description and some set adjustments (harmonized with SciTE).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6868
diff changeset
43 self.tr("Primary keywords and identifiers"),
5a3a39442711 Lexers: extended the keyword set handling by introducing a keyword set description and some set adjustments (harmonized with SciTE).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6868
diff changeset
44 self.tr("Secondary keywords and identifiers"),
5a3a39442711 Lexers: extended the keyword set handling by introducing a keyword set description and some set adjustments (harmonized with SciTE).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6868
diff changeset
45 self.tr("Documentation comment keywords"),
5a3a39442711 Lexers: extended the keyword set handling by introducing a keyword set description and some set adjustments (harmonized with SciTE).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6868
diff changeset
46 self.tr("Global classes and typedefs"),
5a3a39442711 Lexers: extended the keyword set handling by introducing a keyword set description and some set adjustments (harmonized with SciTE).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6868
diff changeset
47 self.tr("Preprocessor definitions"),
5a3a39442711 Lexers: extended the keyword set handling by introducing a keyword set description and some set adjustments (harmonized with SciTE).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6868
diff changeset
48 self.tr("Task marker and error marker keywords"),
5a3a39442711 Lexers: extended the keyword set handling by introducing a keyword set description and some set adjustments (harmonized with SciTE).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6868
diff changeset
49 ]
5a3a39442711 Lexers: extended the keyword set handling by introducing a keyword set description and some set adjustments (harmonized with SciTE).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6868
diff changeset
50
6845
4680adb641e0 Lexer: implemented basic support for sub-styles.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
51 ##############################################################
4680adb641e0 Lexer: implemented basic support for sub-styles.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
52 ## default sub-style definitions
4680adb641e0 Lexer: implemented basic support for sub-styles.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
53 ##############################################################
4680adb641e0 Lexer: implemented basic support for sub-styles.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
54
6868
212ff174e129 LexerCPP: some fine tuning and style description harmonizing.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
55 diffToSecondary = 0x40
212ff174e129 LexerCPP: some fine tuning and style description harmonizing.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
56 # This may need to be changed to be in line with Scintilla C++ lexer.
212ff174e129 LexerCPP: some fine tuning and style description harmonizing.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
57
6845
4680adb641e0 Lexer: implemented basic support for sub-styles.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
58 # list of style numbers, that support sub-styling
6868
212ff174e129 LexerCPP: some fine tuning and style description harmonizing.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
59 self.baseStyles = [11, 17, 11 + diffToSecondary, 17 + diffToSecondary]
6845
4680adb641e0 Lexer: implemented basic support for sub-styles.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
60
4680adb641e0 Lexer: implemented basic support for sub-styles.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
61 self.defaultSubStyles = {
6855
4d80c8cc99a1 SubstyledLexer: continued implementing the getter and setter methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6846
diff changeset
62 11: {
4d80c8cc99a1 SubstyledLexer: continued implementing the getter and setter methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6846
diff changeset
63 0: {
6868
212ff174e129 LexerCPP: some fine tuning and style description harmonizing.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
64 "Description": self.tr("Additional Identifier"),
6846
6ca9ef2c0907 Lexer: extended the basic support for sub-styles by a method to write the data to the settings file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6845
diff changeset
65 "Words": "std map string vector",
6ca9ef2c0907 Lexer: extended the basic support for sub-styles by a method to write the data to the settings file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6845
diff changeset
66 "Style": {
6ca9ef2c0907 Lexer: extended the basic support for sub-styles by a method to write the data to the settings file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6845
diff changeset
67 "fore": 0xEE00AA,
6ca9ef2c0907 Lexer: extended the basic support for sub-styles by a method to write the data to the settings file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6845
diff changeset
68 }
6ca9ef2c0907 Lexer: extended the basic support for sub-styles by a method to write the data to the settings file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6845
diff changeset
69 },
6855
4d80c8cc99a1 SubstyledLexer: continued implementing the getter and setter methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6846
diff changeset
70 },
4d80c8cc99a1 SubstyledLexer: continued implementing the getter and setter methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6846
diff changeset
71 17: {
4d80c8cc99a1 SubstyledLexer: continued implementing the getter and setter methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6846
diff changeset
72 0: {
6868
212ff174e129 LexerCPP: some fine tuning and style description harmonizing.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
73 "Description": self.tr("Additional JavaDoc keyword"),
6846
6ca9ef2c0907 Lexer: extended the basic support for sub-styles by a method to write the data to the settings file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6845
diff changeset
74 "Words": "check",
6ca9ef2c0907 Lexer: extended the basic support for sub-styles by a method to write the data to the settings file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6845
diff changeset
75 "Style": {
6ca9ef2c0907 Lexer: extended the basic support for sub-styles by a method to write the data to the settings file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6845
diff changeset
76 "fore": 0x00AAEE,
6ca9ef2c0907 Lexer: extended the basic support for sub-styles by a method to write the data to the settings file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6845
diff changeset
77 }
6ca9ef2c0907 Lexer: extended the basic support for sub-styles by a method to write the data to the settings file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6845
diff changeset
78 },
6855
4d80c8cc99a1 SubstyledLexer: continued implementing the getter and setter methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6846
diff changeset
79 },
6868
212ff174e129 LexerCPP: some fine tuning and style description harmonizing.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
80 11 + diffToSecondary: {
6855
4d80c8cc99a1 SubstyledLexer: continued implementing the getter and setter methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6846
diff changeset
81 0: {
6868
212ff174e129 LexerCPP: some fine tuning and style description harmonizing.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
82 "Description": self.tr("Inactive additional identifier"),
6846
6ca9ef2c0907 Lexer: extended the basic support for sub-styles by a method to write the data to the settings file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6845
diff changeset
83 "Words": "std map string vector",
6ca9ef2c0907 Lexer: extended the basic support for sub-styles by a method to write the data to the settings file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6845
diff changeset
84 "Style": {
6ca9ef2c0907 Lexer: extended the basic support for sub-styles by a method to write the data to the settings file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6845
diff changeset
85 "fore": 0xBB6666,
6ca9ef2c0907 Lexer: extended the basic support for sub-styles by a method to write the data to the settings file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6845
diff changeset
86 }
6ca9ef2c0907 Lexer: extended the basic support for sub-styles by a method to write the data to the settings file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6845
diff changeset
87 },
6855
4d80c8cc99a1 SubstyledLexer: continued implementing the getter and setter methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6846
diff changeset
88 },
6868
212ff174e129 LexerCPP: some fine tuning and style description harmonizing.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
89 17 + diffToSecondary: {
6855
4d80c8cc99a1 SubstyledLexer: continued implementing the getter and setter methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6846
diff changeset
90 0: {
6868
212ff174e129 LexerCPP: some fine tuning and style description harmonizing.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
91 "Description": self.tr(
212ff174e129 LexerCPP: some fine tuning and style description harmonizing.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6855
diff changeset
92 "Inactive additional JavaDoc keyword"),
6846
6ca9ef2c0907 Lexer: extended the basic support for sub-styles by a method to write the data to the settings file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6845
diff changeset
93 "Words": "check",
6ca9ef2c0907 Lexer: extended the basic support for sub-styles by a method to write the data to the settings file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6845
diff changeset
94 "Style": {
6ca9ef2c0907 Lexer: extended the basic support for sub-styles by a method to write the data to the settings file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6845
diff changeset
95 "fore": 0x6699AA,
6ca9ef2c0907 Lexer: extended the basic support for sub-styles by a method to write the data to the settings file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6845
diff changeset
96 }
6ca9ef2c0907 Lexer: extended the basic support for sub-styles by a method to write the data to the settings file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6845
diff changeset
97 },
6855
4d80c8cc99a1 SubstyledLexer: continued implementing the getter and setter methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6846
diff changeset
98 },
6845
4680adb641e0 Lexer: implemented basic support for sub-styles.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
99 }
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
100
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
101 def initProperties(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
102 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
103 Public slot to initialize the properties.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
104 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
105 self.setFoldComments(Preferences.getEditor("CppFoldComment"))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
106 self.setFoldPreprocessor(Preferences.getEditor("CppFoldPreprocessor"))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
107 self.setFoldAtElse(Preferences.getEditor("CppFoldAtElse"))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
108 indentStyle = 0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
109 if Preferences.getEditor("CppIndentOpeningBrace"):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
110 indentStyle |= QsciScintilla.AiOpening
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
111 if Preferences.getEditor("CppIndentClosingBrace"):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
112 indentStyle |= QsciScintilla.AiClosing
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
113 self.setAutoIndentStyle(indentStyle)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
114 self.setFoldCompact(Preferences.getEditor("AllFoldCompact"))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
115 try:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
116 self.setDollarsAllowed(Preferences.getEditor("CppDollarsAllowed"))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
117 except AttributeError:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
118 pass
948
fe7b94ed01ec Added support for new lexer properties (as of QScintilla 2.5).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
119 try:
3011
18292228c724 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
120 self.setStylePreprocessor(
18292228c724 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
121 Preferences.getEditor("CppStylePreprocessor"))
948
fe7b94ed01ec Added support for new lexer properties (as of QScintilla 2.5).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
122 except AttributeError:
fe7b94ed01ec Added support for new lexer properties (as of QScintilla 2.5).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
123 pass
1444
552d2d74f5cf Started to add support for QScintilla 2.6 (and newer).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
124 try:
552d2d74f5cf Started to add support for QScintilla 2.6 (and newer).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
125 self.setHighlightTripleQuotedStrings(
552d2d74f5cf Started to add support for QScintilla 2.6 (and newer).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
126 Preferences.getEditor("CppHighlightTripleQuotedStrings"))
552d2d74f5cf Started to add support for QScintilla 2.6 (and newer).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
127 except AttributeError:
552d2d74f5cf Started to add support for QScintilla 2.6 (and newer).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
128 pass
2261
f4bb5648fc29 Made some adjustments for QScintilla 2.7.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
129 try:
f4bb5648fc29 Made some adjustments for QScintilla 2.7.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
130 self.setHighlightHashQuotedStrings(
f4bb5648fc29 Made some adjustments for QScintilla 2.7.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
131 Preferences.getEditor("CppHighlightHashQuotedStrings"))
f4bb5648fc29 Made some adjustments for QScintilla 2.7.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
132 except AttributeError:
f4bb5648fc29 Made some adjustments for QScintilla 2.7.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
133 pass
4206
8f0d697e6384 Added support for the new C++ lexer properties (as of QScintilla V. 2.9.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
134 try:
8f0d697e6384 Added support for the new C++ lexer properties (as of QScintilla V. 2.9.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
135 self.setHighlightBackQuotedStrings(
8f0d697e6384 Added support for the new C++ lexer properties (as of QScintilla V. 2.9.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
136 Preferences.getEditor("CppHighlightBackQuotedStrings"))
8f0d697e6384 Added support for the new C++ lexer properties (as of QScintilla V. 2.9.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
137 except AttributeError:
8f0d697e6384 Added support for the new C++ lexer properties (as of QScintilla V. 2.9.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
138 pass
8f0d697e6384 Added support for the new C++ lexer properties (as of QScintilla V. 2.9.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
139 try:
8f0d697e6384 Added support for the new C++ lexer properties (as of QScintilla V. 2.9.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
140 self.setHighlightEscapeSequences(
8f0d697e6384 Added support for the new C++ lexer properties (as of QScintilla V. 2.9.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
141 Preferences.getEditor("CppHighlightEscapeSequences"))
8f0d697e6384 Added support for the new C++ lexer properties (as of QScintilla V. 2.9.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
142 except AttributeError:
8f0d697e6384 Added support for the new C++ lexer properties (as of QScintilla V. 2.9.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
143 pass
8f0d697e6384 Added support for the new C++ lexer properties (as of QScintilla V. 2.9.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
144 try:
8f0d697e6384 Added support for the new C++ lexer properties (as of QScintilla V. 2.9.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
145 self.setVerbatimStringEscapeSequencesAllowed(
8f0d697e6384 Added support for the new C++ lexer properties (as of QScintilla V. 2.9.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
146 Preferences.getEditor(
8f0d697e6384 Added support for the new C++ lexer properties (as of QScintilla V. 2.9.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
147 "CppVerbatimStringEscapeSequencesAllowed"))
8f0d697e6384 Added support for the new C++ lexer properties (as of QScintilla V. 2.9.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
148 except AttributeError:
8f0d697e6384 Added support for the new C++ lexer properties (as of QScintilla V. 2.9.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
149 pass
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
150
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
151 def autoCompletionWordSeparators(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
152 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
153 Public method to return the list of separators for autocompletion.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
154
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
155 @return list of separators (list of strings)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
156 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
157 return ['::', '->', '.']
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
158
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
159 def isCommentStyle(self, style):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
160 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
161 Public method to check, if a style is a comment style.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
162
2965
d133c7edd88a Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
163 @param style style to check (integer)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
164 @return flag indicating a comment style (boolean)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
165 """
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
166 return style in [QsciLexerCPP.Comment,
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
167 QsciLexerCPP.CommentDoc,
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
168 QsciLexerCPP.CommentLine,
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
169 QsciLexerCPP.CommentLineDoc]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
170
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
171 def isStringStyle(self, style):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
172 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
173 Public method to check, if a style is a string style.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
174
2965
d133c7edd88a Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
175 @param style style to check (integer)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
176 @return flag indicating a string style (boolean)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
177 """
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
178 return style in [QsciLexerCPP.DoubleQuotedString,
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
179 QsciLexerCPP.SingleQuotedString,
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
180 QsciLexerCPP.UnclosedString,
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
181 QsciLexerCPP.VerbatimString]
130
fcce4cc20d95 Added capability to change the keywords of a syntax highlighter.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 13
diff changeset
182
fcce4cc20d95 Added capability to change the keywords of a syntax highlighter.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 13
diff changeset
183 def defaultKeywords(self, kwSet):
fcce4cc20d95 Added capability to change the keywords of a syntax highlighter.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 13
diff changeset
184 """
fcce4cc20d95 Added capability to change the keywords of a syntax highlighter.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 13
diff changeset
185 Public method to get the default keywords.
fcce4cc20d95 Added capability to change the keywords of a syntax highlighter.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 13
diff changeset
186
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
187 @param kwSet number of the keyword set (integer)
167
7508e44f4853 Fixed an issue with a missing method in LexerPygments.py and corrected some source docu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 130
diff changeset
188 @return string giving the keywords (string) or None
130
fcce4cc20d95 Added capability to change the keywords of a syntax highlighter.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 13
diff changeset
189 """
fcce4cc20d95 Added capability to change the keywords of a syntax highlighter.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 13
diff changeset
190 return QsciLexerCPP.keywords(self, kwSet)
3654
ffeb85cdc72d Fixed and improved the CoffeeScript interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3539
diff changeset
191
ffeb85cdc72d Fixed and improved the CoffeeScript interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3539
diff changeset
192 def maximumKeywordSet(self):
ffeb85cdc72d Fixed and improved the CoffeeScript interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3539
diff changeset
193 """
ffeb85cdc72d Fixed and improved the CoffeeScript interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3539
diff changeset
194 Public method to get the maximum keyword set.
ffeb85cdc72d Fixed and improved the CoffeeScript interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3539
diff changeset
195
ffeb85cdc72d Fixed and improved the CoffeeScript interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3539
diff changeset
196 @return maximum keyword set (integer)
ffeb85cdc72d Fixed and improved the CoffeeScript interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3539
diff changeset
197 """
ffeb85cdc72d Fixed and improved the CoffeeScript interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3539
diff changeset
198 return 4

eric ide

mercurial