Changes in src/Common/SemanticError.cc [138e29e:3906301]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Common/SemanticError.cc
r138e29e r3906301 22 22 #include "SemanticError.h" 23 23 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 31 24 SemanticError::SemanticError() { 32 25 } 33 26 34 27 SemanticError::SemanticError( std::string error ) { 35 28 append( error ); 36 29 } 37 30 38 31 void SemanticError::append( SemanticError &other ) { 39 32 errors.splice( errors.end(), other.errors ); 40 33 } 41 34 42 35 void SemanticError::append( const std::string & msg ) { 43 errors.emplace_back( error_str() + msg );36 errors.push_back( std::string( "Error: ") + msg ); 44 37 } 45 38 … … 49 42 50 43 void 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" ) ); 59 45 } 60 46
Note: See TracChangeset
for help on using the changeset viewer.