X-Git-Url: https://git.saurik.com/cycript.git/blobdiff_plain/b12a99658d0a609d28ff522b82be8826928107cf..f57a1abfff018977638649483e0bf259c830daf2:/Driver.hpp?ds=sidebyside diff --git a/Driver.hpp b/Driver.hpp index 3948274..a653d0a 100644 --- a/Driver.hpp +++ b/Driver.hpp @@ -1,21 +1,21 @@ -/* Cycript - Optimizing JavaScript Compiler/Runtime - * Copyright (C) 2009-2013 Jay Freeman (saurik) +/* Cycript - The Truly Universal Scripting Language + * Copyright (C) 2009-2016 Jay Freeman (saurik) */ -/* GNU General Public License, Version 3 {{{ */ +/* GNU Affero General Public License, Version 3 {{{ */ /* - * Cycript is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published - * by the Free Software Foundation, either version 3 of the License, - * or (at your option) any later version. - * - * Cycript is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Cycript. If not, see . + * GNU Affero General Public License for more details. + + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . **/ /* }}} */ @@ -28,36 +28,49 @@ #include #include -#include "location.hh" +#include "Location.hpp" +#include "Options.hpp" +#include "Pooling.hpp" +#include "Standard.hpp" -#include "Parser.hpp" +struct CYClassTail; +struct CYExpression; +struct CYScript; +struct CYWord; -enum CYState { - CYClear, - CYRestricted, - CYNewLine +enum CYMark { + CYMarkScript, + CYMarkModule, }; -class CYDriver { +class _visible CYDriver { public: + CYPool &pool_; void *scanner_; - CYState state_; + std::vector buffer_; + bool tail_; + std::stack in_; + std::stack return_; + std::stack super_; + std::stack template_; + std::stack yield_; - struct { - bool AtImplementation; - bool Function; - bool OpenBrace; - } no_; + std::stack class_; - std::istream &data_; + CYMark mark_; + int hold_; + bool newline_; + bool last_; + std::streambuf &data_; + + int debug_; bool strict_; - bool commented_; + bool highlight_; enum Condition { - RegExpCondition, XMLContentCondition, XMLTagCondition, }; @@ -66,13 +79,13 @@ class CYDriver { struct Error { bool warning_; - cy::location location_; + CYLocation location_; std::string message_; }; typedef std::vector Errors; - CYProgram *program_; + CYScript *script_; Errors errors_; bool auto_; @@ -99,7 +112,8 @@ class CYDriver { AutoPrimary, AutoDirect, AutoIndirect, - AutoMessage + AutoMessage, + AutoResolve, } mode_; private: @@ -107,16 +121,19 @@ class CYDriver { void ScannerDestroy(); public: - CYDriver(std::istream &data, const std::string &filename = ""); + CYDriver(CYPool &pool, std::streambuf &data, const std::string &filename = ""); ~CYDriver(); - Condition GetCondition(); + bool Parse(CYMark mark = CYMarkModule); + void Replace(CYOptions &options); + + void SetRegEx(bool equal); void SetCondition(Condition condition); void PushCondition(Condition condition); void PopCondition(); - void Warning(const cy::location &location, const char *message); + void Warning(const CYLocation &location, const char *message); }; #endif/*CYCRIPT_DRIVER_HPP*/