public Environment(OutputStream output) { this(new CompileScope(), output); }
public Launcher(String pathToConf, String[] args) { current = this; this.args = args; this.out = System.out != null ? System.out : new ByteArrayOutputStream(); this.compileScope = new CompileScope(); this.pathToConf = pathToConf == null ? "JPHP-INF/launcher.conf" : pathToConf; }
public static Memory getValue(Debugger context, String value) { DebugTick tick = context.getRegisteredTick(); Environment environment = new Environment(new CompileScope(tick.getEnvironment().getScope())); try { return LangFunctions.eval(environment, tick.getTrace(), tick.getLocals(), "return " + value + ";"); } catch (Throwable throwable) { return null; } }
public StandaloneLoader() { config = new Properties(); scope = new CompileScope(); env = new ConcurrentEnvironment(scope, System.out); env.getDefaultBuffer().setImplicitFlush(true);
protected CompileScope newScope(){ CompileScope compileScope = new CompileScope(); compileScope.setDebugMode(true); compileScope.setLangMode(LangMode.DEFAULT); compileScope.registerExtension(new CoreExtension()); compileScope.registerExtension(new SPLExtension()); return compileScope; }
@Signature({ @Arg(value = "parent", nativeType = WrapEnvironment.class, optional = @Optional("NULL")), @Arg(value = "flags", optional = @Optional(value = "0", type = HintType.INT)) }) public Memory __construct(Environment env, Memory... args){ CompileScope scope = env.scope; int flags = args[1].toInteger(); boolean hotReload = (flags & HOT_RELOAD) == HOT_RELOAD; boolean concurrent = (flags & CONCURRENT) == CONCURRENT; if (hotReload) { scope = new CompileScope(scope); } if (args[0].isNull()) { if (concurrent) setEnvironment(new ConcurrentEnvironment(scope, env.getDefaultBuffer().getOutput())); else setEnvironment(new Environment(scope, env.getDefaultBuffer().getOutput())); } else { if (hotReload) env.exception("Environment cannot be hot-reloadable with parent"); if (concurrent) setEnvironment(new ConcurrentEnvironment(args[0].toObject(WrapEnvironment.class).getWrapEnvironment())); else setEnvironment(new Environment(args[0].toObject(WrapEnvironment.class).getWrapEnvironment())); } return Memory.NULL; }