Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Common/SemanticError.h

    r9ed4f94 r21f0aa8  
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Aug 29 22:03:36 2017
    13 // Update Count     : 17
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Thr Aug 17 14:01:00 2017
     13// Update Count     : 7
    1414//
    1515
    1616#pragma once
    1717
    18 #include <exception>                                                                    // for exception
    19 #include <iostream>                                                                             // for ostream
    20 #include <list>                                                                                 // for list
    21 #include <string>                                                                               // for string
    22 #include <unistd.h>                                                                             // for isatty
     18#include <exception>  // for exception
     19#include <iostream>   // for ostream
     20#include <list>       // for list
     21#include <string>     // for string
    2322
    24 #include "CodeLocation.h"                                                               // for CodeLocation, toString
     23#include "CodeLocation.h"  // for CodeLocation, toString
    2524
    2625struct error {
     
    2928
    3029        error() = default;
    31         error( const std::string & str ) : description( str ) {}
     30        error( const std::string& str ) : description( str ) {}
    3231
    33         void maybeSet( const CodeLocation & location ) {
     32        void maybeSet( const CodeLocation& location ) {
    3433                if( this->location.linenumber < 0 ) {
    3534                        this->location = location;
     
    4241        SemanticError();
    4342        SemanticError( std::string error );
    44         template< typename T > SemanticError( const std::string & error, const T * obj );
     43        template< typename T > SemanticError( const std::string &error, const T *obj );
    4544        ~SemanticError() throw() {}
    4645
    47         static inline const std::string & error_str() {
    48                 static std::string str = isatty( STDERR_FILENO ) ? "\e[31merror:\e[39m " : "error: ";
    49                 return str;
    50         }
    51 
    52         void append( SemanticError & other );
     46        void append( SemanticError &other );
    5347        void append( const std::string & );
    5448        bool isEmpty() const;
    55         void print( std::ostream & os );
     49        void print( std::ostream &os );
    5650
    57         void set_location( const CodeLocation & location );
    58         // constructs an exception using the given message and the printed representation of the obj (T must have a print
    59         // method)
     51        void set_location( const CodeLocation& location );
     52        // constructs an exception using the given message and the printed
     53        // representation of the obj (T must have a print method)
    6054  private:
    6155        std::list< error > errors;
     
    6357
    6458template< typename T >
    65 SemanticError::SemanticError( const std::string & error, const T * obj ) {
     59SemanticError::SemanticError( const std::string &error, const T *obj ) {
    6660        append( toString( error, obj ) );
    6761}
Note: See TracChangeset for help on using the changeset viewer.