15 |
15 |
16 class LexerPostScript(Lexer, QsciLexerPostScript): |
16 class LexerPostScript(Lexer, QsciLexerPostScript): |
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 QsciLexerPostScript.__init__(self, parent) |
27 QsciLexerPostScript.__init__(self, parent) |
27 Lexer.__init__(self) |
28 Lexer.__init__(self) |
28 |
29 |
29 self.commentString = "%" |
30 self.commentString = "%" |
30 |
31 |
31 self.keywordSetDescriptions = [ |
32 self.keywordSetDescriptions = [ |
32 self.tr("PS Level 1 operators"), |
33 self.tr("PS Level 1 operators"), |
33 self.tr("PS Level 2 operators"), |
34 self.tr("PS Level 2 operators"), |
34 self.tr("PS Level 3 operators"), |
35 self.tr("PS Level 3 operators"), |
35 self.tr("RIP specific operators"), |
36 self.tr("RIP specific operators"), |
36 self.tr("User defined operators"), |
37 self.tr("User defined operators"), |
37 ] |
38 ] |
38 |
39 |
39 def initProperties(self): |
40 def initProperties(self): |
40 """ |
41 """ |
41 Public slot to initialize the properties. |
42 Public slot to initialize the properties. |
42 """ |
43 """ |
43 self.setTokenize(Preferences.getEditor("PostScriptTokenize")) |
44 self.setTokenize(Preferences.getEditor("PostScriptTokenize")) |
44 self.setLevel(Preferences.getEditor("PostScriptLevel")) |
45 self.setLevel(Preferences.getEditor("PostScriptLevel")) |
45 self.setFoldAtElse(Preferences.getEditor("PostScriptFoldAtElse")) |
46 self.setFoldAtElse(Preferences.getEditor("PostScriptFoldAtElse")) |
46 self.setFoldCompact(Preferences.getEditor("AllFoldCompact")) |
47 self.setFoldCompact(Preferences.getEditor("AllFoldCompact")) |
47 |
48 |
48 def isCommentStyle(self, style): |
49 def isCommentStyle(self, style): |
49 """ |
50 """ |
50 Public method to check, if a style is a comment style. |
51 Public method to check, if a style is a comment style. |
51 |
52 |
52 @param style style to check (integer) |
53 @param style style to check (integer) |
53 @return flag indicating a comment style (boolean) |
54 @return flag indicating a comment style (boolean) |
54 """ |
55 """ |
55 return style in [QsciLexerPostScript.Comment] |
56 return style in [QsciLexerPostScript.Comment] |
56 |
57 |
57 def isStringStyle(self, style): |
58 def isStringStyle(self, style): |
58 """ |
59 """ |
59 Public method to check, if a style is a string style. |
60 Public method to check, if a style is a string style. |
60 |
61 |
61 @param style style to check (integer) |
62 @param style style to check (integer) |
62 @return flag indicating a string style (boolean) |
63 @return flag indicating a string style (boolean) |
63 """ |
64 """ |
64 return False |
65 return False |
65 |
66 |
66 def defaultKeywords(self, kwSet): |
67 def defaultKeywords(self, kwSet): |
67 """ |
68 """ |
68 Public method to get the default keywords. |
69 Public method to get the default keywords. |
69 |
70 |
70 @param kwSet number of the keyword set (integer) |
71 @param kwSet number of the keyword set (integer) |
71 @return string giving the keywords (string) or None |
72 @return string giving the keywords (string) or None |
72 """ |
73 """ |
73 return QsciLexerPostScript.keywords(self, kwSet) |
74 return QsciLexerPostScript.keywords(self, kwSet) |
74 |
75 |
75 def maximumKeywordSet(self): |
76 def maximumKeywordSet(self): |
76 """ |
77 """ |
77 Public method to get the maximum keyword set. |
78 Public method to get the maximum keyword set. |
78 |
79 |
79 @return maximum keyword set (integer) |
80 @return maximum keyword set (integer) |
80 """ |
81 """ |
81 return 5 |
82 return 5 |