some improvements

--HG--
branch : pmacs2
This commit is contained in:
moculus 2007-07-13 08:08:09 +00:00
parent c6514c3032
commit acfcb09dea
1 changed files with 6 additions and 3 deletions

View File

@ -17,11 +17,11 @@ class SqlGrammar(Grammar):
RegionRule(r'quoted', '"', StringGrammar, '"'), RegionRule(r'quoted', '"', StringGrammar, '"'),
PatternRule(r'bareword', r'[A-Za-z0-9_]+'), PatternRule(r'bareword', r'[A-Za-z0-9_]+'),
PatternRule(r'empty', r'^ *\n$'), PatternRule(r'empty', r'^ *\n$'),
PatternRule(r'eol', r'; *\n'), PatternRule(r'eol', r'\n'),
PatternRule(r'continuation', r'\n'),
] ]
class SqlTabber(tab2.StackTabber): class SqlTabber(tab2.StackTabber):
wst = ('null', 'eol',)
def is_base(self, y): def is_base(self, y):
if y == 0: if y == 0:
return True return True
@ -32,10 +32,13 @@ class SqlTabber(tab2.StackTabber):
return t.name == 'function' return t.name == 'function'
def _handle_other_token(self, currlvl, y, i): def _handle_other_token(self, currlvl, y, i):
token = self.get_token(y, i) token = self.get_token(y, i)
if token.name == 'delimiter' and token.string == ';':
self._opt_pop('cont')
if self.is_rightmost_token(y, i): if self.is_rightmost_token(y, i):
if not self._empty() and token.name == 'continuation': if not self._empty() and token.name == 'continuation':
self._opt_append('cont', currlvl + 4) self._opt_append('cont', currlvl + 4)
elif token.name == 'eol': elif token.name == 'eol' and not self.markers:
self._opt_pop("cont") self._opt_pop("cont")
return currlvl return currlvl