]> git.saurik.com Git - cycript.git/blame - Driver.cpp
Support Infinity (syntax highlighting and output).
[cycript.git] / Driver.cpp
CommitLineData
b12a9965 1/* Cycript - Optimizing JavaScript Compiler/Runtime
c1d3e52e 2 * Copyright (C) 2009-2015 Jay Freeman (saurik)
b12a9965
JF
3*/
4
f95d2598 5/* GNU Affero General Public License, Version 3 {{{ */
b12a9965 6/*
f95d2598
JF
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
b12a9965 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
f95d2598
JF
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/>.
b12a9965
JF
19**/
20/* }}} */
21
b12a9965 22#include "Driver.hpp"
20052ff7 23#include "Syntax.hpp"
8a392978
JF
24
25bool CYParser(CYPool &pool, bool debug);
b12a9965 26
2c1d569a
JF
27CYDriver::CYDriver(CYPool &pool, std::istream &data, const std::string &filename) :
28 pool_(pool),
a5662a53
JF
29 newline_(false),
30 last_(false),
442609f7 31 next_(false),
b12a9965 32 data_(data),
d9c91152 33 debug_(0),
b12a9965 34 strict_(false),
b900e1a4 35 highlight_(false),
b12a9965 36 filename_(filename),
a7d8b413 37 script_(NULL),
b12a9965
JF
38 auto_(false),
39 context_(NULL),
40 mode_(AutoNone)
41{
b12a9965 42 in_.push(false);
9d2b125d 43 return_.push(false);
c5b15840 44 super_.push(false);
b900e1a4 45 template_.push(false);
9d2b125d
JF
46 yield_.push(false);
47
b12a9965
JF
48 ScannerInit();
49}
50
51CYDriver::~CYDriver() {
52 ScannerDestroy();
53}
54
2c1d569a
JF
55void CYDriver::Replace(CYOptions &options) {
56 CYLocal<CYPool> local(&pool_);
d9c91152 57 CYContext context(options);
a7d8b413 58 script_->Replace(context);
d9c91152 59}