X-Git-Url: https://git.saurik.com/cycript.git/blobdiff_plain/b3aa25d897b2ce3672a306f238c053467fb23df5..10e728bb967b8f052c07480275400d631fb6f531:/Parser.hpp diff --git a/Parser.hpp b/Parser.hpp index 0e4b51f..fa0bc09 100644 --- a/Parser.hpp +++ b/Parser.hpp @@ -1606,6 +1606,107 @@ struct CYFinally : virtual void Output(CYOutput &out) const; }; +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 { @@ -1687,19 +1788,19 @@ struct CYTypedIdentifier : CYThing { CYIdentifier *identifier_; - CYExpression *type_; + CYTypeSpecifier *specifier_; CYTypeModifier *modifier_; CYTypedIdentifier(CYIdentifier *identifier = NULL) : identifier_(identifier), - type_(NULL), + specifier_(NULL), modifier_(NULL) { } - CYTypedIdentifier(CYExpression *type, CYTypeModifier *modifier = NULL) : + CYTypedIdentifier(CYTypeSpecifier *specifier, CYTypeModifier *modifier = NULL) : identifier_(NULL), - type_(type), + specifier_(specifier), modifier_(modifier) { } @@ -2043,7 +2144,7 @@ CYPrefix_(false, "-", Negate) CYPrefix_(false, "~", BitwiseNot) CYPrefix_(false, "!", LogicalNot) -CYInfix_(false, 5, "*", Multiply) +CYInfix_(false, 5, "*", Multiply, CYReplace) CYInfix_(false, 5, "/", Divide) CYInfix_(false, 5, "%", Modulus) CYInfix_(false, 6, "+", Add, CYReplace)