src/eric7/QScintilla/Lexers/LexerFortran77.py

branch
eric7
changeset 9209
b99e7fd55fd3
parent 8881
54e42bc2437a
child 9221
bf71ee032bb4
equal deleted inserted replaced
9208:3fc8dfeb6ebe 9209:b99e7fd55fd3
1 # -*- coding: utf-8 -*-
2
3 # Copyright (c) 2008 - 2022 Detlev Offenbach <detlev@die-offenbachs.de>
4 #
5
6 """
7 Module implementing a Fortran lexer with some additional methods.
8 """
9
10 from PyQt6.Qsci import QsciLexerFortran77
11
12 from .Lexer import Lexer
13 import Preferences
14
15
16 class LexerFortran77(Lexer, QsciLexerFortran77):
17 """
18 Subclass to implement some additional lexer dependant methods.
19 """
20 def __init__(self, parent=None):
21 """
22 Constructor
23
24 @param parent parent widget of this lexer
25 """
26 QsciLexerFortran77.__init__(self, parent)
27 Lexer.__init__(self)
28
29 self.commentString = "c "
30
31 self.keywordSetDescriptions = [
32 self.tr("Primary keywords and identifiers"),
33 self.tr("Intrinsic functions"),
34 self.tr("Extended and user defined functions"),
35 ]
36
37 def initProperties(self):
38 """
39 Public slot to initialize the properties.
40 """
41 self.setFoldCompact(Preferences.getEditor("AllFoldCompact"))
42
43 def autoCompletionWordSeparators(self):
44 """
45 Public method to return the list of separators for autocompletion.
46
47 @return list of separators (list of strings)
48 """
49 return ['.']
50
51 def isCommentStyle(self, style):
52 """
53 Public method to check, if a style is a comment style.
54
55 @param style style to check (integer)
56 @return flag indicating a comment style (boolean)
57 """
58 return style in [QsciLexerFortran77.Comment]
59
60 def isStringStyle(self, style):
61 """
62 Public method to check, if a style is a string style.
63
64 @param style style to check (integer)
65 @return flag indicating a string style (boolean)
66 """
67 return style in [QsciLexerFortran77.DoubleQuotedString,
68 QsciLexerFortran77.SingleQuotedString,
69 QsciLexerFortran77.UnclosedString]
70
71 def defaultKeywords(self, kwSet):
72 """
73 Public method to get the default keywords.
74
75 @param kwSet number of the keyword set (integer)
76 @return string giving the keywords (string) or None
77 """
78 return QsciLexerFortran77.keywords(self, kwSet)

eric ide

mercurial