7 Module implementing the lexer mixin class. |
7 Module implementing the lexer mixin class. |
8 """ |
8 """ |
9 |
9 |
10 import Preferences |
10 import Preferences |
11 |
11 |
|
12 |
12 class Lexer(object): |
13 class Lexer(object): |
13 """ |
14 """ |
14 Class to implement the lexer mixin class. |
15 Class to implement the lexer mixin class. |
15 """ |
16 """ |
16 def __init__(self): |
17 def __init__(self): |
17 """ |
18 """ |
18 Constructor |
19 Constructor |
19 """ |
20 """ |
20 self.commentString = '' |
21 self.commentString = '' |
21 self.streamCommentString = { |
22 self.streamCommentString = { |
22 'start' : '', |
23 'start': '', |
23 'end' : '' |
24 'end': '' |
24 } |
25 } |
25 self.boxCommentString = { |
26 self.boxCommentString = { |
26 'start' : '', |
27 'start': '', |
27 'middle' : '', |
28 'middle': '', |
28 'end' : '' |
29 'end': '' |
29 } |
30 } |
30 |
31 |
31 # last indented line wrapper |
32 # last indented line wrapper |
32 self.lastIndented = -1 |
33 self.lastIndented = -1 |
33 self.lastIndentedIndex = -1 |
34 self.lastIndentedIndex = -1 |
157 # get the indentation difference |
158 # get the indentation difference |
158 indentDifference = self.getIndentationDifference(lineFrom, editor) |
159 indentDifference = self.getIndentationDifference(lineFrom, editor) |
159 |
160 |
160 editor.beginUndoAction() |
161 editor.beginUndoAction() |
161 # iterate over the lines |
162 # iterate over the lines |
162 for line in range(lineFrom, endLine+1): |
163 for line in range(lineFrom, endLine + 1): |
163 editor.setIndentation(line, |
164 editor.setIndentation(line, |
164 editor.indentation(line) + indentDifference) |
165 editor.indentation(line) + indentDifference) |
165 editor.endUndoAction() |
166 editor.endUndoAction() |
166 |
167 |
167 if self.lastIndentedIndex != 0: |
168 if self.lastIndentedIndex != 0: |
168 indexStart = indexFrom + indentDifference |
169 indexStart = indexFrom + indentDifference |