parent
a7a5215bc9
commit
17839aff0c
|
@ -120,11 +120,16 @@ class PythonGrammar(Grammar):
|
|||
),
|
||||
]
|
||||
|
||||
class PythonTabber(tab2.StackTabber):
|
||||
pass
|
||||
|
||||
class Python(mode2.Fundamental):
|
||||
#tabbercls = tab2.Tabber
|
||||
tabbercls = PythonTabber
|
||||
grammar = PythonGrammar()
|
||||
opentags = {'(': ')', '[': ']', '{': '}'}
|
||||
closetags = {')': '(', ']': '[', '}': '{'}
|
||||
opentoken = 'delimiter'
|
||||
opentags = {'(': ')', '[': ']', '{': '}'}
|
||||
closetoken = 'delimiter'
|
||||
closetags = {')': '(', ']': '[', '}': '{'}
|
||||
def __init__(self, w):
|
||||
mode2.Fundamental.__init__(self, w)
|
||||
|
||||
|
|
55
tab2.py
55
tab2.py
|
@ -158,58 +158,3 @@ class StackTabber(Tabber):
|
|||
def _opt_pop(self, *names):
|
||||
if self.markers and self.markers[-1].name in names:
|
||||
self.markers.pop(-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]
|
||||
# if t.name == 'keyword' and t.string == 'sub':
|
||||
# return True
|
||||
# return False
|
||||
# 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):
|
||||
# self._opt_pop('cont')
|
||||
# currlvl = StackTabber._handle_close_token(self, currlvl, y, i)
|
||||
# token = self.get_token(y, i)
|
||||
# if token.string == '}':
|
||||
# self._opt_pop('cont')
|
||||
# elif self.is_rightmost_token(y, i):
|
||||
# self._opt_append('cont', currlvl + 4)
|
||||
# return currlvl
|
||||
# def _handle_other_token(self, currlvl, y, i):
|
||||
# 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 == 'pod.start':
|
||||
# self._opt_append('pod', None)
|
||||
# elif fqname == 'pod.end':
|
||||
# self._opt_pop('pod')
|
||||
# currlvl = 0
|
||||
# elif fqname == 'string.start':
|
||||
# self._opt_append('string', None)
|
||||
# elif fqname == 'string.end':
|
||||
# self._opt_pop('string')
|
||||
# if self.is_rightmost_token(y, i):
|
||||
# self._opt_append('cont', currlvl + 4)
|
||||
# if self.is_rightmost_token(y, i):
|
||||
# if(not fqname.startswith('pod') and
|
||||
# not fqname.startswith('heredoc') and
|
||||
# not fqname.startswith('string') and
|
||||
# not fqname.startswith('endblock') and
|
||||
# not fqname == 'comment' and
|
||||
# not fqname == 'null' and
|
||||
# token.string not in ('}', ';', '(', '{', '[', ',')):
|
||||
# self._opt_append('cont' % fqname, currlvl + 4)
|
||||
# return currlvl
|
||||
|
|
Loading…
Reference in New Issue