parent
7c70d570ac
commit
7c07ed1e3b
23
mode/perl.py
23
mode/perl.py
|
@ -712,12 +712,25 @@ class Perl(mode.Fundamental):
|
|||
self.functions = None
|
||||
|
||||
def build_function_map(self):
|
||||
b = self.window.buffer
|
||||
self.functions = {}
|
||||
for i in range(0, len(b.lines)):
|
||||
m = regex.perl_function.match(b.lines[i])
|
||||
if m:
|
||||
self.functions[m.group(1)] = i
|
||||
self.funclines = []
|
||||
highlights = self.window.get_highlighter()
|
||||
curr, stack = None, []
|
||||
for group in highlights.tokens:
|
||||
for t in group:
|
||||
if not curr and t.name == 'sub':
|
||||
curr = t.string
|
||||
stack = []
|
||||
self.functions[curr] = t.y
|
||||
elif t.name == 'delimiter':
|
||||
if t.string == '{':
|
||||
stack.append(None)
|
||||
elif t.string == '}':
|
||||
stack.pop()
|
||||
if not stack:
|
||||
curr = None
|
||||
self.funclines.append(curr)
|
||||
|
||||
def get_functions(self):
|
||||
if self.functions is None:
|
||||
self.build_function_map()
|
||||
|
|
Loading…
Reference in New Issue