parent
289947f510
commit
00fce33644
71
mode/perl.py
71
mode/perl.py
|
@ -1,7 +1,8 @@
|
||||||
import os, re, sets, string, sys
|
import os, re, sets, string, sys
|
||||||
import buffer, color, commands, completer, context, default, method, mode, regex, tab
|
import buffer, color, commands, completer, context, default, method, mode, regex, tab
|
||||||
from point import Point
|
from point import Point
|
||||||
from lex import Grammar, PatternRule, ContextPatternRule, RegionRule, OverridePatternRule, PatternGroupRule
|
from lex import Grammar, PatternRule, ContextPatternRule, RegionRule, \
|
||||||
|
OverridePatternRule, PatternGroupRule
|
||||||
from method import Argument, Method, WrapParagraph
|
from method import Argument, Method, WrapParagraph
|
||||||
from tab import StackTabber, StackTabber2
|
from tab import StackTabber, StackTabber2
|
||||||
|
|
||||||
|
@ -185,74 +186,6 @@ class PerlTabber2(StackTabber2):
|
||||||
end_free_tokens = {'string.end': 1, 'pod.end': 1, 'heredoc.end': 1,
|
end_free_tokens = {'string.end': 1, 'pod.end': 1, 'heredoc.end': 1,
|
||||||
'evaldoc.start': 1}
|
'evaldoc.start': 1}
|
||||||
|
|
||||||
#class PerlTabber(StackTabber):
|
|
||||||
# def is_base(self, y):
|
|
||||||
# if y == 0:
|
|
||||||
# return True
|
|
||||||
# highlighter = self.mode.window.buffer.highlights[self.mode.name()]
|
|
||||||
# if not highlighter.tokens[y]:
|
|
||||||
# return False
|
|
||||||
# t = highlighter.tokens[y][0]
|
|
||||||
# return t.name == 'perl_keyword' and t.string == 'sub'
|
|
||||||
# def _handle_open_token(self, currlvl, y, i):
|
|
||||||
# currlvl = StackTabber._handle_open_token(self, currlvl, y, i)
|
|
||||||
# return currlvl
|
|
||||||
# def _handle_close_token(self, currlvl, y, i):
|
|
||||||
# w = self.mode.tabwidth
|
|
||||||
# self._opt_pop('cont')
|
|
||||||
# currlvl = StackTabber._handle_close_token(self, currlvl, y, i)
|
|
||||||
# token = self.get_token(y, i)
|
|
||||||
# if self.is_rightmost_token(y, i):
|
|
||||||
# if token.string == '}':
|
|
||||||
# self._opt_pop('cont')
|
|
||||||
# else:
|
|
||||||
# self._opt_append('cont', currlvl + w)
|
|
||||||
# return currlvl
|
|
||||||
# def _handle_other_token(self, currlvl, y, i):
|
|
||||||
# w = self.mode.tabwidth
|
|
||||||
# token = self.get_token(y, i)
|
|
||||||
# fqname = token.fqname()
|
|
||||||
# if fqname == 'delimiter' and token.string == ';':
|
|
||||||
# self._opt_pop('cont')
|
|
||||||
# elif fqname == 'heredoc.start':
|
|
||||||
# self._opt_append('heredoc', None)
|
|
||||||
# elif fqname == 'heredoc.end':
|
|
||||||
# self._opt_pop('heredoc')
|
|
||||||
# self._opt_pop('cont')
|
|
||||||
# elif fqname == 'quoted.start':
|
|
||||||
# self._opt_append('quoted', currlvl + w)
|
|
||||||
# elif fqname == 'quoted.end':
|
|
||||||
# self._opt_pop('cont')
|
|
||||||
# self._opt_pop('quoted')
|
|
||||||
# elif fqname == 'evaldoc.start':
|
|
||||||
# self._opt_append('evaldoc', None)
|
|
||||||
# elif fqname == 'evaldoc.end':
|
|
||||||
# self._opt_pop('evaldoc')
|
|
||||||
# self._opt_pop('cont')
|
|
||||||
# elif fqname == 'pod.start':
|
|
||||||
# self._opt_append('pod', None)
|
|
||||||
# elif fqname == 'pod.end':
|
|
||||||
# self._opt_pop('pod')
|
|
||||||
# currlvl = 0
|
|
||||||
# elif fqname == 'perl_string.start':
|
|
||||||
# self._opt_append('string', None)
|
|
||||||
# elif fqname == 'perl_string.end':
|
|
||||||
# self._opt_pop('string')
|
|
||||||
# if self.is_rightmost_token(y, i):
|
|
||||||
# self._opt_append('cont', currlvl + w)
|
|
||||||
# if self.is_rightmost_token(y, i):
|
|
||||||
# if(not fqname.startswith('pod') and
|
|
||||||
# not fqname.startswith('heredoc') and
|
|
||||||
# not fqname.startswith('perl_string') and
|
|
||||||
# not fqname.startswith('endblock') and
|
|
||||||
# fqname != 'eol' and
|
|
||||||
# fqname != 'comment' and
|
|
||||||
# fqname != 'spaces' and
|
|
||||||
# fqname != 'null' and
|
|
||||||
# token.string not in ('}', ';', '(', '{', '[', ',')):
|
|
||||||
# self._opt_append('cont', currlvl + w)
|
|
||||||
# return currlvl
|
|
||||||
|
|
||||||
class PerlSetLib(Method):
|
class PerlSetLib(Method):
|
||||||
'''Set the path(s) to find perl modules'''
|
'''Set the path(s) to find perl modules'''
|
||||||
args = [Argument("lib", type=type(""), prompt="Location of lib: ",
|
args = [Argument("lib", type=type(""), prompt="Location of lib: ",
|
||||||
|
|
Loading…
Reference in New Issue