1 /* Cycript - Optimizing JavaScript Compiler/Runtime
2 * Copyright (C) 2009-2012 Jay Freeman (saurik)
5 /* GNU Lesser General Public License, Version 3 {{{ */
7 * Cycript is free software: you can redistribute it and/or modify it under
8 * the terms of the GNU Lesser General Public License as published by the
9 * Free Software Foundation, either version 3 of the License, or (at your
10 * option) any later version.
12 * Cycript is distributed in the hope that it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
15 * License for more details.
17 * You should have received a copy of the GNU Lesser 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
32 CYBox(CYExpression *value) :
39 virtual CYExpression *Replace(CYContext &context);
40 virtual void Output(CYOutput &out, CYFlags flags) const;
43 struct CYSelectorPart :
44 CYNext<CYSelectorPart>,
50 CYSelectorPart(CYWord *name, bool value, CYSelectorPart *next = NULL) :
51 CYNext<CYSelectorPart>(next),
57 CYString *Replace(CYContext &context);
58 virtual void Output(CYOutput &out) const;
64 CYSelectorPart *name_;
66 CYSelector(CYSelectorPart *name) :
73 virtual CYExpression *Replace(CYContext &context);
74 virtual void Output(CYOutput &out, CYFlags flags) const;
83 CYField(CYExpression *type, CYIdentifier *name, CYField *next = NULL) :
84 CYNext<CYField>(next),
90 CYStatement *Replace(CYContext &context) const;
91 void Output(CYOutput &out) const;
94 struct CYMessageParameter :
95 CYNext<CYMessageParameter>
101 CYMessageParameter(CYWord *tag, CYExpression *type, CYIdentifier *name) :
108 CYFunctionParameter *Parameters(CYContext &context) const;
109 CYSelector *Selector(CYContext &context) const;
110 CYSelectorPart *SelectorPart(CYContext &context) const;
111 CYExpression *TypeSignature(CYContext &context) const;
119 CYMessageParameter *parameters_;
122 CYMessage(bool instance, CYExpression *type, CYMessageParameter *parameter, CYStatement *statements) :
125 parameters_(parameter),
130 CYStatement *Replace(CYContext &context, bool replace) const;
131 void Output(CYOutput &out, bool replace) const;
133 CYExpression *TypeSignature(CYContext &context) const;
142 CYProtocol(CYExpression *name, CYProtocol *next = NULL) :
143 CYNext<CYProtocol>(next),
148 CYStatement *Replace(CYContext &context) const;
149 void Output(CYOutput &out) const;
155 virtual CYStatement *Replace(CYContext &context);
156 virtual void Output(CYOutput &out, CYFlags flags) const;
161 CYExpression *super_;
162 CYProtocol *protocols_;
164 CYMessage *messages_;
166 CYClass(CYClassName *name, CYExpression *super, CYProtocol *protocols, CYField *fields, CYMessage *messages) :
169 protocols_(protocols),
178 CYExpression *Replace_(CYContext &context);
179 virtual void Output(CYOutput &out, CYFlags flags) const;
182 struct CYClassExpression :
186 CYClassExpression(CYClassName *name, CYExpression *super, CYProtocol *protocols, CYField *fields, CYMessage *messages) :
187 CYClass(name, super, protocols, fields, messages)
193 virtual CYExpression *Replace(CYContext &context);
194 virtual void Output(CYOutput &out, CYFlags flags) const;
197 struct CYClassStatement :
201 CYClassStatement(CYClassName *name, CYExpression *super, CYProtocol *protocols, CYField *fields, CYMessage *messages) :
202 CYClass(name, super, protocols, fields, messages)
206 virtual CYStatement *Replace(CYContext &context);
207 virtual void Output(CYOutput &out, CYFlags flags) const;
214 CYMessage *messages_;
216 CYCategory(CYClassName *name, CYMessage *messages) :
222 virtual CYStatement *Replace(CYContext &context);
223 virtual void Output(CYOutput &out, CYFlags flags) const;
229 CYArgument *arguments_;
231 CYSend(CYArgument *arguments) :
232 arguments_(arguments)
238 virtual void Output(CYOutput &out, CYFlags flags) const;
241 struct CYSendDirect :
246 CYSendDirect(CYExpression *self, CYArgument *arguments) :
252 virtual CYExpression *Replace(CYContext &context);
253 virtual void Output(CYOutput &out, CYFlags flags) const;
259 CYSendSuper(CYArgument *arguments) :
264 virtual CYExpression *Replace(CYContext &context);
265 virtual void Output(CYOutput &out, CYFlags flags) const;
268 #endif/*CYCRIPT_OBJECTIVEC_SYNTAX_HPP*/