QScintilla/Lexers/LexerHTML.py

changeset 945
8cd4d08fa9f6
parent 791
9ec2ac20e54e
child 948
fe7b94ed01ec
equal deleted inserted replaced
944:1b59c4ba121e 945:8cd4d08fa9f6
10 from PyQt4.Qsci import QsciLexerHTML 10 from PyQt4.Qsci import QsciLexerHTML
11 11
12 from .Lexer import Lexer 12 from .Lexer import Lexer
13 import Preferences 13 import Preferences
14 14
15
15 class LexerHTML(QsciLexerHTML, Lexer): 16 class LexerHTML(QsciLexerHTML, Lexer):
16 """ 17 """
17 Subclass to implement some additional lexer dependant methods. 18 Subclass to implement some additional lexer dependant methods.
18 """ 19 """
19 def __init__(self, parent=None): 20 def __init__(self, parent=None):
20 """ 21 """
21 Constructor 22 Constructor
24 """ 25 """
25 QsciLexerHTML.__init__(self, parent) 26 QsciLexerHTML.__init__(self, parent)
26 Lexer.__init__(self) 27 Lexer.__init__(self)
27 28
28 self.streamCommentString = { 29 self.streamCommentString = {
29 'start' : '<!-- ', 30 'start': '<!-- ',
30 'end' : ' -->' 31 'end': ' -->'
31 } 32 }
32 33
33 def initProperties(self): 34 def initProperties(self):
34 """ 35 """
35 Public slot to initialize the properties. 36 Public slot to initialize the properties.
48 """ 49 """
49 Public method to check, if a style is a comment style. 50 Public method to check, if a style is a comment style.
50 51
51 @return flag indicating a comment style (boolean) 52 @return flag indicating a comment style (boolean)
52 """ 53 """
53 return style in [QsciLexerHTML.HTMLComment, 54 return style in [QsciLexerHTML.HTMLComment,
54 QsciLexerHTML.ASPXCComment, 55 QsciLexerHTML.ASPXCComment,
55 QsciLexerHTML.SGMLComment, 56 QsciLexerHTML.SGMLComment,
56 QsciLexerHTML.SGMLParameterComment, 57 QsciLexerHTML.SGMLParameterComment,
57 QsciLexerHTML.JavaScriptComment, 58 QsciLexerHTML.JavaScriptComment,
58 QsciLexerHTML.JavaScriptCommentDoc, 59 QsciLexerHTML.JavaScriptCommentDoc,
59 QsciLexerHTML.JavaScriptCommentLine, 60 QsciLexerHTML.JavaScriptCommentLine,
60 QsciLexerHTML.ASPJavaScriptComment, 61 QsciLexerHTML.ASPJavaScriptComment,
61 QsciLexerHTML.ASPJavaScriptCommentDoc, 62 QsciLexerHTML.ASPJavaScriptCommentDoc,
62 QsciLexerHTML.ASPJavaScriptCommentLine, 63 QsciLexerHTML.ASPJavaScriptCommentLine,
63 QsciLexerHTML.VBScriptComment, 64 QsciLexerHTML.VBScriptComment,
64 QsciLexerHTML.ASPVBScriptComment, 65 QsciLexerHTML.ASPVBScriptComment,
65 QsciLexerHTML.PythonComment, 66 QsciLexerHTML.PythonComment,
66 QsciLexerHTML.ASPPythonComment, 67 QsciLexerHTML.ASPPythonComment,
67 QsciLexerHTML.PHPComment] 68 QsciLexerHTML.PHPComment]
68 69
69 def isStringStyle(self, style): 70 def isStringStyle(self, style):
70 """ 71 """
71 Public method to check, if a style is a string style. 72 Public method to check, if a style is a string style.
72 73
73 @return flag indicating a string style (boolean) 74 @return flag indicating a string style (boolean)
74 """ 75 """
75 return style in [QsciLexerHTML.HTMLDoubleQuotedString, 76 return style in [QsciLexerHTML.HTMLDoubleQuotedString,
76 QsciLexerHTML.HTMLSingleQuotedString, 77 QsciLexerHTML.HTMLSingleQuotedString,
77 QsciLexerHTML.SGMLDoubleQuotedString, 78 QsciLexerHTML.SGMLDoubleQuotedString,
78 QsciLexerHTML.SGMLSingleQuotedString, 79 QsciLexerHTML.SGMLSingleQuotedString,
79 QsciLexerHTML.JavaScriptDoubleQuotedString, 80 QsciLexerHTML.JavaScriptDoubleQuotedString,
80 QsciLexerHTML.JavaScriptSingleQuotedString, 81 QsciLexerHTML.JavaScriptSingleQuotedString,
81 QsciLexerHTML.JavaScriptUnclosedString, 82 QsciLexerHTML.JavaScriptUnclosedString,
82 QsciLexerHTML.ASPJavaScriptDoubleQuotedString, 83 QsciLexerHTML.ASPJavaScriptDoubleQuotedString,
83 QsciLexerHTML.ASPJavaScriptSingleQuotedString, 84 QsciLexerHTML.ASPJavaScriptSingleQuotedString,
84 QsciLexerHTML.ASPJavaScriptUnclosedString, 85 QsciLexerHTML.ASPJavaScriptUnclosedString,
85 QsciLexerHTML.VBScriptString, 86 QsciLexerHTML.VBScriptString,
86 QsciLexerHTML.VBScriptUnclosedString, 87 QsciLexerHTML.VBScriptUnclosedString,
87 QsciLexerHTML.ASPVBScriptString, 88 QsciLexerHTML.ASPVBScriptString,
88 QsciLexerHTML.ASPVBScriptUnclosedString, 89 QsciLexerHTML.ASPVBScriptUnclosedString,
89 QsciLexerHTML.PythonDoubleQuotedString, 90 QsciLexerHTML.PythonDoubleQuotedString,
90 QsciLexerHTML.PythonSingleQuotedString, 91 QsciLexerHTML.PythonSingleQuotedString,
91 QsciLexerHTML.PythonTripleDoubleQuotedString, 92 QsciLexerHTML.PythonTripleDoubleQuotedString,
92 QsciLexerHTML.PythonTripleSingleQuotedString, 93 QsciLexerHTML.PythonTripleSingleQuotedString,
93 QsciLexerHTML.ASPPythonDoubleQuotedString, 94 QsciLexerHTML.ASPPythonDoubleQuotedString,
94 QsciLexerHTML.ASPPythonSingleQuotedString, 95 QsciLexerHTML.ASPPythonSingleQuotedString,
95 QsciLexerHTML.ASPPythonTripleDoubleQuotedString, 96 QsciLexerHTML.ASPPythonTripleDoubleQuotedString,
96 QsciLexerHTML.ASPPythonTripleSingleQuotedString, 97 QsciLexerHTML.ASPPythonTripleSingleQuotedString,
97 QsciLexerHTML.PHPDoubleQuotedString, 98 QsciLexerHTML.PHPDoubleQuotedString,
98 QsciLexerHTML.PHPSingleQuotedString] 99 QsciLexerHTML.PHPSingleQuotedString]
99 100
100 def defaultKeywords(self, kwSet): 101 def defaultKeywords(self, kwSet):
101 """ 102 """
102 Public method to get the default keywords. 103 Public method to get the default keywords.
103 104
104 @param kwSet number of the keyword set (integer) 105 @param kwSet number of the keyword set (integer)
105 @return string giving the keywords (string) or None 106 @return string giving the keywords (string) or None
106 """ 107 """
107 return QsciLexerHTML.keywords(self, kwSet) 108 return QsciLexerHTML.keywords(self, kwSet)

eric ide

mercurial