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 CYTypedIdentifier *typed_;
31 CYTypedParameter *parameters_;
32 CYStatement *statements_;
34 CYObjCBlock(CYTypedIdentifier *typed, 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;
52 CYBox(CYExpression *value) :
59 virtual CYExpression *Replace(CYContext &context);
60 virtual void Output(CYOutput &out, CYFlags flags) const;
63 struct CYSelectorPart :
64 CYNext<CYSelectorPart>,
70 CYSelectorPart(CYWord *name, bool value, CYSelectorPart *next = NULL) :
71 CYNext<CYSelectorPart>(next),
77 CYString *Replace(CYContext &context);
78 virtual void Output(CYOutput &out) const;
84 CYSelectorPart *name_;
86 CYSelector(CYSelectorPart *name) :
93 virtual CYExpression *Replace(CYContext &context);
94 virtual void Output(CYOutput &out, CYFlags flags) const;
103 CYField(CYExpression *type, CYIdentifier *name, CYField *next = NULL) :
104 CYNext<CYField>(next),
110 CYStatement *Replace(CYContext &context) const;
111 void Output(CYOutput &out) const;
114 struct CYMessageParameter :
115 CYNext<CYMessageParameter>
121 CYMessageParameter(CYWord *tag, CYExpression *type, CYIdentifier *name) :
128 CYFunctionParameter *Parameters(CYContext &context) const;
129 CYSelector *Selector(CYContext &context) const;
130 CYSelectorPart *SelectorPart(CYContext &context) const;
131 CYExpression *TypeSignature(CYContext &context) const;
139 CYMessageParameter *parameters_;
142 CYMessage(bool instance, CYExpression *type, CYMessageParameter *parameter, CYStatement *statements) :
145 parameters_(parameter),
150 CYStatement *Replace(CYContext &context, bool replace) const;
151 void Output(CYOutput &out, bool replace) const;
153 CYExpression *TypeSignature(CYContext &context) const;
162 CYProtocol(CYExpression *name, CYProtocol *next = NULL) :
163 CYNext<CYProtocol>(next),
168 CYStatement *Replace(CYContext &context) const;
169 void Output(CYOutput &out) const;
175 virtual CYStatement *Replace(CYContext &context);
176 virtual void Output(CYOutput &out, CYFlags flags) const;
181 CYExpression *super_;
182 CYProtocol *protocols_;
184 CYMessage *messages_;
186 CYClass(CYClassName *name, CYExpression *super, CYProtocol *protocols, CYField *fields, CYMessage *messages) :
189 protocols_(protocols),
198 CYExpression *Replace_(CYContext &context);
199 virtual void Output(CYOutput &out, CYFlags flags) const;
202 struct CYClassExpression :
206 CYClassExpression(CYClassName *name, CYExpression *super, CYProtocol *protocols, CYField *fields, CYMessage *messages) :
207 CYClass(name, super, protocols, fields, messages)
213 virtual CYExpression *Replace(CYContext &context);
214 virtual void Output(CYOutput &out, CYFlags flags) const;
217 struct CYClassStatement :
221 CYClassStatement(CYClassName *name, CYExpression *super, CYProtocol *protocols, CYField *fields, CYMessage *messages) :
222 CYClass(name, super, protocols, fields, messages)
226 virtual CYStatement *Replace(CYContext &context);
227 virtual void Output(CYOutput &out, CYFlags flags) const;
234 CYMessage *messages_;
236 CYCategory(CYClassName *name, CYMessage *messages) :
242 virtual CYStatement *Replace(CYContext &context);
243 virtual void Output(CYOutput &out, CYFlags flags) const;
249 CYArgument *arguments_;
251 CYSend(CYArgument *arguments) :
252 arguments_(arguments)
258 virtual void Output(CYOutput &out, CYFlags flags) const;
261 struct CYSendDirect :
266 CYSendDirect(CYExpression *self, CYArgument *arguments) :
272 virtual CYExpression *Replace(CYContext &context);
273 virtual void Output(CYOutput &out, CYFlags flags) const;
279 CYSendSuper(CYArgument *arguments) :
284 virtual CYExpression *Replace(CYContext &context);
285 virtual void Output(CYOutput &out, CYFlags flags) const;
288 #endif/*CYCRIPT_OBJECTIVEC_SYNTAX_HPP*/