MCPcopy Create free account
hub / github.com/AstroImageJ/astroimagej / eval

Method eval

ij/src/main/java/ij/macro/Interpreter.java:125–143  ·  view source on GitHub ↗

Evaluates 'code' and returns the output, or any error, as a String. @see ij.Macro#eval

(String code)

Source from the content-addressed store, hash-verified

123 * @see ij.Macro#eval
124 */
125 public String eval(String code) {
126 Interpreter saveInstance = instance;
127 if (pgm!=null)
128 reuseSymbolTable();
129 Tokenizer tok = new Tokenizer();
130 Program pgm = tok.tokenize(code);
131 if (pgm.hasVars && pgm.hasFunctions)
132 saveGlobals2(pgm);
133 evaluating = true;
134 evalOutput = null;
135 ignoreErrors = true;
136 calledMacro = true;
137 run(pgm);
138 instance = saveInstance;
139 if (errorMessage!=null)
140 return errorMessage;
141 else
142 return evalOutput;
143 }
144
145 private void reuseSymbolTable() {
146 if (pgm==null)

Callers

nothing calls this directly

Calls 4

reuseSymbolTableMethod · 0.95
tokenizeMethod · 0.95
saveGlobals2Method · 0.95
runMethod · 0.95

Tested by

no test coverage detected