eric6/QScintilla/Lexers/LexerMatlab.py

changeset 6942
2602857055c5
parent 6874
5a3a39442711
child 7229
53054eb5b15a
equal deleted inserted replaced
6941:f99d60d6b59b 6942:2602857055c5
1 # -*- coding: utf-8 -*-
2
3 # Copyright (c) 2011 - 2019 Detlev Offenbach <detlev@die-offenbachs.de>
4 #
5
6 """
7 Module implementing a Matlab lexer with some additional methods.
8 """
9
10 from __future__ import unicode_literals
11
12 from PyQt5.Qsci import QsciLexerMatlab
13
14 from .Lexer import Lexer
15
16
17 class LexerMatlab(Lexer, QsciLexerMatlab):
18 """
19 Subclass to implement some additional lexer dependent methods.
20 """
21 def __init__(self, parent=None):
22 """
23 Constructor
24
25 @param parent parent widget of this lexer
26 """
27 QsciLexerMatlab.__init__(self, parent)
28 Lexer.__init__(self)
29
30 self.commentString = "%~"
31
32 self.keywordSetDescriptions = [
33 self.tr("Keywords"),
34 ]
35
36 def isCommentStyle(self, style):
37 """
38 Public method to check, if a style is a comment style.
39
40 @param style style to check (integer)
41 @return flag indicating a comment style (boolean)
42 """
43 return style in [QsciLexerMatlab.Comment]
44
45 def isStringStyle(self, style):
46 """
47 Public method to check, if a style is a string style.
48
49 @param style style to check (integer)
50 @return flag indicating a string style (boolean)
51 """
52 return style in [QsciLexerMatlab.DoubleQuotedString,
53 QsciLexerMatlab.SingleQuotedString]
54
55 def defaultKeywords(self, kwSet):
56 """
57 Public method to get the default keywords.
58
59 @param kwSet number of the keyword set (integer)
60 @return string giving the keywords (string) or None
61 """
62 return QsciLexerMatlab.keywords(self, kwSet)

eric ide

mercurial