X-Git-Url: https://git.saurik.com/cycript.git/blobdiff_plain/1b2613d36fe670e3976680da1767879156480475..d3b63265874c492a4128f93fe55d568ef7d7aa2c:/Parser.hpp diff --git a/Parser.hpp b/Parser.hpp index ba896b7..bff219b 100644 --- a/Parser.hpp +++ b/Parser.hpp @@ -469,6 +469,27 @@ enum CYState { CYNewLine }; +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) + { + } +}; + class CYDriver { public: void *scanner_; @@ -482,9 +503,7 @@ class CYDriver { bool OpenBrace; } no_; - const char *data_; - size_t size_; - FILE *file_; + std::istream &data_; bool strict_; @@ -539,7 +558,7 @@ class CYDriver { void ScannerDestroy(); public: - CYDriver(const std::string &filename = ""); + CYDriver(std::istream &data, const std::string &filename = ""); ~CYDriver(); Condition GetCondition();