// Path: src/main/java/com/kcthota/JSONQuery/exceptions/MissingNodeException.java
// @SuppressWarnings("serial")
// public class MissingNodeException extends RuntimeException {
// 
// 	public MissingNodeException(String message) {
// 		super(message);
// 		
// 	}
// }


import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
import javax.script.ScriptException;
import com.fasterxml.jackson.databind.JsonNode;
import com.kcthota.JSONQuery.exceptions.MissingNodeException;
package com.kcthota.JSONQuery;




public class Eval {
	private static ScriptEngineManager manager = new ScriptEngineManager();
    private static ScriptEngine engine = manager.getEngineByName("nashorn");
    
    private static Pattern pattern = Pattern.compile("\\$\\{([^}]*)\\}");
    
	public static Object eval(JsonNode jsonNode, String expression) {
		String formattedExpression = replaceTokens(jsonNode, expression);
		Object returnVal = null;
// Path: src/main/java/com/kcthota/JSONQuery/exceptions/MissingNodeException.java
// @SuppressWarnings("serial")
// public class MissingNodeException extends RuntimeException {
// 
// 	public MissingNodeException(String message) {
// 		super(message);
// 		
// 	}
// }


// Path: src/main/java/com/kcthota/JSONQuery/Eval.java
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
import javax.script.ScriptException;
import com.fasterxml.jackson.databind.JsonNode;
import com.kcthota.JSONQuery.exceptions.MissingNodeException;

package com.kcthota.JSONQuery;




public class Eval {
	private static ScriptEngineManager manager = new ScriptEngineManager();
    private static ScriptEngine engine = manager.getEngineByName("nashorn");
    
    private static Pattern pattern = Pattern.compile("\\$\\{([^}]*)\\}");
    
	public static Object eval(JsonNode jsonNode, String expression) {
		String formattedExpression = replaceTokens(jsonNode, expression);
		Object returnVal = null;
		try {