eric6/QScintilla/Lexers/LexerLua.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) 2005 - 2019 Detlev Offenbach <detlev@die-offenbachs.de>
4 #
5
6 """
7 Module implementing a Lua lexer with some additional methods.
8 """
9
10 from __future__ import unicode_literals
11
12 from PyQt5.Qsci import QsciLexerLua
13
14 from .Lexer import Lexer
15 import Preferences
16
17
18 class LexerLua(Lexer, QsciLexerLua):
19 """
20 Subclass to implement some additional lexer dependant methods.
21 """
22 def __init__(self, parent=None):
23 """
24 Constructor
25
26 @param parent parent widget of this lexer
27 """
28 QsciLexerLua.__init__(self, parent)
29 Lexer.__init__(self)
30
31 self.commentString = "--"
32 self.streamCommentString = {
33 'start': '--[[ ',
34 'end': ' ]]--'
35 }
36
37 self.keywordSetDescriptions = [
38 self.tr("Keywords"),
39 self.tr("Basic functions"),
40 self.tr("String, (table) & math functions"),
41 self.tr("Coroutines, I/O & system facilities"),
42 self.tr("User defined 1"),
43 self.tr("User defined 2"),
44 self.tr("User defined 3"),
45 self.tr("User defined 4"),
46 ]
47
48 def initProperties(self):
49 """
50 Public slot to initialize the properties.
51 """
52 self.setFoldCompact(Preferences.getEditor("AllFoldCompact"))
53
54 def autoCompletionWordSeparators(self):
55 """
56 Public method to return the list of separators for autocompletion.
57
58 @return list of separators (list of strings)
59 """
60 return [':', '.']
61
62 def isCommentStyle(self, style):
63 """
64 Public method to check, if a style is a comment style.
65
66 @param style style to check (integer)
67 @return flag indicating a comment style (boolean)
68 """
69 return style in [QsciLexerLua.Comment,
70 QsciLexerLua.LineComment]
71
72 def isStringStyle(self, style):
73 """
74 Public method to check, if a style is a string style.
75
76 @param style style to check (integer)
77 @return flag indicating a string style (boolean)
78 """
79 return style in [QsciLexerLua.String,
80 QsciLexerLua.LiteralString,
81 QsciLexerLua.UnclosedString]
82
83 def defaultKeywords(self, kwSet):
84 """
85 Public method to get the default keywords.
86
87 @param kwSet number of the keyword set (integer)
88 @return string giving the keywords (string) or None
89 """
90 return QsciLexerLua.keywords(self, kwSet)
91
92 def maximumKeywordSet(self):
93 """
94 Public method to get the maximum keyword set.
95
96 @return maximum keyword set (integer)
97 """
98 return 8

eric ide

mercurial