#include "cycript.hpp"
#include "Driver.hpp"
-#include "Cycript.tab.hh"
#include "Replace.hpp"
#include "String.hpp"
std::stringstream stream;
stream << '(' << code << ')';
CYDriver driver(pool, stream);
-
- cy::parser parser(driver);
- if (parser.parse() != 0 || !driver.errors_.empty())
+ if (driver.Parse() || !driver.errors_.empty())
return NULL;
CYOptions options;
driver.auto_ = true;
- cy::parser parser(driver);
- if (parser.parse() != 0 || !driver.errors_.empty())
+ if (driver.Parse() || !driver.errors_.empty())
return NULL;
if (driver.mode_ == CYDriver::AutoNone)
" var before = prefix.length;\n"
" prefix += word;\n"
" var entire = prefix.length;\n"
- " for (var name in object)\n"
- " if (name.substring(0, entire) == prefix)\n"
- " names.push(name.substr(before));\n"
+ " if (false) {\n"
+ " for (var name in object)\n"
+ " if (name.substring(0, entire) == prefix)\n"
+ " names.push(name.substr(before));\n"
+ " } else do {\n"
+ " try {\n"
+ " var local = Object.getOwnPropertyNames(object);\n"
+ " } catch (e) {\n"
+ " continue;\n"
+ " }\n"
+ " for (var name of local)\n"
+ " if (name.substring(0, entire) == prefix)\n"
+ " names.push(name.substr(before));\n"
+ " } while (object = typeof object === 'object' ? Object.getPrototypeOf(object) : object.__proto__);\n"
" return names;\n"
" }\n"
), expression, $S(begin.c_str()), $S(word))));