def display_assertion(self, line, level ): def start( level ): return start_colour( level ) matches = re.match( r'(?P<file>[a-zA-Z0-9.@_/\s\-]+)[(](?P<line>[0-9]+)[)]: ' '(?P<message>[a-zA-Z0-9(){}:%.*&_<>/\-+=!," \[\]]+)', line ) if matches: path = matches.group( 'file' ) line = matches.group( 'line' ) message = matches.group( 'message') display = self._toolchain.error_format() sys.stdout.write( display.format( start(level) + as_emphasised( path ) + start(level), as_emphasised( line ) + start(level), message + colour_reset() ) + "\n" ) else: sys.stdout.write( as_colour( level, line ) + "\n" )
def display_assertion(self, line, level ): def start( level ): return start_colour( level ) matches = re.match( r'(?P<file>[a-zA-Z0-9._/\s\-]+)[(](?P<line>[0-9]+)[)]: ' '(?P<message>[a-zA-Z0-9(){}:%.*&_<>/\-+=!," \[\]]+)', line ) if matches: path = matches.group( 'file' ) line = matches.group( 'line' ) message = matches.group( 'message') display = self._toolchain.error_format() sys.stdout.write( display.format( start(level) + as_emphasised( path ) + start(level), as_emphasised( line ) + start(level), message + colour_reset() ) + "\n" ) else: sys.stdout.write( as_colour( level, line ) + "\n" )
def failed_assertion(self, line ): def start_error(): return start_colour( "error" ) matches = re.match( r'(?P<file>[a-zA-Z0-9._/\s\-]+)[(](?P<line>[0-9]+)[)]: ' '(?P<message>[a-zA-Z0-9(){}:&_<>/\-=!," \[\]]+)', line ) if matches: path = matches.group( 'file' ) line = matches.group( 'line' ) message = matches.group( 'message') error = self._toolchain.error_format() sys.stdout.write( error.format( start_error() + as_emphasised( path ) + start_error(), as_emphasised( line ) + start_error(), message + colour_reset() ) + "\n" ) else: sys.stdout.write( as_colour( "error", line ) + "\n" )