Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/CodeGen/OperatorTable.cc

    rbff227f re5f2a67  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Dec 13 14:33:05 2016
    13 // Update Count     : 10
     12// Last Modified On : Sat Jul 15 17:12:22 2017
     13// Update Count     : 15
    1414//
    1515
    16 #include <algorithm>  // for any_of
    17 #include <map>        // for map, _Rb_tree_const_iterator, map<>::const_iterator
    18 #include <utility>    // for pair
     16#include <map>      // for map, _Rb_tree_const_iterator, map<>::const_iterator
     17#include <utility>  // for pair
    1918
    2019#include "OperatorTable.h"
     
    3635                        {       "++?",          "++",   "_operator_preincr",                    OT_PREFIXASSIGN         },
    3736                        {       "--?",          "--",   "_operator_predecr",                    OT_PREFIXASSIGN         },
     37                        {       "?\\?",         "\\",   "_operator_exponential",                OT_INFIX                        },
    3838                        {       "?*?",          "*",    "_operator_multiply",                   OT_INFIX                        },
    3939                        {       "?/?",          "/",    "_operator_divide",                             OT_INFIX                        },
     
    5353                        {       "?|?",          "|",    "_operator_bitor",                              OT_INFIX                        },
    5454                        {       "?=?",          "=",    "_operator_assign",                             OT_INFIXASSIGN          },
     55                        {       "?\\=?",        "\\=",  "_operator_expassign",                  OT_INFIXASSIGN          },
    5556                        {       "?*=?",         "*=",   "_operator_multassign",                 OT_INFIXASSIGN          },
    5657                        {       "?/=?",         "/=",   "_operator_divassign",                  OT_INFIXASSIGN          },
     
    9293                } // if
    9394        }
    94 
    95         /// determines if a given function name is one of the operator types between [begin, end)
    96         template<typename Iterator>
    97         bool isOperatorType( const std::string & funcName, Iterator begin, Iterator end ) {
    98                 OperatorInfo info;
    99                 if ( operatorLookup( funcName, info ) ) {
    100                         return std::find( begin, end, info.type ) != end;
    101                 }
    102                 return false;
    103         }
    104 
    105         bool isConstructor( const std::string & funcName ) {
    106                 static OperatorType types[] = { OT_CTOR };
    107                 return isOperatorType( funcName, std::begin(types), std::end(types) );
    108         }
    109 
    110         bool isDestructor( const std::string & funcName ) {
    111                 static OperatorType types[] = { OT_DTOR };
    112                 return isOperatorType( funcName, std::begin(types), std::end(types) );
    113         }
    114 
    115         bool isAssignment( const std::string & funcName ) {
    116                 static OperatorType types[] = { OT_PREFIXASSIGN, OT_POSTFIXASSIGN, OT_INFIXASSIGN };
    117                 return isOperatorType( funcName, std::begin(types), std::end(types) );
    118         }
    119 
    120         bool isCtorDtor( const std::string & funcName ) {
    121                 static OperatorType types[] = { OT_CTOR, OT_DTOR };
    122                 return isOperatorType( funcName, std::begin(types), std::end(types) );
    123         }
    124 
    125         bool isCtorDtorAssign( const std::string & funcName ) {
    126                 static OperatorType types[] = { OT_CTOR, OT_DTOR, OT_PREFIXASSIGN, OT_POSTFIXASSIGN, OT_INFIXASSIGN };
    127                 return isOperatorType( funcName, std::begin(types), std::end(types) );
    128         }
    12995} // namespace CodeGen
    13096
Note: See TracChangeset for help on using the changeset viewer.