7 Module implementing a CoffeeScript lexer with some additional methods. |
7 Module implementing a CoffeeScript lexer with some additional methods. |
8 """ |
8 """ |
9 |
9 |
10 from __future__ import unicode_literals |
10 from __future__ import unicode_literals |
11 |
11 |
12 from PyQt4.Qsci import QsciLexerCoffeScript |
12 from PyQt4.Qsci import QsciLexerCoffeeScript |
13 |
13 |
14 from .Lexer import Lexer |
14 from .Lexer import Lexer |
15 import Preferences |
15 import Preferences |
16 |
16 |
17 |
17 |
18 class LexerJavaScript(Lexer, QsciLexerCoffeScript): |
18 class LexerCoffeeScript(Lexer, QsciLexerCoffeeScript): |
19 """ |
19 """ |
20 Subclass to implement some additional lexer dependant methods. |
20 Subclass to implement some additional lexer dependant methods. |
21 """ |
21 """ |
22 def __init__(self, parent=None): |
22 def __init__(self, parent=None): |
23 """ |
23 """ |
24 Constructor |
24 Constructor |
25 |
25 |
26 @param parent parent widget of this lexer |
26 @param parent parent widget of this lexer |
27 """ |
27 """ |
28 QsciLexerCoffeScript.__init__(self, parent) |
28 QsciLexerCoffeeScript.__init__(self, parent) |
29 Lexer.__init__(self) |
29 Lexer.__init__(self) |
30 |
30 |
31 self.commentString = "#" |
31 self.commentString = "#" |
32 self.streamCommentString = { |
32 self.streamCommentString = { |
33 'start': '###\n', |
33 'start': '###\n', |
52 Public method to check, if a style is a comment style. |
52 Public method to check, if a style is a comment style. |
53 |
53 |
54 @param style style to check (integer) |
54 @param style style to check (integer) |
55 @return flag indicating a comment style (boolean) |
55 @return flag indicating a comment style (boolean) |
56 """ |
56 """ |
57 return style in [QsciLexerCoffeScript.Comment, |
57 return style in [QsciLexerCoffeeScript.Comment, |
58 QsciLexerCoffeScript.CommentDoc, |
58 QsciLexerCoffeeScript.CommentDoc, |
59 QsciLexerCoffeScript.CommentLine, |
59 QsciLexerCoffeeScript.CommentLine, |
60 QsciLexerCoffeScript.CommentLineDoc, |
60 QsciLexerCoffeeScript.CommentLineDoc, |
61 QsciLexerCoffeScript.CommentBlock, |
61 QsciLexerCoffeeScript.CommentBlock, |
62 QsciLexerCoffeScript.BlockRegexComment] |
62 QsciLexerCoffeeScript.BlockRegexComment] |
63 |
63 |
64 def isStringStyle(self, style): |
64 def isStringStyle(self, style): |
65 """ |
65 """ |
66 Public method to check, if a style is a string style. |
66 Public method to check, if a style is a string style. |
67 |
67 |
68 @param style style to check (integer) |
68 @param style style to check (integer) |
69 @return flag indicating a string style (boolean) |
69 @return flag indicating a string style (boolean) |
70 """ |
70 """ |
71 return style in [QsciLexerCoffeScript.DoubleQuotedString, |
71 return style in [QsciLexerCoffeeScript.DoubleQuotedString, |
72 QsciLexerCoffeScript.SingleQuotedString, |
72 QsciLexerCoffeeScript.SingleQuotedString, |
73 QsciLexerCoffeScript.UnclosedString, |
73 QsciLexerCoffeeScript.UnclosedString, |
74 QsciLexerCoffeScript.VerbatimString] |
74 QsciLexerCoffeeScript.VerbatimString] |
75 |
75 |
76 def defaultKeywords(self, kwSet): |
76 def defaultKeywords(self, kwSet): |
77 """ |
77 """ |
78 Public method to get the default keywords. |
78 Public method to get the default keywords. |
79 |
79 |
80 @param kwSet number of the keyword set (integer) |
80 @param kwSet number of the keyword set (integer) |
81 @return string giving the keywords (string) or None |
81 @return string giving the keywords (string) or None |
82 """ |
82 """ |
83 return QsciLexerCoffeScript.keywords(self, kwSet) |
83 return QsciLexerCoffeeScript.keywords(self, kwSet) |
|
84 |
|
85 def maximumKeywordSet(self): |
|
86 """ |
|
87 Public method to get the maximum keyword set. |
|
88 |
|
89 @return maximum keyword set (integer) |
|
90 """ |
|
91 return 4 |