QScintilla/Lexers/LexerBash.py

changeset 0
de9c2efb9d02
child 12
1d8dd9706f46
equal deleted inserted replaced
-1:000000000000 0:de9c2efb9d02
1 # -*- coding: utf-8 -*-
2
3 # Copyright (c) 2004 - 2009 Detlev Offenbach <detlev@die-offenbachs.de>
4 #
5
6 """
7 Module implementing a Bash lexer with some additional methods.
8 """
9
10 from PyQt4.Qsci import QsciLexerBash
11
12 from Lexer import Lexer
13 import Preferences
14
15 class LexerBash(QsciLexerBash, 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 QsciLexerBash.__init__(self, parent)
26 Lexer.__init__(self)
27
28 self.commentString = "#"
29
30 def initProperties(self):
31 """
32 Public slot to initialize the properties.
33 """
34 self.setFoldComments(Preferences.getEditor("BashFoldComment"))
35 self.setFoldCompact(Preferences.getEditor("AllFoldCompact"))
36
37 def isCommentStyle(self, style):
38 """
39 Public method to check, if a style is a comment style.
40
41 @return flag indicating a comment style (boolean)
42 """
43 return style in [QsciLexerBash.Comment]
44
45 def isStringStyle(self, style):
46 """
47 Public method to check, if a style is a string style.
48
49 @return flag indicating a string style (boolean)
50 """
51 return style in [QsciLexerBash.DoubleQuotedString,
52 QsciLexerBash.SingleQuotedString,
53 QsciLexerBash.SingleQuotedHereDocument]

eric ide

mercurial