Index: gnu/expr/Interpreter.java =================================================================== RCS file: /cvs/kawa/kawa/gnu/expr/Interpreter.java,v retrieving revision 1.23 diff -u -r1.23 Interpreter.java --- Interpreter.java 2001/10/06 04:05:20 1.23 +++ Interpreter.java 2002/01/16 23:26:40 @@ -38,7 +38,7 @@ * The table is searched from the beginning. */ - static String[][] languages = + public static String[][] languages = { { "scheme", ".scm", ".sc", "kawa.standard.Scheme" }, { "emacs", "elisp", "emacs-lisp", ".el", "gnu.jemacs.lang.ELisp" }, @@ -53,6 +53,21 @@ public static String[][] getLanguages() { return languages; + } + + /** Add a language to the list. + * + * @param langMapping is a language definition, the first index + * is the language name, subsequent indexes are file types that + * might cause the language to be used and the final index is the + * name of the class that implements the parser. + */ + public static void registerLanguage(String[] langMapping) + { + String[][] newLangs = new String[languages.length + 1][]; + System.arraycopy(languages, 0, newLangs, 0, languages.length); + newLangs[newLangs.length - 1] = langMapping; + languages = newLangs; } /** Look for an interpreter for a language with the given name or extension.