package me.hammerle.snuviscript.code; import java.io.Closeable; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Stack; import java.util.function.Consumer; import me.hammerle.snuviscript.variable.LocalVariable; import me.hammerle.snuviscript.variable.Variable; public final class Script { protected final String simpleName; protected final String name; protected final int id; protected SnuviParser parser; protected ISnuviLogger logger; protected ISnuviScheduler scheduler; protected int currentLine; protected Instruction[] code; // waiting scripts stop executing and run again on an event protected boolean isWaiting; // holded scripts do not receive events protected boolean isHolded; // not valid means the script is waiting for its termination protected boolean isValid; // states if event broadcasts should be received, otherwise only direct event calls work protected boolean receiveEventBroadcast; // stores the used cpuTime, schedules the script if too high protected long cpuTime; protected int catchLine; protected String currentCommand; protected boolean ifState; private final HashMap labels; protected final Stack returnStack; protected HashMap vars; protected final HashSet events; // local function stuff protected final Stack> localVars; protected final HashMap functions; protected final HashMap> localLabels; protected String currentFunction = null; protected Object returnValue; protected boolean printStackTrace; private final Consumer