Project

General

Profile

« Previous | Next » 

Revision 151

Added faded beginning of string in Parser syntax errors

View differences:

scripts/lib/Parser.py
2 2

  
3 3
import re
4 4

  
5
import term
6

  
5 7
class SyntaxException(Exception): pass
6 8

  
7 9
class Parser:
......
30 32
    
31 33
    def _syntax_err(self, token):
32 34
        raise SyntaxException(self.__class__.__name__+' syntax error: '+token
33
            +' expected in '+self._str[self._pos:])
35
            +' expected in '+term.as_style('90', self._str[:self._pos])
36
            +self._str[self._pos:]+'<END>')
scripts/lib/term.py
1
# Exception handling
2

  
3
csi = '\x1B['
4

  
5
def set_style(style): return csi+style+'m'
6

  
7
reset_style = set_style('0')
8

  
9
def as_style(style, text): return set_style(style)+text+reset_style

Also available in: Unified diff