1 /* Cycript - Optimizing JavaScript Compiler/Runtime
2 * Copyright (C) 2009-2010 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;
80 CYStatement *Replace(CYContext &context) const;
81 void Output(CYOutput &out) const;
84 struct CYMessageParameter :
85 CYNext<CYMessageParameter>
91 CYMessageParameter(CYWord *tag, CYExpression *type, CYIdentifier *name) :
98 CYFunctionParameter *Parameters(CYContext &context) const;
99 CYSelector *Selector(CYContext &context) const;
100 CYSelectorPart *SelectorPart(CYContext &context) const;
108 CYMessageParameter *parameters_;
111 CYMessage(bool instance, CYExpression *type, CYMessageParameter *parameter, CYStatement *statements) :
114 parameters_(parameter),
119 CYStatement *Replace(CYContext &context, bool replace) const;
120 void Output(CYOutput &out, bool replace) const;
129 CYProtocol(CYExpression *name, CYProtocol *next = NULL) :
130 CYNext<CYProtocol>(next),
135 CYStatement *Replace(CYContext &context) const;
136 void Output(CYOutput &out) const;
142 virtual CYStatement *Replace(CYContext &context);
143 virtual void Output(CYOutput &out, CYFlags flags) const;
148 CYExpression *super_;
149 CYProtocol *protocols_;
151 CYMessage *messages_;
153 CYClass(CYClassName *name, CYExpression *super, CYProtocol *protocols, CYField *fields, CYMessage *messages) :
156 protocols_(protocols),
165 CYExpression *Replace_(CYContext &context);
166 virtual void Output(CYOutput &out, CYFlags flags) const;
169 struct CYClassExpression :
173 CYClassExpression(CYClassName *name, CYExpression *super, CYProtocol *protocols, CYField *fields, CYMessage *messages) :
174 CYClass(name, super, protocols, fields, messages)
180 virtual CYExpression *Replace(CYContext &context);
181 virtual void Output(CYOutput &out, CYFlags flags) const;
184 struct CYClassStatement :
188 CYClassStatement(CYClassName *name, CYExpression *super, CYProtocol *protocols, CYField *fields, CYMessage *messages) :
189 CYClass(name, super, protocols, fields, messages)
193 virtual CYStatement *Replace(CYContext &context);
194 virtual void Output(CYOutput &out, CYFlags flags) const;
201 CYMessage *messages_;
203 CYCategory(CYClassName *name, CYMessage *messages) :
209 virtual CYStatement *Replace(CYContext &context);
210 virtual void Output(CYOutput &out, CYFlags flags) const;
216 CYArgument *arguments_;
218 CYSend(CYArgument *arguments) :
219 arguments_(arguments)
225 virtual void Output(CYOutput &out, CYFlags flags) const;
228 struct CYSendDirect :
233 CYSendDirect(CYExpression *self, CYArgument *arguments) :
239 virtual CYExpression *Replace(CYContext &context);
240 virtual void Output(CYOutput &out, CYFlags flags) const;
246 CYSendSuper(CYArgument *arguments) :
251 virtual CYExpression *Replace(CYContext &context);
252 virtual void Output(CYOutput &out, CYFlags flags) const;
255 #endif/*CYCRIPT_OBJECTIVEC_SYNTAX_HPP*/