Project

General

Profile

« Previous | Next » 

Revision 1719

Parser.py: Renamed SyntaxException to SyntaxError because it's an unexpected condition that should exit the program, a.k.a. an error

View differences:

lib/Parser.py
4 4

  
5 5
import term
6 6

  
7
class SyntaxException(Exception): pass
7
class SyntaxError(Exception): pass
8 8

  
9 9
class Parser:
10 10
    def __init__(self, str_):
......
33 33
    def syntax_err(self, token):
34 34
        after = self._str[self._pos:]
35 35
        if after == '': after += '<END>'
36
        raise SyntaxException(self.__class__.__name__+' syntax error: '+token
36
        raise SyntaxError(self.__class__.__name__+' syntax error: '+token
37 37
            +' expected in '+ term.as_style('90', self._str[:self._pos]) +after)
lib/maps.py
8 8

  
9 9
def col_info(col_name, require_root=False):
10 10
    '''@return tuple (label, root, prefixes)'''
11
    def syntax_err(): raise Parser.SyntaxException('Column name must have '
11
    def syntax_err(): raise Parser.SyntaxError('Column name must have '
12 12
        'syntax "datasrc[format,...]:root" (formats optional): '+col_name)
13 13
    
14 14
    match = re.match(r'^([^\[:]*)(?:\[([^\]]*?)\])?(?::(.*))?$', col_name)
bin/map
320 320

  
321 321
def main():
322 322
    try: main_()
323
    except Parser.SyntaxException, e: raise SystemExit(str(e))
323
    except Parser.SyntaxError, e: raise SystemExit(str(e))
324 324

  
325 325
if __name__ == '__main__':
326 326
    profile_to = opts.get_env_var('profile_to', None)

Also available in: Unified diff