]> git.saurik.com Git - cycript.git/blobdiff - ObjectiveC/Syntax.hpp
Maintain a logical setup for const on sig::String.
[cycript.git] / ObjectiveC / Syntax.hpp
index 16927ac34ca314c03e149375785cb19c7a70104d..d185f0db492146f03b874b4e5176e88d9035a5b0 100644 (file)
@@ -1,5 +1,5 @@
-/* Cycript - Optimizing JavaScript Compiler/Runtime
- * Copyright (C) 2009-2015  Jay Freeman (saurik)
+/* Cycript - The Truly Universal Scripting Language
+ * Copyright (C) 2009-2016  Jay Freeman (saurik)
 */
 
 /* GNU Affero General Public License, Version 3 {{{ */
@@ -43,11 +43,11 @@ struct CYInstanceLiteral :
 struct CYObjCBlock :
     CYTarget
 {
-    CYTypedIdentifier *typed_;
+    CYType *typed_;
     CYTypedParameter *parameters_;
     CYStatement *code_;
 
-    CYObjCBlock(CYTypedIdentifier *typed, CYTypedParameter *parameters, CYStatement *code) :
+    CYObjCBlock(CYType *typed, CYTypedParameter *parameters, CYStatement *code) :
         typed_(typed),
         parameters_(parameters),
         code_(code)
@@ -76,6 +76,52 @@ struct CYBox :
     virtual void Output(CYOutput &out, CYFlags flags) const;
 };
 
+struct CYObjCArray :
+    CYTarget
+{
+    CYElement *elements_;
+
+    CYObjCArray(CYElement *elements = NULL) :
+        elements_(elements)
+    {
+    }
+
+    CYPrecedence(0)
+
+    virtual CYTarget *Replace(CYContext &context);
+    virtual void Output(CYOutput &out, CYFlags flags) const;
+};
+
+struct CYObjCKeyValue :
+    CYNext<CYObjCKeyValue>
+{
+    CYExpression *key_;
+    CYExpression *value_;
+
+    CYObjCKeyValue(CYExpression *key, CYExpression *value, CYObjCKeyValue *next) :
+        CYNext<CYObjCKeyValue>(next),
+        key_(key),
+        value_(value)
+    {
+    }
+};
+
+struct CYObjCDictionary :
+    CYTarget
+{
+    CYObjCKeyValue *pairs_;
+
+    CYObjCDictionary(CYObjCKeyValue *pairs) :
+        pairs_(pairs)
+    {
+    }
+
+    CYPrecedence(0)
+
+    virtual CYTarget *Replace(CYContext &context);
+    virtual void Output(CYOutput &out, CYFlags flags) const;
+};
+
 struct CYSelectorPart :
     CYNext<CYSelectorPart>,
     CYThing
@@ -113,11 +159,13 @@ struct CYSelector :
 struct CYImplementationField :
     CYNext<CYImplementationField>
 {
-    CYTypedIdentifier *typed_;
+    CYType *type_;
+    CYPropertyName *name_;
 
-    CYImplementationField(CYTypedIdentifier *typed, CYImplementationField *next = NULL) :
+    CYImplementationField(CYType *type, CYPropertyName *name, CYImplementationField *next = NULL) :
         CYNext<CYImplementationField>(next),
-        typed_(typed)
+        type_(type),
+        name_(name)
     {
     }
 
@@ -129,11 +177,14 @@ struct CYMessageParameter :
     CYNext<CYMessageParameter>
 {
     CYWord *name_;
-    CYTypedIdentifier *type_;
+    CYType *type_;
+    CYIdentifier *identifier_;
 
-    CYMessageParameter(CYWord *name, CYTypedIdentifier *type) :
+    CYMessageParameter(CYWord *name, CYType *type = NULL, CYIdentifier *identifier = NULL, CYMessageParameter *next = NULL) :
+        CYNext<CYMessageParameter>(next),
         name_(name),
-        type_(type)
+        type_(type),
+        identifier_(identifier)
     {
     }
 
@@ -147,11 +198,11 @@ struct CYMessage :
     CYNext<CYMessage>
 {
     bool instance_;
-    CYTypedIdentifier *type_;
+    CYType *type_;
     CYMessageParameter *parameters_;
     CYBlock code_;
 
-    CYMessage(bool instance, CYTypedIdentifier *type, CYMessageParameter *parameters, CYStatement *code) :
+    CYMessage(bool instance, CYType *type, CYMessageParameter *parameters, CYStatement *code) :
         instance_(instance),
         type_(type),
         parameters_(parameters),