]>
Commit | Line | Data |
---|---|---|
b3378a02 | 1 | /* Cycript - Optimizing JavaScript Compiler/Runtime |
c1d3e52e | 2 | * Copyright (C) 2009-2015 Jay Freeman (saurik) |
4644480a JF |
3 | */ |
4 | ||
f95d2598 | 5 | /* GNU Affero General Public License, Version 3 {{{ */ |
4644480a | 6 | /* |
f95d2598 JF |
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. | |
11 | ||
12 | * This program is distributed in the hope that it will be useful, | |
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
c15969fd | 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
f95d2598 JF |
15 | * GNU Affero General Public License for more details. |
16 | ||
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/>. | |
b3378a02 | 19 | **/ |
4644480a JF |
20 | /* }}} */ |
21 | ||
c5fa2867 JF |
22 | #ifndef CYCRIPT_REPLACE_HPP |
23 | #define CYCRIPT_REPLACE_HPP | |
4de0686f | 24 | |
20052ff7 | 25 | #include "Syntax.hpp" |
4de0686f | 26 | |
2eb8215d | 27 | #define $ new($pool) |
4de0686f JF |
28 | |
29 | #define $D(args...) \ | |
30 | ($ CYNumber(args)) | |
31 | #define $E(args...) \ | |
32 | ($ CYExpress(args)) | |
33 | #define $F(args...) \ | |
34 | ($ CYFunctionExpression(args)) | |
35 | #define $I(args...) \ | |
36 | ($ CYIdentifier(args)) | |
37 | #define $M(args...) \ | |
38 | ($ CYDirectMember(args)) | |
39 | #define $P(args...) \ | |
40 | ($ CYFunctionParameter(args)) | |
41 | #define $S(args...) \ | |
42 | ($ CYString(args)) | |
550ee46a | 43 | #define $U \ |
2eb8215d | 44 | $V($I("undefined")) |
4de0686f | 45 | #define $V(name) \ |
2eb8215d | 46 | ($ CYVariable(name)) |
4de0686f JF |
47 | |
48 | #define $T(value) \ | |
49 | if (this == NULL) \ | |
50 | return value; | |
51 | #define $$ \ | |
52 | CYStatements() | |
53 | ||
54 | #define $P1(arg0, args...) \ | |
c8a0500b | 55 | $P(arg0, ##args) |
4de0686f | 56 | #define $P2(arg0, arg1, args...) \ |
c8a0500b | 57 | $P(arg0, $P1(arg1, ##args)) |
4de0686f | 58 | #define $P3(arg0, arg1, arg2, args...) \ |
c8a0500b | 59 | $P(arg0, $P2(arg1, arg2, ##args)) |
4de0686f | 60 | #define $P4(arg0, arg1, arg2, arg3, args...) \ |
c8a0500b | 61 | $P(arg0, $P3(arg1, arg2, arg3, ##args)) |
4de0686f | 62 | #define $P5(arg0, arg1, arg2, arg3, arg4, args...) \ |
c8a0500b | 63 | $P(arg0, $P4(arg1, arg2, arg3, arg4, ##args)) |
4de0686f | 64 | #define $P6(arg0, arg1, arg2, arg3, arg4, arg5, args...) \ |
c8a0500b | 65 | $P(arg0, $P5(arg1, arg2, arg3, arg4, arg5, ##args)) |
4de0686f JF |
66 | |
67 | #define $C(args...) \ | |
68 | ($ CYCall(args)) | |
69 | #define $C_(args...) \ | |
70 | ($ CYArgument(args)) | |
71 | #define $N(args...) \ | |
2eb8215d | 72 | ($ cy::Syntax::New(args)) |
4de0686f JF |
73 | |
74 | #define $C1_(arg0, args...) \ | |
75 | $C_(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)) | |
86 | ||
87 | #define $C0(func, args...) \ | |
88 | $C(func, ##args) | |
89 | #define $C1(func, args...) \ | |
90 | $C(func, $C1_(args)) | |
91 | #define $C2(func, args...) \ | |
92 | $C(func, $C2_(args)) | |
93 | #define $C3(func, args...) \ | |
94 | $C(func, $C3_(args)) | |
95 | #define $C4(func, args...) \ | |
96 | $C(func, $C4_(args)) | |
97 | #define $C5(func, args...) \ | |
98 | $C(func, $C5_(args)) | |
99 | ||
100 | #define $N0(func, args...) \ | |
101 | $N(func, ##args) | |
102 | #define $N1(func, args...) \ | |
103 | $N(func, $C1_(args)) | |
104 | #define $N2(func, args...) \ | |
105 | $N(func, $C2_(args)) | |
106 | #define $N3(func, args...) \ | |
107 | $N(func, $C3_(args)) | |
108 | #define $N4(func, args...) \ | |
109 | $N(func, $C4_(args)) | |
110 | #define $N5(func, args...) \ | |
111 | $N(func, $C5_(args)) | |
112 | ||
c5b15840 JF |
113 | #define $L(args...) \ |
114 | $ CYDeclaration(args) | |
550ee46a JF |
115 | #define $L1(arg0) \ |
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)) | |
125 | ||
c5fa2867 | 126 | #endif/*CYCRIPT_REPLACE_HPP*/ |