X-Git-Url: https://git.saurik.com/cycript.git/blobdiff_plain/359e8b829aeee532360ef95d60fe4a242e7e7128..9777bd50251d7e72c44bfbee7fbad2d8df148e47:/Parser.hpp diff --git a/Parser.hpp b/Parser.hpp index 0b9099a..aad1d47 100644 --- a/Parser.hpp +++ b/Parser.hpp @@ -19,8 +19,8 @@ **/ /* }}} */ -#ifndef CYPARSER_HPP -#define CYPARSER_HPP +#ifndef CYCRIPT_PARSER_HPP +#define CYCRIPT_PARSER_HPP #include @@ -33,45 +33,13 @@ #include #include "location.hh" + +#include "List.hpp" #include "Pooling.hpp" #include "Options.hpp" class CYContext; -template -struct CYNext { - Type_ *next_; - - CYNext() : - next_(NULL) - { - } - - CYNext(Type_ *next) : - next_(next) - { - } - - void SetNext(Type_ *next) { - next_ = next; - } -}; - -template -void CYSetLast(Type_ *&list, Type_ *item) { - if (list == NULL) - list = item; - else { - Type_ *next(list); - while (next->next_ != NULL) - next = next->next_; - next->next_ = item; - } -} - -#define CYForEach(value, list) \ - for (__typeof__(*list) *value(list); value != NULL; value = value->next_) - struct CYThing { virtual ~CYThing() { } @@ -386,7 +354,7 @@ struct CYContext { void ReplaceAll(Type_ *&values) { Type_ **last(&values); CYForEach (next, values) { - Replace(*last); + Replace(*last = next); last = &(*last)->next_; } } @@ -1873,4 +1841,4 @@ CYAssignment_("&=", BitwiseAnd) CYAssignment_("^=", BitwiseXOr) CYAssignment_("|=", BitwiseOr) -#endif/*CYPARSER_HPP*/ +#endif/*CYCRIPT_PARSER_HPP*/