|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object tribble.net.ftp.shell.BlockDef
class BlockDef
FTP command begin/end block or func definition.
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.
CommandExec
,
ExecFrame
Field Summary | |
---|---|
(package private) int |
m_depth
Scope nesting depth. |
(package private) int |
m_lineNo
Source line number. |
(package private) java.lang.String |
m_name
Name of this block definition. |
(package private) BlockDef |
m_outer
Outer block containing this block definition. |
(package private) CommandNode |
m_parent
Parent command enclosing this block. |
(package private) java.lang.String |
m_type
Block type (begin/end, foreach, repeat). |
(package private) static java.lang.String |
REV
Revision information. |
Constructor Summary | |
---|---|
BlockDef(java.lang.String name,
int lineNo,
BlockDef outer,
CommandNode cmd)
Constructor. |
Method Summary | |
---|---|
(package private) boolean |
addFuncDef(java.lang.String name,
CommandNode cmd)
Add a local func definition to this block definition. |
(package private) boolean |
addLabelDef(java.lang.String name,
CommandNode cmd)
Add a local label definition to this block definition. |
(package private) boolean |
addVarDef(java.lang.String name,
CommandNode cmd)
Add a local var definition to this block definition. |
(package private) BlockDef |
findFuncBlock(java.lang.String name)
Find the block containing a func definition. |
(package private) CommandNode |
findFuncDef(java.lang.String name)
Retrieve a func definition within this block's scope. |
(package private) BlockDef |
findLabelBlock(java.lang.String name)
Find the block containing a label definition. |
(package private) CommandNode |
findLabelDef(java.lang.String name)
Retrieve a local label definition in this block definition. |
(package private) BlockDef |
findVarBlock(java.lang.String name)
Find the block containing a var definition. |
(package private) CommandNode |
findVarDef(java.lang.String name)
Retrieve a var definition within this block's scope. |
(package private) boolean |
isFunc()
Determine if this block definition is a func body. |
(package private) void |
printTree(java.io.PrintWriter out)
Pretty-print this block definition and its subordinate blocks. |
(package private) void |
scrub()
Release objects that are no longer needed by this block definition after a successful parse. |
(package private) void |
setCmds(CommandNode cmds)
Establish the commands (statements) for this block definition. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
static final java.lang.String REV
java.lang.String m_name
java.lang.String m_type
BlockDef m_outer
CommandNode m_parent
int m_lineNo
int m_depth
Constructor Detail |
---|
BlockDef(java.lang.String name, int lineNo, BlockDef outer, CommandNode cmd)
name
- Name of this block. Funcs have user-defined names, while begin/end block
have names such as ".42".lineNo
- Source line number where the block is defined.outer
- Begin/end block or func containing this block. This is null for the
outermost (file) scope, which has no outer scope.cmd
- Parent command containing this block. This is null for the outermost
(file) scope, and for block commands having no controlling command.Method Detail |
---|
void setCmds(CommandNode cmds)
cmds
- First command (statement) defined within the begin/end block or func, or
null if there are no commands.boolean isFunc()
boolean addFuncDef(java.lang.String name, CommandNode cmd)
name
- Func name.cmd
- Command (CMD_FUNC
) containing the func definition.
CommandNode findFuncDef(java.lang.String name)
name
- Func name.
CMD_FUNC
) containing the func
definition, or null if no such func exists within the scope of this block
definition.BlockDef findFuncBlock(java.lang.String name)
name
- Var name.
boolean addVarDef(java.lang.String name, CommandNode cmd)
name
- Var name.cmd
- Command (CMD_VAR
) containing the var definition.
CommandNode findVarDef(java.lang.String name)
name
- Var name.
CMD_VAR
) containing the var definition,
or null if no such var exists in the scope of this block definition.BlockDef findVarBlock(java.lang.String name)
name
- Var name.
boolean addLabelDef(java.lang.String name, CommandNode cmd)
name
- Label name.cmd
- Command (CMD_LABEL
) containing the statement label
definition.
CommandNode findLabelDef(java.lang.String name)
name
- Label name.
CMD_LABEL
) containing the statement
label, or null if no such label exists in this block definition.BlockDef findLabelBlock(java.lang.String name)
name
- Label name.
void scrub()
void printTree(java.io.PrintWriter out)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |