org.owasp.orizon.tornado.parser
Class TornadoParser

java.lang.Object
  extended by org.owasp.orizon.tornado.parser.TornadoParser
All Implemented Interfaces:
TornadoConstants

public class TornadoParser
extends java.lang.Object
implements TornadoConstants


Field Summary
 TornadoLexer token_source
          Generated Lexer.
 
Fields inherited from interface org.owasp.orizon.tornado.parser.TornadoConstants
COMMAND, COUNT, COUNTCOMMAND, DEFAULT, EOF, FILENAME, JAR, JARCOMMAND, LIST, LISTCOMMAND, LOAD, LOADCOMMAND, NL, nodeNames, QUIT, QUITCOMMAND, RUN, RUNALL, RUNALLCOMMAND, RUNCOMMAND, tokenImage
 
Constructor Summary
TornadoParser(java.io.Reader stream)
           
TornadoParser(TornadoLexer tm)
          Constructor with generated Token Manager.
 
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 CountCommand()
           
 void disable_tracing()
          Disable tracing.
 void enable_tracing()
          Enable tracing.
 ParseException generateParseException()
           
 boolean getBuildTree()
           
 Token getNextToken()
          Get the next Token.
 Token getToken(int index)
          Get the specific Token.
 void JarCommand()
           
 void ListCommand()
           
 void LoadCommand()
           
 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 openNodeScope(Node n)
           
 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()
           
 Node rootNode()
          Returns the root node of the AST.
 void RunAllCommand()
           
 void RunCommand()
           
 void setBuildTree(boolean buildTree)
           
 void setInputSource(java.lang.String inputSource)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

token_source

public TornadoLexer token_source
Generated Lexer.

Constructor Detail

TornadoParser

public TornadoParser(java.io.Reader stream)

TornadoParser

public TornadoParser(TornadoLexer 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

LoadCommand

public final void LoadCommand()
                       throws ParseException
Throws:
ParseException

JarCommand

public final void JarCommand()
                      throws ParseException
Throws:
ParseException

CountCommand

public final void CountCommand()
                        throws ParseException
Throws:
ParseException

QuitCommand

public final void QuitCommand()
                       throws ParseException
Throws:
ParseException

RunCommand

public final void RunCommand()
                      throws ParseException
Throws:
ParseException

RunAllCommand

public final void RunAllCommand()
                         throws ParseException
Throws:
ParseException

ListCommand

public final void ListCommand()
                       throws ParseException
Throws:
ParseException