]> git.saurik.com Git - cycript.git/blame - ObjectiveC.hpp
Forgot the new .mk files in previous commit.
[cycript.git] / ObjectiveC.hpp
CommitLineData
4de0686f
JF
1#ifndef CYCRIPT_OBJECTIVEC_HPP
2#define CYCRIPT_OBJECTIVEC_HPP
3
4#include "Parser.hpp"
5
6struct CYSelectorPart :
7 CYNext<CYSelectorPart>,
8 CYThing
9{
10 CYWord *name_;
11 bool value_;
12
13 CYSelectorPart(CYWord *name, bool value, CYSelectorPart *next) :
14 CYNext<CYSelectorPart>(next),
15 name_(name),
16 value_(value)
17 {
18 }
19
20 CYString *Replace(CYContext &context);
21 virtual void Output(CYOutput &out) const;
22};
23
24struct CYSelector :
25 CYLiteral
26{
27 CYSelectorPart *name_;
28
29 CYSelector(CYSelectorPart *name) :
30 name_(name)
31 {
32 }
33
34 CYPrecedence(1)
35
36 virtual CYExpression *Replace(CYContext &context);
37 virtual void Output(CYOutput &out, CYFlags flags) const;
38};
39
40struct CYField :
41 CYNext<CYField>
42{
43 CYStatement *Replace(CYContext &context) const;
44 void Output(CYOutput &out) const;
45};
46
47struct CYMessageParameter :
48 CYNext<CYMessageParameter>
49{
50 CYWord *tag_;
51 CYExpression *type_;
52 CYIdentifier *name_;
53
54 CYMessageParameter(CYWord *tag, CYExpression *type, CYIdentifier *name) :
55 tag_(tag),
56 type_(type),
57 name_(name)
58 {
59 }
60
61 CYFunctionParameter *Parameters(CYContext &context) const;
62 CYSelector *Selector(CYContext &context) const;
63 CYSelectorPart *SelectorPart(CYContext &context) const;
64};
65
66struct CYMessage :
67 CYNext<CYMessage>
68{
69 bool instance_;
70 CYExpression *type_;
71 CYMessageParameter *parameters_;
72 CYStatement *statements_;
73
74 CYMessage(bool instance, CYExpression *type, CYMessageParameter *parameter, CYStatement *statements) :
75 instance_(instance),
76 type_(type),
77 parameters_(parameter),
78 statements_(statements)
79 {
80 }
81
82 CYStatement *Replace(CYContext &context, bool replace) const;
83 void Output(CYOutput &out, bool replace) const;
84};
85
86struct CYClass {
87 CYClassName *name_;
88 CYExpression *super_;
89 CYField *fields_;
90 CYMessage *messages_;
91
92 CYClass(CYClassName *name, CYExpression *super, CYField *fields, CYMessage *messages) :
93 name_(name),
94 super_(super),
95 fields_(fields),
96 messages_(messages)
97 {
98 }
99
100 CYExpression *Replace_(CYContext &context);
101 virtual void Output(CYOutput &out, CYFlags flags) const;
102};
103
104struct CYClassExpression :
105 CYClass,
106 CYExpression
107{
108 CYClassExpression(CYClassName *name, CYExpression *super, CYField *fields, CYMessage *messages) :
109 CYClass(name, super, fields, messages)
110 {
111 }
112
113 CYPrecedence(0)
114
115 virtual CYExpression *Replace(CYContext &context);
116 virtual void Output(CYOutput &out, CYFlags flags) const;
117};
118
119struct CYClassStatement :
120 CYClass,
121 CYStatement
122{
123 CYClassStatement(CYClassName *name, CYExpression *super, CYField *fields, CYMessage *messages) :
124 CYClass(name, super, fields, messages)
125 {
126 }
127
128 virtual CYStatement *Replace(CYContext &context);
129 virtual void Output(CYOutput &out, CYFlags flags) const;
130};
131
132struct CYCategory :
133 CYStatement
134{
135 CYClassName *name_;
136 CYMessage *messages_;
137
138 CYCategory(CYClassName *name, CYMessage *messages) :
139 name_(name),
140 messages_(messages)
141 {
142 }
143
144 virtual CYStatement *Replace(CYContext &context);
145 virtual void Output(CYOutput &out, CYFlags flags) const;
146};
147
148struct CYSend :
149 CYExpression
150{
151 CYExpression *self_;
152 CYArgument *arguments_;
153
154 CYSend(CYExpression *self, CYArgument *arguments) :
155 self_(self),
156 arguments_(arguments)
157 {
158 }
159
160 CYPrecedence(0)
161
162 virtual CYExpression *Replace(CYContext &context);
163 virtual void Output(CYOutput &out, CYFlags flags) const;
164};
165
166#endif/*CYCRIPT_OBJECTIVEC_HPP*/