org.owasp.orizon.tools.osh.parser
Class OshParser

java.lang.Object
  extended by org.owasp.orizon.tools.osh.parser.OshParser
All Implemented Interfaces:
OshConstants

public class OshParser
extends java.lang.Object
implements OshConstants


Field Summary
 OshLexer token_source
          Generated Lexer.
 
Fields inherited from interface org.owasp.orizon.tools.osh.parser.OshConstants
C_T, COMMAND, CRAWL, CRAWLCOMMAND, DEFAULT, DUSK, DUSKCOMMAND, EOF, FILENAME, HELP, HELPCOMMAND, INFO, INFOCOMMAND, J_T, JERICHO, JERICHOCOMMAND, LIST, LISTCOMMAND, MIRAGE, MIRAGECOMMAND, MODEL, MODELCOMMAND, NL, NOCOMMAND, nodeNames, NOTRACE, OPEN, OPENCOMMAND, ORL_ROOT, ORLROOTCOMMAND, PHP_T, QUIET, QUIT, QUITCOMMAND, R_CONSOLE, R_CSV, R_HTML, R_TXT, R_XML, REPORT, REPORT_FORMAT, REPORT_NAME, REPORTCOMMAND, REPORTFORMATCOMMAND, REPORTNAMECOMMAND, RUN, RUNCOMMAND, SEARCH, SEARCHCOMMAND, SET, SETCOMMAND, STAT, STATCOMMAND, STORE, SUGGEST, SUGGESTCOMMAND, TEE, TEST, TESTCOMMAND, tokenImage, TORNADO, TORNADOCOMMAND, TRACE, TWILIGHT, TWILIGHTCOMMAND, VERSION, VERSIONCOMMAND
 
Constructor Summary
OshParser(OshLexer tm)
          Constructor with generated Token Manager.
OshParser(java.io.Reader stream)
           
 
Method Summary
 void clearNodeScope()
           
 void closeNodeScope(Node n, boolean condition)
          A conditional node is constructed if its condition is true.
 void closeNodeScope(Node n, int num)
           
 void Command()
           
 void CrawlCommand()
           
 void disable_tracing()
          Disable tracing.
 void DuskCommand()
           
 void enable_tracing()
          Enable tracing.
 ParseException generateParseException()
           
 boolean getBuildTree()
           
 Token getNextToken()
          Get the next Token.
 Token getToken(int index)
          Get the specific Token.
 void HelpCommand()
           
 void InfoCommand()
           
 void JerichoCommand()
           
 void ListCommand()
           
 void MirageCommand()
           
 void ModelCommand()
           
 void NoCommand()
           
 int nodeArity()
          Returns the number of children on the stack in the current node scope.
 boolean nodeCreated()
          Determines whether the current node was actually closed and pushed.
 void OpenCommand()
           
 void openNodeScope(Node n)
           
 void OrlRootCommand()
           
 Node peekNode()
          Returns the node currently on the top of the stack.
 void pokeNode(Node n)
          Puts the node on the top of the stack.
 void pokeNode(Node n, boolean clearNodeScope)
          Puts the node on the top of the stack.
 Node popNode()
          Returns the node on the top of the stack, and remove it from the stack.
 void pushNode(Node n)
          push a node onto the top of the node stack
 void QuitCommand()
           
 void ReportCommand()
           
 void ReportFormatCommand()
           
 void ReportNameCommand()
           
 Node rootNode()
          Returns the root node of the AST.
 void RunCommand()
           
 void SearchCommand()
           
 void setBuildTree(boolean buildTree)
           
 void SetCommand()
           
 void setInputSource(java.lang.String inputSource)
           
 void StatCommand()
           
 void SuggestCommand()
           
 void TestCommand()
           
 void TornadoCommand()
           
 void TwilightCommand()
           
 void VersionCommand()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

token_source

public OshLexer token_source
Generated Lexer.

Constructor Detail

OshParser

public OshParser(java.io.Reader stream)

OshParser

public OshParser(OshLexer tm)
Constructor with generated Token Manager.

Method Detail

nodeCreated

public boolean nodeCreated()
Determines whether the current node was actually closed and pushed. This should only be called in the final user action of a node scope.


rootNode

public Node rootNode()
Returns the root node of the AST. It only makes sense to call this after a successful parse.


pushNode

public void pushNode(Node n)
push a node onto the top of the node stack


popNode

public Node popNode()
Returns the node on the top of the stack, and remove it from the stack.


peekNode

public Node peekNode()
Returns the node currently on the top of the stack.


pokeNode

public void pokeNode(Node n)
Puts the node on the top of the stack. However, unlike pushNode() it replaces the node that is currently on the top of the stack. This is effectively equivalent to popNode() followed by pushNode(n)


pokeNode

public void pokeNode(Node n,
                     boolean clearNodeScope)
Puts the node on the top of the stack. If clearNodeScope is true, it removes all the nodes in the current node scope and pushes n onto the top. Otherwise, it simply replaces the node at the top of the stack with n.


nodeArity

public int nodeArity()
Returns the number of children on the stack in the current node scope.


clearNodeScope

public void clearNodeScope()

openNodeScope

public void openNodeScope(Node n)

closeNodeScope

public void closeNodeScope(Node n,
                           int num)

closeNodeScope

public void closeNodeScope(Node n,
                           boolean condition)
A conditional node is constructed if its condition is true. All the nodes that have been pushed since the node was opened are made children of the conditional node, which is then pushed on to the stack. If the condition is false the node is not constructed and they are left on the stack.


getBuildTree

public boolean getBuildTree()

setBuildTree

public void setBuildTree(boolean buildTree)

setInputSource

public void setInputSource(java.lang.String inputSource)

getNextToken

public final Token getNextToken()
Get the next Token.


getToken

public final Token getToken(int index)
Get the specific Token.


generateParseException

public ParseException generateParseException()

enable_tracing

public final void enable_tracing()
Enable tracing.


disable_tracing

public final void disable_tracing()
Disable tracing.


Command

public final void Command()
                   throws ParseException
Throws:
ParseException

RunCommand

public final void RunCommand()
                      throws ParseException
Throws:
ParseException

VersionCommand

public final void VersionCommand()
                          throws ParseException
Throws:
ParseException

SuggestCommand

public final void SuggestCommand()
                          throws ParseException
Throws:
ParseException

TestCommand

public final void TestCommand()
                       throws ParseException
Throws:
ParseException

SetCommand

public final void SetCommand()
                      throws ParseException
Throws:
ParseException

ListCommand

public final void ListCommand()
                       throws ParseException
Throws:
ParseException

ReportNameCommand

public final void ReportNameCommand()
                             throws ParseException
Throws:
ParseException

OrlRootCommand

public final void OrlRootCommand()
                          throws ParseException
Throws:
ParseException

MirageCommand

public final void MirageCommand()
                         throws ParseException
Throws:
ParseException

ReportFormatCommand

public final void ReportFormatCommand()
                               throws ParseException
Throws:
ParseException

ReportCommand

public final void ReportCommand()
                         throws ParseException
Throws:
ParseException

CrawlCommand

public final void CrawlCommand()
                        throws ParseException
Throws:
ParseException

StatCommand

public final void StatCommand()
                       throws ParseException
Throws:
ParseException

OpenCommand

public final void OpenCommand()
                       throws ParseException
Throws:
ParseException

ModelCommand

public final void ModelCommand()
                        throws ParseException
Throws:
ParseException

JerichoCommand

public final void JerichoCommand()
                          throws ParseException
Throws:
ParseException

TwilightCommand

public final void TwilightCommand()
                           throws ParseException
Throws:
ParseException

DuskCommand

public final void DuskCommand()
                       throws ParseException
Throws:
ParseException

TornadoCommand

public final void TornadoCommand()
                          throws ParseException
Throws:
ParseException

QuitCommand

public final void QuitCommand()
                       throws ParseException
Throws:
ParseException

HelpCommand

public final void HelpCommand()
                       throws ParseException
Throws:
ParseException

InfoCommand

public final void InfoCommand()
                       throws ParseException
Throws:
ParseException

NoCommand

public final void NoCommand()
                     throws ParseException
Throws:
ParseException

SearchCommand

public final void SearchCommand()
                         throws ParseException
Throws:
ParseException