Inferno  0.2
operator_db.inc
Go to the documentation of this file.
00001 // Not a header file - this should be included wherever a list of info about 
00002 // all the operators is required - if any of INFIX, PREFIX, POSTFIX are defined
00003 // they are invoked for each operator with pertinent info in the parameters 
00004 
00005 //TODO arrange for this to be generated by doxygen, by pre-processing it with
00006 // suitable #defines similar to what tree.hpp uses.
00007 
00008 // save typing by defining any macros not yet defined
00009 #ifndef PREFIX
00010 #define PREFIX(TOK, TEXT, NODE, BASE, CAT)
00011 #endif
00012 #ifndef POSTFIX
00013 #define POSTFIX(TOK, TEXT, NODE, BASE, CAT)
00014 #endif
00015 #ifndef INFIX
00016 #define INFIX(TOK, TEXT, NODE, BASE, CAT)
00017 #endif
00018 #ifndef OTHER
00019 #define OTHER(TOK, TEXT, NODE, BASE, CAT)
00020 #endif
00021 
00022 /*
00023 Syntax  Clang token          Text   Inferno node          Intermediate         Category */
00024 
00025 PREFIX(amp                 , "&",   AddressOf,            Unop,                   SPECIAL )
00026 INFIX(amp                  , "&",   BitwiseAnd,           CommutativeBinop,       BITWISE )
00027 INFIX(ampamp               , "&&",  LogicalAnd,           Binop,                  LOGICAL )
00028 INFIX(ampequal             , "&=",  AssignmentBitwiseAnd, AssignmentOperator,     BITWISE )
00029 INFIX(star                 , "*",   Multiply,             CommutativeBinop,       ARITHMETIC )
00030 PREFIX(star                , "*",   Dereference,          Unop,                   SPECIAL )
00031 INFIX(starequal            , "*=",  AssignmentMultiply,   AssignmentOperator,     ARITHMETIC )
00032 INFIX(plus                 , "+",   Add,                  CommutativeBinop,       ARITHMETIC )
00033 PREFIX(plusplus            , "++",  PreIncrement,         AssignmentOperator,     ARITHMETIC ) // operator++()
00034 POSTFIX(plusplus           , "++",  PostIncrement,        AssignmentOperator,     ARITHMETIC ) // operator++(int)
00035 INFIX(plusequal            , "+=",  AssignmentAdd,        AssignmentOperator,     ARITHMETIC )
00036 PREFIX(minus               , "-",   Negate,               Unop,                   ARITHMETIC )
00037 INFIX(minus                , "-",   Subtract,             Binop,                  ARITHMETIC )
00038 PREFIX(minusminus          , "--",  PreDecrement,         AssignmentOperator,     ARITHMETIC ) // operator--()
00039 POSTFIX(minusminus         , "--",  PostDecrement,        AssignmentOperator,     ARITHMETIC ) // operator--(int)
00040 INFIX(minusequal           , "-=",  AssignmentSubtract,   AssignmentOperator,     ARITHMETIC )
00041 PREFIX(tilde               , "~",   BitwiseNot,           Unop,                   BITWISE )
00042 PREFIX(exclaim             , "!",   LogicalNot,           Unop,                   LOGICAL )
00043 INFIX(exclaimequal         , "!=",  NotEqual,             CommutativeBinop,       COMPARISON )
00044 INFIX(slash                , "/",   Divide,               Binop,                  ARITHMETIC )
00045 INFIX(slashequal           , "/=",  AssignmentDivide,     AssignmentOperator,     ARITHMETIC )
00046 INFIX(percent              , "%",   Modulo,               Binop,                  ARITHMETIC )
00047 INFIX(percentequal         , "%=",  AssignmentModulo,     AssignmentOperator,     ARITHMETIC )
00048 INFIX(less                 , "<",   Less,                 Binop,                  COMPARISON )
00049 INFIX(lessless             , "<<",  ShiftLeft,            Binop,                  SHIFT )
00050 INFIX(lessequal            , "<=",  LessOrEqual,          Binop,                  COMPARISON )
00051 INFIX(lesslessequal        , "<<=", AssignmentShiftLeft,  AssignmentOperator,     SHIFT )
00052 INFIX(greater              , ">",   Greater,              Binop,                  COMPARISON )
00053 INFIX(greatergreater       , ">>",  ShiftRight,           Binop,                  SHIFT )
00054 INFIX(greaterequal         , ">=",  GreaterOrEqual,       Binop,                  COMPARISON )
00055 INFIX(greatergreaterequal  , ">>=", AssignmentShiftRight, AssignmentOperator,     SHIFT )
00056 INFIX(caret                , "^",   Eor,                  CommutativeBinop,       BITWISE )
00057 INFIX(caretequal           , "^=",  AssignmentEor,        AssignmentOperator,     BITWISE )
00058 INFIX(pipe                 , "|",   BitwiseOr,            CommutativeBinop,       BITWISE )
00059 INFIX(pipepipe             , "||",  LogicalOr,            Binop,                  LOGICAL )
00060 INFIX(pipeequal            , "|=",  AssignmentBitwiseOr,  AssignmentOperator,     BITWISE )
00061 INFIX(equal                , "=",   Assign,               AssignmentOperator,     SPECIAL )
00062 INFIX(equalequal           , "==",  Equal,                CommutativeBinop,       COMPARISON )
00063 INFIX(comma                , ",",   Comma,                Binop,                  SPECIAL ) 
00064 // TODO these four have no clang id, no string and are non-standard - put them back in cpptree.hpp
00065 OTHER(0                    , "",    Multiplexor,          Ternop,                 SPECIAL )  // a?b:c
00066 OTHER(0                    , "",    Subscript,            Binop,                  SPECIAL )  // a[b]
00067 OTHER(0                    , "",    MakeArray,            NonCommutativeOperator, SPECIAL ) // {a, b, c}
00068 OTHER(0                    , "",    This,                 Operator,               SPECIAL ) // this
00069 
00070 // save typing by undefining macros
00071 #undef PREFIX
00072 #undef POSTFIX
00073 #undef INFIX
00074 #undef OTHER