/*
 * Copyright (c) 2013-2014, nwillc@gmail.com
 *
 * Permission to use, copy, modify, and/or distribute this software for any purpose with or
 * without fee is hereby granted, provided that the above copyright notice and this permission
 * notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO
 * THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT
 * SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR
 * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
 * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
 * OR PERFORMANCE OF THIS SOFTWARE.
 */

package scotty.template.operator;

import scotty.database.Context;
import scotty.database.Database;
import scotty.template.Markup;
import scotty.template.ParsingContext;

import javax.script.ScriptException;
import java.io.IOException;
import java.util.logging.Logger;

public class ScriptOperator implements OperatorEvaluator {
    private static final Logger LOGGER = Logger.getLogger(ScriptOperator.class.getName());

    @Override
    public char getOperator() {
        return 0;
    }

    @Override
    public void eval(Database database, Context context, Markup markup, ParsingContext parsingContext) throws IOException, ScriptException {
        try {
            parsingContext.eval(markup.body);
        } catch (ScriptException scriptException) {
            LOGGER.severe(scriptException.getFileName() + ": [" + scriptException.getLineNumber() + "] " + scriptException.getMessage());
            throw scriptException;
        }
    }
}

@@ -1254,16 +1254,65 @@
     
-return 0
+throw new NoSuchMethodError(%22Scripts have no operations%22)
 ;%0A  

Refactor parser switch into operation functions