X-Git-Url: https://git.saurik.com/cycript.git/blobdiff_plain/3fe283c53edc2a98d0164d893a4a667245da8e78..f6fa3c2112ee8b0aa26ab0765674601a9800db77:/Parser.hpp diff --git a/Parser.hpp b/Parser.hpp index d9530df..fab18af 100644 --- a/Parser.hpp +++ b/Parser.hpp @@ -460,27 +460,6 @@ struct CYBlock : virtual void Output(CYOutput &out, CYFlags flags) const; }; -class CYStream : - public std::istream -{ - private: - class CYBuffer : - public std::streambuf - { - public: - CYBuffer(const char *start, const char *end) { - setg(const_cast(start), const_cast(start), const_cast(end)); - } - } buffer_; - - public: - CYStream(const char *start, const char *end) : - std::istream(&buffer_), - buffer_(start, end) - { - } -}; - struct CYForInitialiser { virtual ~CYForInitialiser() { } @@ -506,7 +485,6 @@ struct CYNumber; struct CYString; struct CYExpression : - CYNext, CYForInitialiser, CYForInInitialiser, CYClassName, @@ -534,7 +512,7 @@ struct CYExpression : virtual CYAssignment *Assignment(CYContext &context); virtual CYExpression *Primitive(CYContext &context) { - return this; + return NULL; } virtual CYNumber *Number(CYContext &context) { @@ -569,16 +547,16 @@ struct CYExpression : struct CYCompound : CYExpression { - CYExpression *expressions_; + CYExpression *expression_; + CYExpression *next_; - CYCompound(CYExpression *expressions = NULL) : - expressions_(expressions) + CYCompound(CYExpression *expression, CYExpression *next = NULL) : + expression_(expression), + next_(next) { - } - - void AddPrev(CYExpression *expression) { - CYSetLast(expression) = expressions_; - expressions_ = expression; + if (expression_ == NULL) + throw; + _assert(expression_ != NULL); } CYPrecedence(17) @@ -716,6 +694,10 @@ struct CYLiteral : { CYPrecedence(0) CYRightHand(false) + + virtual CYExpression *Primitive(CYContext &context) { + return this; + } }; struct CYTrivial : @@ -1535,7 +1517,7 @@ struct CYExpress : CYExpress(CYExpression *expression) : expression_(expression) { - if (expression == NULL) + if (expression_ == NULL) throw; } @@ -1612,6 +1594,16 @@ struct CYTypeSpecifier : virtual CYExpression *Replace(CYContext &context) = 0; }; +struct CYTypeError : + CYTypeSpecifier +{ + CYTypeError() { + } + + virtual CYExpression *Replace(CYContext &context); + virtual void Output(CYOutput &out) const; +}; + struct CYTypeVoid : CYTypeSpecifier {