org.owasp.orizon.library.parser
Class LibraryParser

java.lang.Object
  extended by org.owasp.orizon.library.parser.LibraryParser
All Implemented Interfaces:
LibraryConstants

public class LibraryParser
extends java.lang.Object
implements LibraryConstants


Field Summary
 LibraryLexer token_source
          Generated Lexer.
 
Fields inherited from interface org.owasp.orizon.library.parser.LibraryConstants
COMMAND, DEFAULT, EOF, FILENAME, HELP, HELPCOMMAND, INFO, INFOCOMMAND, NL, NOCOMMAND, nodeNames, OPEN, OPENCOMMAND, QUIT, QUITCOMMAND, STAT, STATCOMMAND, tokenImage
 
Constructor Summary
LibraryParser(LibraryLexer tm)
          Constructor with generated Token Manager.
LibraryParser(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 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 HelpCommand()
           
 void InfoCommand()
           
 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)
           
 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 setBuildTree(boolean buildTree)
           
 void setInputSource(java.lang.String inputSource)
           
 void StatCommand()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

token_source

public LibraryLexer token_source
Generated Lexer.

Constructor Detail

LibraryParser

public LibraryParser(java.io.Reader stream)

LibraryParser

public LibraryParser(LibraryLexer 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

StatCommand

public final void StatCommand()
                       throws ParseException
Throws:
ParseException

OpenCommand

public final void OpenCommand()
                       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