1 /* Cycript - Optimizing JavaScript Compiler/Runtime
 
   2  * Copyright (C) 2009-2015  Jay Freeman (saurik)
 
   5 /* GNU Affero General Public License, Version 3 {{{ */
 
   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.
 
  12  * This program is distributed in the hope that it will be useful,
 
  13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
  14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
  15  * GNU Affero General Public License for more details.
 
  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/>.
 
  22 #ifndef CYCRIPT_OBJECTIVEC_SYNTAX_HPP
 
  23 #define CYCRIPT_OBJECTIVEC_SYNTAX_HPP
 
  25 #include "../Syntax.hpp"
 
  27 struct CYInstanceLiteral :
 
  32     CYInstanceLiteral(CYNumber *number) :
 
  39     virtual CYTarget *Replace(CYContext &context);
 
  40     virtual void Output(CYOutput &out, CYFlags flags) const;
 
  46     CYTypedIdentifier *typed_;
 
  47     CYTypedParameter *parameters_;
 
  50     CYObjCBlock(CYTypedIdentifier *typed, CYTypedParameter *parameters, CYStatement *code) :
 
  52         parameters_(parameters),
 
  59     virtual CYTarget *Replace(CYContext &context);
 
  60     virtual void Output(CYOutput &out, CYFlags flags) const;
 
  68     CYBox(CYExpression *value) :
 
  75     virtual CYTarget *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 *parts_;
 
 102     CYSelector(CYSelectorPart *parts) :
 
 109     virtual CYTarget *Replace(CYContext &context);
 
 110     virtual void Output(CYOutput &out, CYFlags flags) const;
 
 113 struct CYImplementationField :
 
 114     CYNext<CYImplementationField>
 
 116     CYTypedIdentifier *typed_;
 
 118     CYImplementationField(CYTypedIdentifier *typed, CYImplementationField *next = NULL) :
 
 119         CYNext<CYImplementationField>(next),
 
 124     CYStatement *Replace(CYContext &context) const;
 
 125     void Output(CYOutput &out) const;
 
 128 struct CYMessageParameter :
 
 129     CYNext<CYMessageParameter>
 
 132     CYTypedIdentifier *type_;
 
 134     CYMessageParameter(CYWord *name, CYTypedIdentifier *type) :
 
 140     CYFunctionParameter *Parameters(CYContext &context) const;
 
 141     CYSelector *Selector(CYContext &context) const;
 
 142     CYSelectorPart *SelectorPart(CYContext &context) const;
 
 143     CYExpression *TypeSignature(CYContext &context) const;
 
 150     CYTypedIdentifier *type_;
 
 151     CYMessageParameter *parameters_;
 
 154     CYMessage(bool instance, CYTypedIdentifier *type, CYMessageParameter *parameters, CYStatement *code) :
 
 157         parameters_(parameters),
 
 162     CYStatement *Replace(CYContext &context, bool replace) const;
 
 163     void Output(CYOutput &out) const;
 
 165     CYExpression *TypeSignature(CYContext &context) const;
 
 174     CYProtocol(CYExpression *name, CYProtocol *next = NULL) :
 
 175         CYNext<CYProtocol>(next),
 
 180     CYStatement *Replace(CYContext &context) const;
 
 181     void Output(CYOutput &out) const;
 
 184 struct CYImplementation :
 
 188     CYExpression *extends_;
 
 189     CYProtocol *protocols_;
 
 190     CYImplementationField *fields_;
 
 191     CYMessage *messages_;
 
 193     CYImplementation(CYIdentifier *name, CYExpression *extends, CYProtocol *protocols, CYImplementationField *fields, CYMessage *messages) :
 
 196         protocols_(protocols),
 
 204     virtual CYStatement *Replace(CYContext &context);
 
 205     virtual void Output(CYOutput &out, CYFlags flags) const;
 
 212     CYMessage *messages_;
 
 214     CYCategory(CYIdentifier *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 CYTarget *Replace(CYContext &context);
 
 253     virtual void Output(CYOutput &out, CYFlags flags) const;
 
 259     CYSendSuper(CYArgument *arguments) :
 
 264     virtual CYTarget *Replace(CYContext &context);
 
 265     virtual void Output(CYOutput &out, CYFlags flags) const;
 
 268 #endif/*CYCRIPT_OBJECTIVEC_SYNTAX_HPP*/