+struct CYTypeSpecifier :
+ CYThing
+{
+ virtual CYExpression *Replace(CYContext &context) = 0;
+};
+
+struct CYTypeError :
+ CYTypeSpecifier
+{
+ CYTypeError() {
+ }
+
+ virtual CYExpression *Replace(CYContext &context);
+ virtual void Output(CYOutput &out) const;
+};
+
+struct CYTypeVoid :
+ CYTypeSpecifier
+{
+ CYTypeVoid() {
+ }
+
+ virtual CYExpression *Replace(CYContext &context);
+ virtual void Output(CYOutput &out) const;
+};
+
+struct CYTypeVariable :
+ CYTypeSpecifier
+{
+ CYIdentifier *name_;
+
+ CYTypeVariable(CYIdentifier *name) :
+ name_(name)
+ {
+ }
+
+ CYTypeVariable(const char *name) :
+ name_(new($pool) CYIdentifier(name))
+ {
+ }
+
+ virtual CYExpression *Replace(CYContext &context);
+ virtual void Output(CYOutput &out) const;
+};
+
+struct CYTypeUnsigned :
+ CYTypeSpecifier
+{
+ CYTypeSpecifier *specifier_;
+
+ CYTypeUnsigned(CYTypeSpecifier *specifier) :
+ specifier_(specifier)
+ {
+ }
+
+ virtual CYExpression *Replace(CYContext &context);
+ virtual void Output(CYOutput &out) const;
+};
+
+struct CYTypeSigned :
+ CYTypeSpecifier
+{
+ CYTypeSpecifier *specifier_;
+
+ CYTypeSigned(CYTypeSpecifier *specifier) :
+ specifier_(specifier)
+ {
+ }
+
+ virtual CYExpression *Replace(CYContext &context);
+ virtual void Output(CYOutput &out) const;
+};
+
+struct CYTypeLong :
+ CYTypeSpecifier
+{
+ CYTypeSpecifier *specifier_;
+
+ CYTypeLong(CYTypeSpecifier *specifier) :
+ specifier_(specifier)
+ {
+ }
+
+ virtual CYExpression *Replace(CYContext &context);
+ virtual void Output(CYOutput &out) const;
+};
+
+struct CYTypeShort :
+ CYTypeSpecifier
+{
+ CYTypeSpecifier *specifier_;
+
+ CYTypeShort(CYTypeSpecifier *specifier) :
+ specifier_(specifier)
+ {
+ }
+
+ virtual CYExpression *Replace(CYContext &context);
+ virtual void Output(CYOutput &out) const;
+};
+
+struct CYTypeModifier :
+ CYNext<CYTypeModifier>
+{
+ CYTypeModifier(CYTypeModifier *next) :
+ CYNext<CYTypeModifier>(next)
+ {
+ }
+
+ virtual int Precedence() const = 0;
+
+ virtual CYExpression *Replace_(CYContext &context, CYExpression *type) = 0;
+ CYExpression *Replace(CYContext &context, CYExpression *type);
+
+ virtual void Output(CYOutput &out, CYIdentifier *identifier) const = 0;
+ void Output(CYOutput &out, int precedence, CYIdentifier *identifier) const;
+};
+
+struct CYTypeArrayOf :
+ CYTypeModifier
+{
+ CYExpression *size_;
+
+ CYTypeArrayOf(CYExpression *size, CYTypeModifier *next = NULL) :
+ CYTypeModifier(next),
+ size_(size)
+ {
+ }
+
+ CYPrecedence(1)
+
+ virtual CYExpression *Replace_(CYContext &context, CYExpression *type);
+ virtual void Output(CYOutput &out, CYIdentifier *identifier) const;
+};
+
+struct CYTypeConstant :
+ CYTypeModifier
+{
+ CYTypeConstant(CYTypeModifier *next = NULL) :
+ CYTypeModifier(next)
+ {
+ }
+
+ CYPrecedence(0)
+
+ virtual CYExpression *Replace_(CYContext &context, CYExpression *type);
+ virtual void Output(CYOutput &out, CYIdentifier *identifier) const;
+};
+
+struct CYTypePointerTo :
+ CYTypeModifier
+{
+ CYTypePointerTo(CYTypeModifier *next = NULL) :
+ CYTypeModifier(next)
+ {
+ }
+
+ CYPrecedence(0)
+
+ virtual CYExpression *Replace_(CYContext &context, CYExpression *type);
+ virtual void Output(CYOutput &out, CYIdentifier *identifier) const;
+};
+
+struct CYTypeVolatile :
+ CYTypeModifier
+{
+ CYTypeVolatile(CYTypeModifier *next = NULL) :
+ CYTypeModifier(next)
+ {
+ }
+
+ CYPrecedence(0)
+
+ virtual CYExpression *Replace_(CYContext &context, CYExpression *type);
+ virtual void Output(CYOutput &out, CYIdentifier *identifier) const;
+};
+
+struct CYTypedIdentifier :
+ CYNext<CYTypedIdentifier>,
+ CYThing
+{
+ CYIdentifier *identifier_;
+ CYTypeSpecifier *specifier_;
+ CYTypeModifier *modifier_;
+
+ CYTypedIdentifier(CYIdentifier *identifier = NULL) :
+ identifier_(identifier),
+ specifier_(NULL),
+ modifier_(NULL)
+ {
+ }
+
+ CYTypedIdentifier(CYTypeSpecifier *specifier, CYTypeModifier *modifier = NULL) :
+ identifier_(NULL),
+ specifier_(specifier),
+ modifier_(modifier)
+ {
+ }
+
+ inline CYTypedIdentifier *Modify(CYTypeModifier *modifier) {
+ CYSetLast(modifier_) = modifier;
+ return this;
+ }
+
+ virtual CYExpression *Replace(CYContext &context);
+ virtual void Output(CYOutput &out) const;
+};
+
+struct CYEncodedType :
+ CYExpression
+{
+ CYTypedIdentifier *typed_;
+
+ CYEncodedType(CYTypedIdentifier *typed) :
+ typed_(typed)
+ {
+ }
+
+ CYPrecedence(1)
+
+ virtual CYExpression *Replace(CYContext &context);
+ virtual void Output(CYOutput &out, CYFlags flags) const;
+};
+
+struct CYTypedParameter :
+ CYNext<CYTypedParameter>,
+ CYThing
+{
+ CYTypedIdentifier *typed_;
+
+ CYTypedParameter(CYTypedIdentifier *typed, CYTypedParameter *next) :
+ CYNext<CYTypedParameter>(next),
+ typed_(typed)
+ {
+ }
+
+ CYArgument *Argument(CYContext &context);
+ CYFunctionParameter *Parameters(CYContext &context);
+ CYExpression *TypeSignature(CYContext &context, CYExpression *prefix);
+
+ virtual void Output(CYOutput &out) const;
+};
+
+struct CYLambda :
+ CYExpression
+{
+ CYTypedIdentifier *typed_;
+ CYTypedParameter *parameters_;
+ CYStatement *statements_;
+
+ CYLambda(CYTypedIdentifier *typed, CYTypedParameter *parameters, CYStatement *statements) :
+ typed_(typed),
+ parameters_(parameters),
+ statements_(statements)
+ {
+ }
+
+ CYPrecedence(1)
+
+ virtual CYExpression *Replace(CYContext &context);
+ virtual void Output(CYOutput &out, CYFlags flags) const;
+};
+
+struct CYModule :
+ CYNext<CYModule>,
+ CYThing
+{
+ CYWord *part_;
+
+ CYModule(CYWord *part, CYModule *next = NULL) :
+ CYNext<CYModule>(next),
+ part_(part)
+ {
+ }
+
+ CYString *Replace(CYContext &context, const char *separator) const;
+ void Output(CYOutput &out) const;
+};
+
+struct CYImport :
+ CYStatement
+{
+ CYModule *module_;
+
+ CYImport(CYModule *module) :
+ module_(module)
+ {
+ }
+
+ virtual CYStatement *Replace(CYContext &context);
+ virtual void Output(CYOutput &out, CYFlags flags) const;
+};
+
+struct CYTypeDefinition :
+ CYStatement
+{
+ CYTypedIdentifier *typed_;
+
+ CYTypeDefinition(CYTypedIdentifier *typed) :
+ typed_(typed)
+ {
+ }
+
+ virtual CYStatement *Replace(CYContext &context);
+ virtual void Output(CYOutput &out, CYFlags flags) const;
+};
+
+struct CYTypeBlockWith :
+ CYTypeModifier
+{
+ CYTypedParameter *parameters_;
+
+ CYTypeBlockWith(CYTypedParameter *parameters, CYTypeModifier *next = NULL) :
+ CYTypeModifier(next),
+ parameters_(parameters)
+ {
+ }
+
+ CYPrecedence(0)
+
+ virtual CYExpression *Replace_(CYContext &context, CYExpression *type);
+ virtual void Output(CYOutput &out, CYIdentifier *identifier) const;
+};
+
+struct CYTypeFunctionWith :
+ CYTypeModifier
+{
+ CYTypedParameter *parameters_;
+
+ CYTypeFunctionWith(CYTypedParameter *parameters, CYTypeModifier *next = NULL) :
+ CYTypeModifier(next),
+ parameters_(parameters)
+ {
+ }
+
+ CYPrecedence(1)
+
+ virtual CYExpression *Replace_(CYContext &context, CYExpression *type);
+ virtual void Output(CYOutput &out, CYIdentifier *identifier) const;
+};
+