org.owasp.orizon.mirage.parser
Class MirageParser

java.lang.Object
  extended by org.owasp.orizon.mirage.parser.MirageParser
All Implemented Interfaces:
MirageConstants

public class MirageParser
extends java.lang.Object
implements MirageConstants


Field Summary
 MirageLexer token_source
          Generated Lexer.
 
Fields inherited from interface org.owasp.orizon.mirage.parser.MirageConstants
COMMAND, DEFAULT, DUMP, DUMPCOMMAND, EOF, ERRORS, FILENAME, IDENTS, INCLS, INFO, INFOCOMMAND, LIST, LISTCOMMAND, MODEL, MODELCOMMAND, NL, NOCOMMAND, nodeNames, OPEN, OPENCOMMAND, PARSE, QUIT, QUITCOMMAND, SEARCH, SEARCHCOMMAND, SHOW, SHOWCOMMAND, tokenImage, VARS
 
Constructor Summary
MirageParser(MirageLexer tm)
          Constructor with generated Token Manager.
MirageParser(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 DumpCommand()
           
 void enable_tracing()
          Enable tracing.
 ParseException generateParseException()
           
 boolean getBuildTree()
           
 Token getNextToken()
          Get the next Token.
 Token getToken(int index)
          Get the specific Token.
 void InfoCommand()
           
 void ListCommand()
           
 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)
           
 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 SearchCommand()
           
 void setBuildTree(boolean buildTree)
           
 void setInputSource(java.lang.String inputSource)
           
 void ShowCommand()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

token_source

public MirageLexer token_source
Generated Lexer.

Constructor Detail

MirageParser

public MirageParser(java.io.Reader stream)

MirageParser

public MirageParser(MirageLexer 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

ModelCommand

public final void ModelCommand()
                        throws ParseException
Throws:
ParseException

OpenCommand

public final void OpenCommand()
                       throws ParseException
Throws:
ParseException

SearchCommand

public final void SearchCommand()
                         throws ParseException
Throws:
ParseException

QuitCommand

public final void QuitCommand()
                       throws ParseException
Throws:
ParseException

InfoCommand

public final void InfoCommand()
                       throws ParseException
Throws:
ParseException

NoCommand

public final void NoCommand()
                     throws ParseException
Throws:
ParseException

ShowCommand

public final void ShowCommand()
                       throws ParseException
Throws:
ParseException

DumpCommand

public final void DumpCommand()
                       throws ParseException
Throws:
ParseException

ListCommand

public final void ListCommand()
                       throws ParseException
Throws:
ParseException