|
1 # -*- coding: utf-8 -*- |
|
2 |
|
3 # Copyright (c) 2005 - 2009 Detlev Offenbach <detlev@die-offenbachs.de> |
|
4 # |
|
5 |
|
6 """ |
|
7 Module implementing a Ruby lexer with some additional methods. |
|
8 """ |
|
9 |
|
10 from PyQt4.Qsci import QsciLexerRuby |
|
11 |
|
12 from Lexer import Lexer |
|
13 |
|
14 class LexerRuby(QsciLexerRuby, Lexer): |
|
15 """ |
|
16 Subclass to implement some additional lexer dependant methods. |
|
17 """ |
|
18 def __init__(self, parent=None): |
|
19 """ |
|
20 Constructor |
|
21 |
|
22 @param parent parent widget of this lexer |
|
23 """ |
|
24 QsciLexerRuby.__init__(self, parent) |
|
25 Lexer.__init__(self) |
|
26 |
|
27 self.commentString = "#" |
|
28 |
|
29 def autoCompletionWordSeparators(self): |
|
30 """ |
|
31 Public method to return the list of separators for autocompletion. |
|
32 |
|
33 @return list of separators (list of strings) |
|
34 """ |
|
35 return ['.'] |
|
36 |
|
37 def isCommentStyle(self, style): |
|
38 """ |
|
39 Public method to check, if a style is a comment style. |
|
40 |
|
41 @return flag indicating a comment style (boolean) |
|
42 """ |
|
43 return style in [QsciLexerRuby.Comment] |
|
44 |
|
45 def isStringStyle(self, style): |
|
46 """ |
|
47 Public method to check, if a style is a string style. |
|
48 |
|
49 @return flag indicating a string style (boolean) |
|
50 """ |
|
51 return style in [QsciLexerRuby.DoubleQuotedString, |
|
52 QsciLexerRuby.HereDocument, |
|
53 QsciLexerRuby.PercentStringQ, |
|
54 QsciLexerRuby.PercentStringq, |
|
55 QsciLexerRuby.PercentStringr, |
|
56 QsciLexerRuby.PercentStringw, |
|
57 QsciLexerRuby.PercentStringx, |
|
58 QsciLexerRuby.SingleQuotedString] |