]> git.saurik.com Git - cycript.git/blob - Driver.cpp
Support Infinity (syntax highlighting and output).
[cycript.git] / Driver.cpp
1 /* Cycript - Optimizing JavaScript Compiler/Runtime
2 * Copyright (C) 2009-2015 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::istream &data, const std::string &filename) :
28 pool_(pool),
29 newline_(false),
30 last_(false),
31 next_(false),
32 data_(data),
33 debug_(0),
34 strict_(false),
35 highlight_(false),
36 filename_(filename),
37 script_(NULL),
38 auto_(false),
39 context_(NULL),
40 mode_(AutoNone)
41 {
42 in_.push(false);
43 return_.push(false);
44 super_.push(false);
45 template_.push(false);
46 yield_.push(false);
47
48 ScannerInit();
49 }
50
51 CYDriver::~CYDriver() {
52 ScannerDestroy();
53 }
54
55 void CYDriver::Replace(CYOptions &options) {
56 CYLocal<CYPool> local(&pool_);
57 CYContext context(options);
58 script_->Replace(context);
59 }