15 |
15 |
16 class LexerFortran(Lexer, QsciLexerFortran): |
16 class LexerFortran(Lexer, QsciLexerFortran): |
17 """ |
17 """ |
18 Subclass to implement some additional lexer dependant methods. |
18 Subclass to implement some additional lexer dependant methods. |
19 """ |
19 """ |
|
20 |
20 def __init__(self, parent=None): |
21 def __init__(self, parent=None): |
21 """ |
22 """ |
22 Constructor |
23 Constructor |
23 |
24 |
24 @param parent parent widget of this lexer |
25 @param parent parent widget of this lexer |
25 """ |
26 """ |
26 QsciLexerFortran.__init__(self, parent) |
27 QsciLexerFortran.__init__(self, parent) |
27 Lexer.__init__(self) |
28 Lexer.__init__(self) |
28 |
29 |
29 self.commentString = "c " |
30 self.commentString = "c " |
30 |
31 |
31 self.keywordSetDescriptions = [ |
32 self.keywordSetDescriptions = [ |
32 self.tr("Primary keywords and identifiers"), |
33 self.tr("Primary keywords and identifiers"), |
33 self.tr("Intrinsic functions"), |
34 self.tr("Intrinsic functions"), |
34 self.tr("Extended and user defined functions"), |
35 self.tr("Extended and user defined functions"), |
35 ] |
36 ] |
36 |
37 |
37 def initProperties(self): |
38 def initProperties(self): |
38 """ |
39 """ |
39 Public slot to initialize the properties. |
40 Public slot to initialize the properties. |
40 """ |
41 """ |
41 self.setFoldCompact(Preferences.getEditor("AllFoldCompact")) |
42 self.setFoldCompact(Preferences.getEditor("AllFoldCompact")) |
42 |
43 |
43 def autoCompletionWordSeparators(self): |
44 def autoCompletionWordSeparators(self): |
44 """ |
45 """ |
45 Public method to return the list of separators for autocompletion. |
46 Public method to return the list of separators for autocompletion. |
46 |
47 |
47 @return list of separators (list of strings) |
48 @return list of separators (list of strings) |
48 """ |
49 """ |
49 return ['.'] |
50 return ["."] |
50 |
51 |
51 def isCommentStyle(self, style): |
52 def isCommentStyle(self, style): |
52 """ |
53 """ |
53 Public method to check, if a style is a comment style. |
54 Public method to check, if a style is a comment style. |
54 |
55 |
55 @param style style to check (integer) |
56 @param style style to check (integer) |
56 @return flag indicating a comment style (boolean) |
57 @return flag indicating a comment style (boolean) |
57 """ |
58 """ |
58 return style in [QsciLexerFortran.Comment] |
59 return style in [QsciLexerFortran.Comment] |
59 |
60 |
60 def isStringStyle(self, style): |
61 def isStringStyle(self, style): |
61 """ |
62 """ |
62 Public method to check, if a style is a string style. |
63 Public method to check, if a style is a string style. |
63 |
64 |
64 @param style style to check (integer) |
65 @param style style to check (integer) |
65 @return flag indicating a string style (boolean) |
66 @return flag indicating a string style (boolean) |
66 """ |
67 """ |
67 return style in [QsciLexerFortran.DoubleQuotedString, |
68 return style in [ |
68 QsciLexerFortran.SingleQuotedString, |
69 QsciLexerFortran.DoubleQuotedString, |
69 QsciLexerFortran.UnclosedString] |
70 QsciLexerFortran.SingleQuotedString, |
70 |
71 QsciLexerFortran.UnclosedString, |
|
72 ] |
|
73 |
71 def defaultKeywords(self, kwSet): |
74 def defaultKeywords(self, kwSet): |
72 """ |
75 """ |
73 Public method to get the default keywords. |
76 Public method to get the default keywords. |
74 |
77 |
75 @param kwSet number of the keyword set (integer) |
78 @param kwSet number of the keyword set (integer) |
76 @return string giving the keywords (string) or None |
79 @return string giving the keywords (string) or None |
77 """ |
80 """ |
78 return QsciLexerFortran.keywords(self, kwSet) |
81 return QsciLexerFortran.keywords(self, kwSet) |