QScintilla/Lexers/LexerHTML.py

changeset 0
de9c2efb9d02
child 12
1d8dd9706f46
equal deleted inserted replaced
-1:000000000000 0:de9c2efb9d02
1 # -*- coding: utf-8 -*-
2
3 # Copyright (c) 2003 - 2009 Detlev Offenbach <detlev@die-offenbachs.de>
4 #
5
6 """
7 Module implementing a HTML lexer with some additional methods.
8 """
9
10 from PyQt4.Qsci import QsciLexerHTML
11
12 from Lexer import Lexer
13 import Preferences
14
15 class LexerHTML(QsciLexerHTML, Lexer):
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 QsciLexerHTML.__init__(self, parent)
26 Lexer.__init__(self)
27
28 self.streamCommentString = {
29 'start' : '<!-- ',
30 'end' : ' -->'
31 }
32
33 def initProperties(self):
34 """
35 Public slot to initialize the properties.
36 """
37 self.setFoldPreprocessor(Preferences.getEditor("HtmlFoldPreprocessor"))
38 self.setCaseSensitiveTags(\
39 Preferences.getEditor("HtmlCaseSensitiveTags"))
40 self.setFoldCompact(Preferences.getEditor("AllFoldCompact"))
41 try:
42 self.setFoldScriptComments(Preferences.getEditor("HtmlFoldScriptComments"))
43 self.setFoldScriptHeredocs(Preferences.getEditor("HtmlFoldScriptHeredocs"))
44 except AttributeError:
45 pass
46
47 def isCommentStyle(self, style):
48 """
49 Public method to check, if a style is a comment style.
50
51 @return flag indicating a comment style (boolean)
52 """
53 return style in [QsciLexerHTML.HTMLComment,
54 QsciLexerHTML.ASPXCComment,
55 QsciLexerHTML.SGMLComment,
56 QsciLexerHTML.SGMLParameterComment,
57 QsciLexerHTML.JavaScriptComment,
58 QsciLexerHTML.JavaScriptCommentDoc,
59 QsciLexerHTML.JavaScriptCommentLine,
60 QsciLexerHTML.ASPJavaScriptComment,
61 QsciLexerHTML.ASPJavaScriptCommentDoc,
62 QsciLexerHTML.ASPJavaScriptCommentLine,
63 QsciLexerHTML.VBScriptComment,
64 QsciLexerHTML.ASPVBScriptComment,
65 QsciLexerHTML.PythonComment,
66 QsciLexerHTML.ASPPythonComment,
67 QsciLexerHTML.PHPComment]
68
69 def isStringStyle(self, style):
70 """
71 Public method to check, if a style is a string style.
72
73 @return flag indicating a string style (boolean)
74 """
75 return style in [QsciLexerHTML.HTMLDoubleQuotedString,
76 QsciLexerHTML.HTMLSingleQuotedString,
77 QsciLexerHTML.SGMLDoubleQuotedString,
78 QsciLexerHTML.SGMLSingleQuotedString,
79 QsciLexerHTML.JavaScriptDoubleQuotedString,
80 QsciLexerHTML.JavaScriptSingleQuotedString,
81 QsciLexerHTML.JavaScriptUnclosedString,
82 QsciLexerHTML.ASPJavaScriptDoubleQuotedString,
83 QsciLexerHTML.ASPJavaScriptSingleQuotedString,
84 QsciLexerHTML.ASPJavaScriptUnclosedString,
85 QsciLexerHTML.VBScriptString,
86 QsciLexerHTML.VBScriptUnclosedString,
87 QsciLexerHTML.ASPVBScriptString,
88 QsciLexerHTML.ASPVBScriptUnclosedString,
89 QsciLexerHTML.PythonDoubleQuotedString,
90 QsciLexerHTML.PythonSingleQuotedString,
91 QsciLexerHTML.PythonTripleDoubleQuotedString,
92 QsciLexerHTML.PythonTripleSingleQuotedString,
93 QsciLexerHTML.ASPPythonDoubleQuotedString,
94 QsciLexerHTML.ASPPythonSingleQuotedString,
95 QsciLexerHTML.ASPPythonTripleDoubleQuotedString,
96 QsciLexerHTML.ASPPythonTripleSingleQuotedString,
97 QsciLexerHTML.PHPDoubleQuotedString,
98 QsciLexerHTML.PHPSingleQuotedString]

eric ide

mercurial