Exemplo n.º 1
0
 private Varbox R(String x) throws IOException {
   if (nextToken() == '>') {
     if (nextToken() != '"' && currentToken() != StreamTokenizer.TT_WORD)
       throw new IOException("a tool name must follow after token >");
     Varbox r = R2(tokenizer.sval);
     r.stdin = x;
     return r;
   }
   tokenizer.pushBack();
   return R2(x);
 }
Exemplo n.º 2
0
 private Varbox R2(String tool) throws IOException {
   if (nextToken() != '"' && currentToken() != StreamTokenizer.TT_WORD)
     throw new IOException("an action name must follow after tool");
   Command c = new Command();
   c.action = tokenizer.sval;
   c.tool = tool;
   Varbox r = new Varbox();
   nextToken();
   while (currentToken() == '-') {
     Entry<String, String> pair = PAIR();
     c.pairs.put(pair.getKey(), pair.getValue());
     nextToken();
   }
   r.commands.add(c);
   while (currentToken() == '|') {
     r.commands.add(COMMAND());
   }
   if (currentToken() == '>') {
     if (nextToken() != '"' && currentToken() != StreamTokenizer.TT_WORD)
       throw new IOException("a stdout literal must follow after token '>'");
     r.stdout = tokenizer.sval;
   }
   return r;
 }