tribble.net.ftp.shell
Class CommandNode

java.lang.Object
  extended by tribble.net.ftp.shell.CommandNode
All Implemented Interfaces:
CommandCodes

 class CommandNode
extends java.lang.Object
implements CommandCodes

FTP command script parser.

Example

  loop1:
    foreach remote *.tar do begin
        get $F
        if $_E != 0
            continue loop1
        del $F
        !tar -xf $F
        !del $F
    end

The example script above parses into the following command parse tree:

    1  (label "loop1")
    2  (foreach "remote" "*.tar")
    3      (get "$F")
    4      (if (!= "$_E" "0"))
    5          (continue 2 "loop1")
    6      (del "$F")
    7      (! "tar" "-xf" "$F")
    8      (! "del" "$F")

Since:
API 1.0, 2007-03-11
Version:
$Revision: 1.8 $ $Date: 2007/04/13 04:21:22 $
Author:
David R. Tribble (david@tribble.com).

Copyright ©2007 by David R. Tribble, all rights reserved.
Permission is granted to any person or entity except those designated by by the United States Department of State as a terrorist, or terrorist government or agency, to use and distribute this source code provided that the original copyright notice remains present and unaltered.

See Also:
CommandParser

Field Summary
(package private)  java.lang.Object[] m_args
          Arguments (may be null).
(package private)  java.lang.String m_cmd
          Command operator.
(package private)  int m_lineNo
          Source line number.
(package private)  CommandNode m_next
          Next command.
(package private) static java.lang.String REV
          Revision information.
 
Fields inherited from interface tribble.net.ftp.shell.CommandCodes
CMD__UNDEF, CMD_ADD, CMD_AND, CMD_APPEND, CMD_BINARY, CMD_BLOCK, CMD_BREAK, CMD_BUILTIN, CMD_CALL, CMD_CDUP, CMD_CHDIR, CMD_CLOSE, CMD_CONCAT, CMD_COND, CMD_CONNECT, CMD_CONTINUE, CMD_DEBUG, CMD_DECR, CMD_DELETE, CMD_DIR, CMD_DIV, CMD_ECHO, CMD_EQ, CMD_EXEC, CMD_EXIT, CMD_FALSE, CMD_FILENAME, CMD_FOR, CMD_FOREACH, CMD_FUNC, CMD_FUNC_FORMAT, CMD_FUNC_INDEX, CMD_FUNC_LCASE, CMD_FUNC_LEN, CMD_FUNC_NORM, CMD_FUNC_REPL, CMD_FUNC_RINDEX, CMD_FUNC_SUB, CMD_FUNC_TRIM, CMD_FUNC_UCASE, CMD_GE, CMD_GET, CMD_GLOB, CMD_GOTO, CMD_GT, CMD_HELP, CMD_IF, CMD_INCR, CMD_LABEL, CMD_LCHDIR, CMD_LE, CMD_LOCAL, CMD_LT, CMD_MATCH, CMD_MGET, CMD_MKDIR, CMD_MOD, CMD_MPUT, CMD_MUL, CMD_NE, CMD_NEG, CMD_NMATCH, CMD_NO_N, CMD_NOP, CMD_NOT, CMD_OPEN, CMD_OR, CMD_POS, CMD_PRINT, CMD_PUT, CMD_PWD, CMD_READ, CMD_REMOTE, CMD_RENAME, CMD_REPEAT, CMD_RETURN, CMD_RMDIR, CMD_SET, CMD_SHELL, CMD_SLEEP, CMD_STATUS, CMD_STREQ, CMD_SUB, CMD_SUBSCR, CMD_SYSTEM, CMD_TEST, CMD_TEST_DIR, CMD_TEST_EXEC, CMD_TEST_EXISTS, CMD_TEST_FILE, CMD_TEST_MODTIME, CMD_TEST_READ, CMD_TEST_SIZE, CMD_TEST_WRITE, CMD_TEXT, CMD_TIMEOUT, CMD_TOK, CMD_TRUE, CMD_USER, CMD_VAR, CMD_WAITFOR, CMD_WHILE, CMD_WRITE, CMD_X_INTERRUPT, CMD_X_SESSIONS, CMD_X_STACK, CMD_X_STOP, CMD_X_VARS, CMD_X_VERBOSE, VAL_EMPTY, VAL_FALSE, VAL_FALSE_WD, VAL_ONE, VAL_TRUE, VAL_TRUE_WD, VAL_ZERO
 
Constructor Summary
CommandNode(java.lang.String cmd, int line)
          Constructor.
 
Method Summary
(package private)  int addArg(java.lang.Object arg)
          Append an argument to this command node.
(package private)  void print(java.io.PrintWriter out)
          Pretty-print this parse tree.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

REV

static final java.lang.String REV
Revision information.

See Also:
Constant Field Values

m_cmd

java.lang.String m_cmd
Command operator.


m_args

java.lang.Object[] m_args
Arguments (may be null). Each argument is one of these types:
- String, containing a name, word token, or literal value;
- CommandNode, containing a subexpression;
- BlockDef, containing a begin/end block or func definition.


m_next

CommandNode m_next
Next command.


m_lineNo

int m_lineNo
Source line number.

Constructor Detail

CommandNode

CommandNode(java.lang.String cmd,
            int line)
Constructor.

Parameters:
cmd - Command code, one of the CMD_XXX constants.
line - Source line number for this command node.
Since:
1.2, 2007-03-13
Method Detail

addArg

int addArg(java.lang.Object arg)
Append an argument to this command node.

Parameters:
arg - An argument (usually a String or another CommandNode subtree).
Since:
1.1, 2007-03-11

print

void print(java.io.PrintWriter out)
Pretty-print this parse tree.

Since:
1.2, 2007-03-13