/* * Moonlight|3D Copyright (C) 2005 The Moonlight|3D team * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more * details. * * You should have received a copy of the GNU Lesser General Public License * along with this library; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Created on Jan 21, 2005 */ package ml.core.scripts; /** * This is the interface every script language provider has to * implement. The script manager requests script interpreter * instances through this interface exclusively. * * @author gregor */ public interface Language { /** * Return the name of the script language. This is supposed * to be a human-readable string. * * @return name of the script language */ public String getLanguageName(); /** * Create a new interpreter instance or context, depending * on how the script interpreter is designed internally. * Expected behaviour is that Interpreter instances are * isolated from each other in such a form that they * cannot influence one another accidentially. This means * for example that variable scopes are not shared between * Interpreter instances. * * @return a new Interpreter */ public Interpreter createInterpreter(); /** * Test if the file looks like a valid script for this * interpreted language. It is sufficient for the test * to look at the filename only, looking for specific * file extensions like ".py" for Python scripts. In * particular, no full syntax check should be performed * because all compiletime and runtime errors are to * be handled through the Interpreter interface. * * @param filename file name to check * @return true if the script might be written in this language */ public boolean canExecute(String filename); }