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

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

Best Java code snippets using org.crsh.lang.impl.script.Token.parse (Showing top 20 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 static Token parse(CharSequence s) {
 return parse(s, 0);
}
origin: crashub/crash

private TestTokenizer(CharSequence s) throws NullPointerException {
 current = Token.parse(s);
}
origin: crashub/crash

 public static Token parse(final CharSequence s, final int index) {
  Character lastQuote = null;
  int pos = index;
  while (pos < s.length()) {
   char c = s.charAt(pos);
   if (lastQuote == null) {
    if (c == '|') {
     break;
    } else if (c == '"' || c == '\'') {
     lastQuote = c;
    }
   } else {
    if (lastQuote == c) {
     lastQuote = null;
    }      }
   pos++;
  }
  Token next = pos < s.length() ? parse(s, pos + 1) : null;
  return new Token(s.subSequence(index, pos).toString(), next);
 }
}
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

public CompletionMatch complete(ShellSession session, String prefix) {
 Token ast = Token.parse(prefix);
 String termPrefix;
 if (ast != null) {
origin: crashub/crash

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

public static Token parse(CharSequence s) {
 return parse(s, 0);
}
origin: com.github.corda.crash/crash.shell

public static Token parse(CharSequence s) {
 return parse(s, 0);
}
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 static Token parse(final CharSequence s, final int index) {
  Character lastQuote = null;
  int pos = index;
  while (pos < s.length()) {
   char c = s.charAt(pos);
   if (lastQuote == null) {
    if (c == '|') {
     break;
    } else if (c == '"' || c == '\'') {
     lastQuote = c;
    }
   } else {
    if (lastQuote == c) {
     lastQuote = null;
    }      }
   pos++;
  }
  Token next = pos < s.length() ? parse(s, pos + 1) : null;
  return new Token(s.subSequence(index, pos).toString(), next);
 }
}
origin: com.github.corda.crash/crash.shell

 public static Token parse(final CharSequence s, final int index) {
  Character lastQuote = null;
  int pos = index;
  while (pos < s.length()) {
   char c = s.charAt(pos);
   if (lastQuote == null) {
    if (c == '|') {
     break;
    } else if (c == '"' || c == '\'') {
     lastQuote = c;
    }
   } else {
    if (lastQuote == c) {
     lastQuote = null;
    }      }
   pos++;
  }
  Token next = pos < s.length() ? parse(s, pos + 1) : null;
  return new Token(s.subSequence(index, pos).toString(), next);
 }
}
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: com.github.corda.crash/crash.shell

public CompletionMatch complete(ShellSession session, String prefix) {
 Token ast = Token.parse(prefix);
 String termPrefix;
 if (ast != null) {
origin: org.crashub/crash.shell

public CompletionMatch complete(ShellSession session, String prefix) {
 Token ast = Token.parse(prefix);
 String termPrefix;
 if (ast != null) {
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.scriptTokenparse

Popular methods of Token

  • createFactory
  • <init>
  • getLast

Popular in Java

  • Making http post requests using okhttp
  • runOnUiThread (Activity)
  • getApplicationContext (Context)
  • startActivity (Activity)
  • BufferedWriter (java.io)
    Wraps an existing Writer and buffers the output. Expensive interaction with the underlying reader is
  • System (java.lang)
    Provides access to system-related information and resources including standard input and output. Ena
  • SQLException (java.sql)
    An exception that indicates a failed JDBC operation. It provides the following information about pro
  • Hashtable (java.util)
    Hashtable is a synchronized implementation of Map. All optional operations are supported.Neither key
  • TreeSet (java.util)
    A NavigableSet implementation based on a TreeMap. The elements are ordered using their Comparable, o
  • SSLHandshakeException (javax.net.ssl)
    The exception that is thrown when a handshake could not be completed successfully.
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