Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Common/SemanticError.cc

    r138e29e r3906301  
    2222#include "SemanticError.h"
    2323
    24 #include <unistd.h>
    25 
    26 inline const std::string& error_str() {
    27         static std::string str = isatty( fileno(stderr) ) ? "\e[31merror:\e[39m " : "error: ";
    28         return str;
    29 }
    30 
    3124SemanticError::SemanticError() {
    3225}
    3326
    3427SemanticError::SemanticError( std::string error ) {
    35         append( error );
     28  append( error );
    3629}
    3730
    3831void SemanticError::append( SemanticError &other ) {
    39         errors.splice( errors.end(), other.errors );
     32  errors.splice( errors.end(), other.errors );
    4033}
    4134
    4235void SemanticError::append( const std::string & msg ) {
    43         errors.emplace_back( error_str() + msg );
     36  errors.push_back( std::string( "Error: ") + msg );
    4437}
    4538
     
    4942
    5043void SemanticError::print( std::ostream &os ) {
    51         using std::to_string;
    52         for(auto err : errors) {
    53                 os << to_string( err.location ) << err.description << '\n';
    54         }
    55 }
    56 
    57 void SemanticError::set_location( const CodeLocation& location ) {
    58         errors.begin()->maybeSet( location );
     44        std::copy( errors.begin(), errors.end(), std::ostream_iterator< std::string >( os, "\n" ) );
    5945}
    6046
Note: See TracChangeset for help on using the changeset viewer.