]> git.saurik.com Git - cycript.git/blob - Driver.cpp
Move Substrate bindings from Cycript to Substrate.
[cycript.git] / Driver.cpp
1 /* Cycript - The Truly Universal Scripting Language
2 * Copyright (C) 2009-2016 Jay Freeman (saurik)
3 */
4
5 /* GNU Affero General Public License, Version 3 {{{ */
6 /*
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU Affero General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU Affero General Public License for more details.
16
17 * You should have received a copy of the GNU Affero General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 **/
20 /* }}} */
21
22 #include "Driver.hpp"
23 #include "Syntax.hpp"
24
25 bool CYParser(CYPool &pool, bool debug);
26
27 CYDriver::CYDriver(CYPool &pool, std::streambuf &data, const std::string &filename) :
28 pool_(pool),
29 newline_(false),
30 last_(false),
31 data_(data),
32 debug_(0),
33 strict_(false),
34 highlight_(false),
35 filename_(filename),
36 script_(NULL),
37 auto_(false),
38 context_(NULL),
39 mode_(AutoNone)
40 {
41 in_.push(false);
42 return_.push(false);
43 super_.push(false);
44 template_.push(false);
45 yield_.push(false);
46
47 ScannerInit();
48 }
49
50 CYDriver::~CYDriver() {
51 ScannerDestroy();
52 }
53
54 void CYDriver::Replace(CYOptions &options) {
55 CYLocal<CYPool> local(&pool_);
56 CYContext context(options);
57 script_->Replace(context);
58 }