1 /* Cycript - Optimizing JavaScript Compiler/Runtime
 
   2  * Copyright (C) 2009-2014  Jay Freeman (saurik)
 
   5 /* GNU Affero General Public License, Version 3 {{{ */
 
   7  * This program is free software: you can redistribute it and/or modify
 
   8  * it under the terms of the GNU Affero General Public License as published by
 
   9  * the Free Software Foundation, either version 3 of the License, or
 
  10  * (at your option) any later version.
 
  12  * This program is distributed in the hope that it will be useful,
 
  13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
  14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
  15  * GNU Affero General Public License for more details.
 
  17  * You should have received a copy of the GNU Affero General Public License
 
  18  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
  22 #ifndef CYCRIPT_REPLACE_HPP
 
  23 #define CYCRIPT_REPLACE_HPP
 
  34     ($ CYFunctionExpression(args))
 
  36     ($ CYIdentifier(args))
 
  38     ($ CYDirectMember(args))
 
  40     ($ CYFunctionParameter(args))
 
  54 #define $P1(arg0, args...) \
 
  56 #define $P2(arg0, arg1, args...) \
 
  57     $P(arg0, $P1(arg1, ##args))
 
  58 #define $P3(arg0, arg1, arg2, args...) \
 
  59     $P(arg0, $P2(arg1, arg2, ##args))
 
  60 #define $P4(arg0, arg1, arg2, arg3, args...) \
 
  61     $P(arg0, $P3(arg1, arg2, arg3, ##args))
 
  62 #define $P5(arg0, arg1, arg2, arg3, arg4, args...) \
 
  63     $P(arg0, $P4(arg1, arg2, arg3, arg4, ##args))
 
  64 #define $P6(arg0, arg1, arg2, arg3, arg4, arg5, args...) \
 
  65     $P(arg0, $P5(arg1, arg2, arg3, arg4, arg5, ##args))
 
  69 #define $C_(args...) \
 
  72     ($ cy::Syntax::New(args))
 
  74 #define $C1_(arg0, args...) \
 
  76 #define $C2_(arg0, arg1, args...) \
 
  77     $C_(arg0, $C1_(arg1, ##args))
 
  78 #define $C3_(arg0, arg1, arg2, args...) \
 
  79     $C_(arg0, $C2_(arg1, arg2, ##args))
 
  80 #define $C4_(arg0, arg1, arg2, arg3, args...) \
 
  81     $C_(arg0, $C3_(arg1, arg2, arg3, ##args))
 
  82 #define $C5_(arg0, arg1, arg2, arg3, arg4, args...) \
 
  83     $C_(arg0, $C4_(arg1, arg2, arg3, arg4, ##args))
 
  84 #define $C6_(arg0, arg1, arg2, arg3, arg4, arg5, args...) \
 
  85     $C_(arg0, $C5_(arg1, arg2, arg3, arg4, arg5, ##args))
 
  87 #define $C0(func, args...) \
 
  89 #define $C1(func, args...) \
 
  91 #define $C2(func, args...) \
 
  93 #define $C3(func, args...) \
 
  95 #define $C4(func, args...) \
 
  97 #define $C5(func, args...) \
 
 100 #define $N0(func, args...) \
 
 102 #define $N1(func, args...) \
 
 104 #define $N2(func, args...) \
 
 106 #define $N3(func, args...) \
 
 108 #define $N4(func, args...) \
 
 110 #define $N5(func, args...) \
 
 113 #define $L(arg0, args...) \
 
 114     $ CYDeclaration($I(arg0), ##args)
 
 116     $ CYDeclarations(arg0)
 
 117 #define $L2(arg0, args...) \
 
 118     $ CYDeclarations(arg0, $L1(args))
 
 119 #define $L3(arg0, args...) \
 
 120     $ CYDeclarations(arg0, $L2(args))
 
 121 #define $L4(arg0, args...) \
 
 122     $ CYDeclarations(arg0, $L3(args))
 
 123 #define $L5(arg0, args...) \
 
 124     $ CYDeclarations(arg0, $L4(args))
 
 126 #endif/*CYCRIPT_REPLACE_HPP*/