QScintilla/Lexers/LexerPascal.py

changeset 945
8cd4d08fa9f6
parent 791
9ec2ac20e54e
child 1131
7781e396c903
equal deleted inserted replaced
944:1b59c4ba121e 945:8cd4d08fa9f6
10 from PyQt4.Qsci import QsciLexerPascal 10 from PyQt4.Qsci import QsciLexerPascal
11 11
12 from .Lexer import Lexer 12 from .Lexer import Lexer
13 import Preferences 13 import Preferences
14 14
15
15 class LexerPascal(QsciLexerPascal, Lexer): 16 class LexerPascal(QsciLexerPascal, 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
22 23
23 @param parent parent widget of this lexer 24 @param parent parent widget of this lexer
24 """ 25 """
25 QsciLexerPascal.__init__(self, parent) 26 QsciLexerPascal.__init__(self, parent)
26 Lexer.__init__(self) 27 Lexer.__init__(self)
27 28
28 self.commentString = "//" 29 self.commentString = "//"
29 self.streamCommentString = { 30 self.streamCommentString = {
30 'start' : '{ ', 31 'start': '{ ',
31 'end' : ' }' 32 'end': ' }'
32 } 33 }
33 34
34 def initProperties(self): 35 def initProperties(self):
35 """ 36 """
36 Public slot to initialize the properties. 37 Public slot to initialize the properties.
56 Public method to check, if a style is a comment style. 57 Public method to check, if a style is a comment style.
57 58
58 @return flag indicating a comment style (boolean) 59 @return flag indicating a comment style (boolean)
59 """ 60 """
60 try: 61 try:
61 return style in [QsciLexerPascal.Comment, 62 return style in [QsciLexerPascal.Comment,
62 QsciLexerPascal.CommentDoc, 63 QsciLexerPascal.CommentDoc,
63 QsciLexerPascal.CommentLine] 64 QsciLexerPascal.CommentLine]
64 except AttributeError: 65 except AttributeError:
65 return style in [QsciLexerPascal.Comment, 66 return style in [QsciLexerPascal.Comment,
66 QsciLexerPascal.CommentParenthesis, 67 QsciLexerPascal.CommentParenthesis,
67 QsciLexerPascal.CommentLine] 68 QsciLexerPascal.CommentLine]
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.
76 77
77 def defaultKeywords(self, kwSet): 78 def defaultKeywords(self, kwSet):
78 """ 79 """
79 Public method to get the default keywords. 80 Public method to get the default keywords.
80 81
81 @param kwSet number of the keyword set (integer) 82 @param kwSet number of the keyword set (integer)
82 @return string giving the keywords (string) or None 83 @return string giving the keywords (string) or None
83 """ 84 """
84 return QsciLexerPascal.keywords(self, kwSet) 85 return QsciLexerPascal.keywords(self, kwSet)

eric ide

mercurial