]> git.saurik.com Git - cycript.git/blob - Parser.cpp
Forgot the new JavaScriptCore.cpp from earlier commit.
[cycript.git] / Parser.cpp
1 #include "Parser.hpp"
2 #include "Cycript.tab.hh"
3
4 CYRange DigitRange_ (0x3ff000000000000LLU, 0x000000000000000LLU); // 0-9
5 CYRange WordStartRange_(0x000001000000000LLU, 0x7fffffe87fffffeLLU); // A-Za-z_$
6 CYRange WordEndRange_ (0x3ff001000000000LLU, 0x7fffffe87fffffeLLU); // A-Za-z_$0-9
7
8 CYDriver::CYDriver(const std::string &filename) :
9 state_(CYClear),
10 data_(NULL),
11 size_(0),
12 file_(NULL),
13 strict_(false),
14 filename_(filename),
15 program_(NULL)
16 {
17 ScannerInit();
18 }
19
20 CYDriver::~CYDriver() {
21 ScannerDestroy();
22 }
23
24 void CYDriver::Warning(const cy::location &location, const char *message) {
25 if (!strict_)
26 return;
27
28 CYDriver::Error error;
29 error.warning_ = true;
30 error.location_ = location;
31 error.message_ = message;
32 errors_.push_back(error);
33 }
34
35 void cy::parser::error(const cy::parser::location_type &location, const std::string &message) {
36 CYDriver::Error error;
37 error.warning_ = false;
38 error.location_ = location;
39 error.message_ = message;
40 driver.errors_.push_back(error);
41 }