]> git.saurik.com Git - cycript.git/blobdiff - Driver.hpp
Transform ECMAScript 6 import as CommonJS require.
[cycript.git] / Driver.hpp
index 5c330e794250de64a04aa64ea25eadb48f120252..adb03f20f612c9e864e3a677fbb9d78fed1ac4c2 100644 (file)
 #include <vector>
 
 #include "Location.hpp"
-#include "Parser.hpp"
-
-enum CYState {
-    CYClear,
-    CYRestricted,
-    CYNewLine
+#include "Options.hpp"
+#include "Pooling.hpp"
+#include "Standard.hpp"
+
+struct CYClassTail;
+struct CYExpression;
+struct CYScript;
+struct CYWord;
+
+enum CYMark {
+    CYMarkScript,
+    CYMarkModule,
 };
 
-class CYDriver {
+class _visible CYDriver {
   public:
+    CYPool &pool_;
     void *scanner_;
 
-    CYState state_;
+    std::vector<char> buffer_;
+    bool tail_;
+
     std::stack<bool> in_;
+    std::stack<bool> return_;
+    std::stack<bool> super_;
+    std::stack<bool> template_;
+    std::stack<bool> yield_;
 
-    struct {
-        bool AtImplementation;
-        bool Function;
-        bool OpenBrace;
-    } no_;
+    std::stack<CYClassTail *> 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,
     };
@@ -71,7 +85,7 @@ class CYDriver {
 
     typedef std::vector<Error> Errors;
 
-    CYProgram *program_;
+    CYScript *script_;
     Errors errors_;
 
     bool auto_;
@@ -106,10 +120,13 @@ 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);