org.crsh.lang.impl.script.ScriptCompiler Maven / Gradle / Ivy
The newest version!
/*
* Copyright (C) 2012 eXo Platform SAS.
*
* This 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 software 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 software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.crsh.lang.impl.script;
import org.crsh.cli.descriptor.CommandDescriptor;
import org.crsh.cli.descriptor.Description;
import org.crsh.cli.impl.SyntaxException;
import org.crsh.cli.impl.descriptor.IntrospectionException;
import org.crsh.cli.impl.invocation.InvocationException;
import org.crsh.cli.impl.invocation.InvocationMatch;
import org.crsh.cli.spi.Completer;
import org.crsh.command.CommandContext;
import org.crsh.command.RuntimeContext;
import org.crsh.lang.spi.CommandResolution;
import org.crsh.lang.spi.Compiler;
import org.crsh.lang.spi.ReplResponse;
import org.crsh.shell.ErrorKind;
import org.crsh.shell.impl.command.ShellSession;
import org.crsh.shell.impl.command.spi.Command;
import org.crsh.shell.impl.command.spi.CommandException;
import org.crsh.shell.impl.command.spi.CommandInvoker;
import org.crsh.shell.impl.command.spi.CommandMatch;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.lang.reflect.Type;
import java.util.Collections;
import java.util.Map;
import java.util.Set;
/**
* @author Julien Viet
*/
public class ScriptCompiler implements Compiler {
/** . */
private static final Set EXT = Collections.singleton("script");
/** . */
static final ScriptCompiler instance = new ScriptCompiler();
public static ScriptCompiler getInstance() {
return instance;
}
@Override
public Set getExtensions() {
return EXT;
}
@Override
public CommandResolution compileCommand(final String name, final byte[] source) throws CommandException, NullPointerException {
return new CommandResolution() {
@Override
public String getDescription() {
return "";
}
@Override
public Command> getCommand() throws CommandException {
//
final CommandDescriptor
© 2015 - 2024 Weber Informatics LLC | Privacy Policy