1 /* Cycript - Optimizing JavaScript Compiler/Runtime
2 * Copyright (C) 2009-2013 Jay Freeman (saurik)
5 /* GNU General Public License, Version 3 {{{ */
7 * Cycript is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published
9 * by the Free Software Foundation, either version 3 of the License,
10 * or (at your option) any later version.
12 * Cycript is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Cycript. If not, see <http://www.gnu.org/licenses/>.
22 #ifndef CYCRIPT_OBJECTIVEC_SYNTAX_HPP
23 #define CYCRIPT_OBJECTIVEC_SYNTAX_HPP
30 CYTypeModifier *type_;
31 CYTypedParameter *parameters_;
32 CYStatement *statements_;
34 CYObjCBlock(CYTypeModifier *type, CYTypedParameter *parameters, CYStatement *statements) :
36 parameters_(parameters),
37 statements_(statements)
43 virtual CYExpression *Replace(CYContext &context);
44 virtual void Output(CYOutput &out, CYFlags flags) const;
47 struct CYEncodedType :
50 CYTypeModifier *type_;
52 CYEncodedType(CYTypeModifier *type) :
59 virtual CYExpression *Replace(CYContext &context);
60 virtual void Output(CYOutput &out, CYFlags flags) const;
68 CYBox(CYExpression *value) :
75 virtual CYExpression *Replace(CYContext &context);
76 virtual void Output(CYOutput &out, CYFlags flags) const;
79 struct CYSelectorPart :
80 CYNext<CYSelectorPart>,
86 CYSelectorPart(CYWord *name, bool value, CYSelectorPart *next = NULL) :
87 CYNext<CYSelectorPart>(next),
93 CYString *Replace(CYContext &context);
94 virtual void Output(CYOutput &out) const;
100 CYSelectorPart *name_;
102 CYSelector(CYSelectorPart *name) :
109 virtual CYExpression *Replace(CYContext &context);
110 virtual void Output(CYOutput &out, CYFlags flags) const;
119 CYField(CYExpression *type, CYIdentifier *name, CYField *next = NULL) :
120 CYNext<CYField>(next),
126 CYStatement *Replace(CYContext &context) const;
127 void Output(CYOutput &out) const;
130 struct CYMessageParameter :
131 CYNext<CYMessageParameter>
137 CYMessageParameter(CYWord *tag, CYExpression *type, CYIdentifier *name) :
144 CYFunctionParameter *Parameters(CYContext &context) const;
145 CYSelector *Selector(CYContext &context) const;
146 CYSelectorPart *SelectorPart(CYContext &context) const;
147 CYExpression *TypeSignature(CYContext &context) const;
155 CYMessageParameter *parameters_;
158 CYMessage(bool instance, CYExpression *type, CYMessageParameter *parameter, CYStatement *statements) :
161 parameters_(parameter),
166 CYStatement *Replace(CYContext &context, bool replace) const;
167 void Output(CYOutput &out, bool replace) const;
169 CYExpression *TypeSignature(CYContext &context) const;
178 CYProtocol(CYExpression *name, CYProtocol *next = NULL) :
179 CYNext<CYProtocol>(next),
184 CYStatement *Replace(CYContext &context) const;
185 void Output(CYOutput &out) const;
191 virtual CYStatement *Replace(CYContext &context);
192 virtual void Output(CYOutput &out, CYFlags flags) const;
197 CYExpression *super_;
198 CYProtocol *protocols_;
200 CYMessage *messages_;
202 CYClass(CYClassName *name, CYExpression *super, CYProtocol *protocols, CYField *fields, CYMessage *messages) :
205 protocols_(protocols),
214 CYExpression *Replace_(CYContext &context);
215 virtual void Output(CYOutput &out, CYFlags flags) const;
218 struct CYClassExpression :
222 CYClassExpression(CYClassName *name, CYExpression *super, CYProtocol *protocols, CYField *fields, CYMessage *messages) :
223 CYClass(name, super, protocols, fields, messages)
229 virtual CYExpression *Replace(CYContext &context);
230 virtual void Output(CYOutput &out, CYFlags flags) const;
233 struct CYClassStatement :
237 CYClassStatement(CYClassName *name, CYExpression *super, CYProtocol *protocols, CYField *fields, CYMessage *messages) :
238 CYClass(name, super, protocols, fields, messages)
242 virtual CYStatement *Replace(CYContext &context);
243 virtual void Output(CYOutput &out, CYFlags flags) const;
250 CYMessage *messages_;
252 CYCategory(CYClassName *name, CYMessage *messages) :
258 virtual CYStatement *Replace(CYContext &context);
259 virtual void Output(CYOutput &out, CYFlags flags) const;
265 CYArgument *arguments_;
267 CYSend(CYArgument *arguments) :
268 arguments_(arguments)
274 virtual void Output(CYOutput &out, CYFlags flags) const;
277 struct CYSendDirect :
282 CYSendDirect(CYExpression *self, CYArgument *arguments) :
288 virtual CYExpression *Replace(CYContext &context);
289 virtual void Output(CYOutput &out, CYFlags flags) const;
295 CYSendSuper(CYArgument *arguments) :
300 virtual CYExpression *Replace(CYContext &context);
301 virtual void Output(CYOutput &out, CYFlags flags) const;
304 #endif/*CYCRIPT_OBJECTIVEC_SYNTAX_HPP*/