Codota Logo
Token.createFactory
Code IndexAdd Codota to your IDE (free)

How to use
createFactory
method
in
org.crsh.lang.impl.script.Token

Best Java code snippets using org.crsh.lang.impl.script.Token.createFactory (Showing top 13 results out of 315)

  • Common ways to obtain Token
private void myMethod () {
Token t =
  • Codota IconCharSequence s;Token.parse(s)
  • Smart code suggestions by Codota
}
origin: crashub/crash

public PipeLineFactory createFactory() throws CommandException {
 if (next != null) {
  PipeLineFactory nextFactory = next.createFactory();
  if (nextFactory != null) {
   return new PipeLineFactory(value, nextFactory);
  } else {
   throw new CommandException(ErrorKind.SYNTAX, "");
  }
 } else {
  return Utils.notBlank(value) ? new PipeLineFactory(value, null) : null;
 }
}
origin: crashub/crash

public CommandInvoker<?, ?> resolve(String s) throws CommandException {
 CRaSHSession session = (CRaSHSession)getSession();
 Token token2 = Token.parse(s);
 try {
  PipeLineFactory factory = token2.createFactory();
  return factory.create(session);
 }
 catch (CommandNotFoundException e) {
  throw new CommandException(ErrorKind.SYNTAX, e.getMessage(), e);
 }
}
origin: crashub/crash

public void testBlank() throws CommandException {
 assertNull(Token.parse("").createFactory());
 assertNull(Token.parse(" ").createFactory());
}
origin: crashub/crash

 private void assertSyntaxException(String s) {
  try {
   Token.parse(s).createFactory();
   fail();
  }
  catch (CommandException e) {
   assertEquals(ErrorKind.SYNTAX, e.getErrorKind());
  }
 }
}
origin: crashub/crash

public void testCommand() throws CommandException {
 PipeLineFactory e = Token.parse("a").createFactory();
 assertEquals("a", e.getLine());
 assertNull(e.getNext());
}
origin: crashub/crash

public ReplResponse eval(ShellSession session, String request) {
 PipeLineFactory factory;
 try {
  factory = Token.parse(request).createFactory();
 }
 catch (CommandException e) {
  return new ReplResponse.Response(ShellResponse.error(e.getErrorKind(), e.getMessage(), e.getCause()));
 }
 if (factory != null) {
  try {
   CommandInvoker<Void, Object> invoker = factory.create(session);
   return new ReplResponse.Invoke(invoker);
  }
  catch (CommandNotFoundException e) {
   log.log(Level.FINER, "Could not create command", e);
   return new ReplResponse.Response(ShellResponse.unknownCommand(e.getName()));
  }
  catch (CommandException e) {
   log.log(Level.FINER, "Could not create command", e);
   return new ReplResponse.Response(ShellResponse.error(e.getErrorKind(), e.getMessage(), e));
  }
 } else {
  return new ReplResponse.Response(ShellResponse.noCommand());
 }
}
origin: crashub/crash

public void testPipe() throws CommandException {
 PipeLineFactory e = Token.parse("a|b").createFactory();
 assertEquals("a", e.getLine());
 assertEquals("b", e.getNext().getLine());
 assertNull(e.getNext().getNext());
}
origin: org.crashub/crash.shell

public PipeLineFactory createFactory() throws CommandException {
 if (next != null) {
  PipeLineFactory nextFactory = next.createFactory();
  if (nextFactory != null) {
   return new PipeLineFactory(value, nextFactory);
  } else {
   throw new CommandException(ErrorKind.SYNTAX, "");
  }
 } else {
  return Utils.notBlank(value) ? new PipeLineFactory(value, null) : null;
 }
}
origin: com.github.corda.crash/crash.shell

public PipeLineFactory createFactory() throws CommandException {
 if (next != null) {
  PipeLineFactory nextFactory = next.createFactory();
  if (nextFactory != null) {
   return new PipeLineFactory(value, nextFactory);
  } else {
   throw new CommandException(ErrorKind.SYNTAX, "");
  }
 } else {
  return Utils.notBlank(value) ? new PipeLineFactory(value, null) : null;
 }
}
origin: com.github.corda.crash/crash.shell

public CommandInvoker<?, ?> resolve(String s) throws CommandException {
 CRaSHSession session = (CRaSHSession)getSession();
 Token token2 = Token.parse(s);
 try {
  PipeLineFactory factory = token2.createFactory();
  return factory.create(session);
 }
 catch (CommandNotFoundException e) {
  throw new CommandException(ErrorKind.SYNTAX, e.getMessage(), e);
 }
}
origin: org.crashub/crash.shell

public CommandInvoker<?, ?> resolve(String s) throws CommandException {
 CRaSHSession session = (CRaSHSession)getSession();
 Token token2 = Token.parse(s);
 try {
  PipeLineFactory factory = token2.createFactory();
  return factory.create(session);
 }
 catch (CommandNotFoundException e) {
  throw new CommandException(ErrorKind.SYNTAX, e.getMessage(), e);
 }
}
origin: org.crashub/crash.shell

public ReplResponse eval(ShellSession session, String request) {
 PipeLineFactory factory;
 try {
  factory = Token.parse(request).createFactory();
 }
 catch (CommandException e) {
  return new ReplResponse.Response(ShellResponse.error(e.getErrorKind(), e.getMessage(), e.getCause()));
 }
 if (factory != null) {
  try {
   CommandInvoker<Void, Object> invoker = factory.create(session);
   return new ReplResponse.Invoke(invoker);
  }
  catch (CommandNotFoundException e) {
   log.log(Level.FINER, "Could not create command", e);
   return new ReplResponse.Response(ShellResponse.unknownCommand(e.getName()));
  }
  catch (CommandException e) {
   log.log(Level.FINER, "Could not create command", e);
   return new ReplResponse.Response(ShellResponse.error(e.getErrorKind(), e.getMessage(), e));
  }
 } else {
  return new ReplResponse.Response(ShellResponse.noCommand());
 }
}
origin: com.github.corda.crash/crash.shell

public ReplResponse eval(ShellSession session, String request) {
 PipeLineFactory factory;
 try {
  factory = Token.parse(request).createFactory();
 }
 catch (CommandException e) {
  return new ReplResponse.Response(ShellResponse.error(e.getErrorKind(), e.getMessage(), e.getCause()));
 }
 if (factory != null) {
  try {
   CommandInvoker<Void, Object> invoker = factory.create(session);
   return new ReplResponse.Invoke(invoker);
  }
  catch (CommandNotFoundException e) {
   log.log(Level.FINER, "Could not create command", e);
   return new ReplResponse.Response(ShellResponse.unknownCommand(e.getName()));
  }
  catch (CommandException e) {
   log.log(Level.FINER, "Could not create command", e);
   return new ReplResponse.Response(ShellResponse.error(e.getErrorKind(), e.getMessage(), e));
  }
 } else {
  return new ReplResponse.Response(ShellResponse.noCommand());
 }
}
org.crsh.lang.impl.scriptTokencreateFactory

Popular methods of Token

  • parse
  • <init>
  • getLast

Popular in Java

  • Parsing JSON documents to java classes using gson
  • requestLocationUpdates (LocationManager)
  • getApplicationContext (Context)
  • scheduleAtFixedRate (Timer)
    Schedules the specified task for repeated fixed-rate execution, beginning after the specified delay.
  • VirtualMachine (com.sun.tools.attach)
    A Java virtual machine. A VirtualMachine represents a Java virtual machine to which this Java vir
  • Time (java.sql)
    Java representation of an SQL TIME value. Provides utilities to format and parse the time's represen
  • CountDownLatch (java.util.concurrent)
    A synchronization aid that allows one or more threads to wait until a set of operations being perfor
  • Stream (java.util.stream)
    A sequence of elements supporting sequential and parallel aggregate operations. The following exampl
  • LoggerFactory (org.slf4j)
    The LoggerFactory is a utility class producing Loggers for various logging APIs, most notably for lo
  • Option (scala)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now