org.owasp.orizon.mirage.jsp.parser
Class JspParser

java.lang.Object
  extended by org.owasp.orizon.mirage.jsp.parser.JspParser
All Implemented Interfaces:
JspConstants

public class JspParser
extends java.lang.Object
implements JspConstants


Field Summary
 JspLexer token_source
          Generated Lexer.
 
Fields inherited from interface org.owasp.orizon.mirage.jsp.parser.JspConstants
AfterTagState, ALPHA_CHAR, ALPHANUM_CHAR, ATTR_EQ, ATTR_NAME, ATTRIBUTE, ATTRIBUTEVALUE, AttrValueBetweenDoubleQuotesState, AttrValueBetweenSingleQuotesState, AttrValueState, CDATA, CDATA_END, CDATA_START, CDataState, COMMENT_END, COMMENT_START, COMMENT_TEXT, CommentState, COMMENTTAG, COMPILATIONUNIT, CONTENT, DECL_END, DECL_START, DECLARATION, DEFAULT, DOCTYPE_DECL_END, DOCTYPE_DECL_START, DOCTYPEDECLARATION, DOCTYPEEXTERNALID, DocTypeExternalIdState, DocTypeState, DOLLAR, DOLLAR_OR_HASH_DOUBLE_QUOTE, DOLLAR_OR_HASH_SINGLE_QUOTE, DOUBLE_QUOTE, EL_ESCAPE, EL_EXPRESSION, EL_EXPRESSION_IN_ATTRIBUTE, ELEMENT, ELEXPRESSION, ENDING_DOUBLE_QUOTE, ENDING_SINGLE_QUOTE, ENDTAG_START, EOF, IDENTIFIER, IDENTIFIER_CHAR, IN_TAG_ERROR, InTagState, JSP_COMMENT_CONTENT, JSP_COMMENT_END, JSP_COMMENT_START, JSP_DECLARATION, JSP_DECLARATION_END, JSP_DECLARATION_START, JSP_DIRECTIVE_ATTRIBUTE_EQUALS, JSP_DIRECTIVE_ATTRIBUTE_NAME, JSP_DIRECTIVE_ATTRIBUTE_VALUE, JSP_DIRECTIVE_END, JSP_DIRECTIVE_NAME, JSP_DIRECTIVE_START, JSP_EXPRESSION, JSP_EXPRESSION_END, JSP_EXPRESSION_IN_ATTRIBUTE, JSP_EXPRESSION_START, JSP_SCRIPTLET, JSP_SCRIPTLET_END, JSP_SCRIPTLET_START, JSPCOMMENT, JspCommentState, JSPDECLARATION, JspDeclarationState, JSPDIRECTIVE, JSPDIRECTIVEATTRIBUTE, JspDirectiveAttributesState, JspDirectiveState, JSPEXPRESSION, JSPEXPRESSIONINATTRIBUTE, JspExpressionState, JSPSCRIPTLET, JspScriptletState, LST_ERROR, NAME, NEWLINE, NO_JSP_COMMENT_END, NO_JSP_TAG_END, NO_LT_OR_DOLLAR, NO_OPENBRACE_OR_LT, NO_WHITESPACE_OR_LT_OR_DOLLAR, nodeNames, NUM_CHAR, PUBLIC, QUOTE, QUOTED_LITERAL, QUOTED_STRING, QUOTED_STRING_NO_BREAKS, SINGLE_QUOTE, StartTagState, SYSTEM, TAG_END, TAG_NAME, TAG_SLASHEND, TAG_START, TEXT, TEXT_IN_EL, tokenImage, UNPARSED, UNPARSED_TEXT, UNPARSED_TEXT_NO_DOUBLE_QUOTES, UNPARSED_TEXT_NO_SINGLE_QUOTES, UNPARSEDTEXT, VALUE_BINDING_IN_ATTRIBUTE, VALUEBINDING, WHITESPACE, WHITESPACES, XMLNAME
 
Constructor Summary
JspParser(JspLexer tm)
          Constructor with generated Token Manager.
JspParser(java.io.Reader stream)
           
 
Method Summary
 void Attribute()
           
 void AttributeValue()
          The value of an attribute of an element.
 void CData()
           
 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 CommentTag()
           
 void CompilationUnit()
          The root of the AST of a JSP.
 void Content()
          Everything between a start-tag and the corresponding end-tag of an element.
 void ContentElementPossiblyWithText()
          A single (non-text) element that can occur between a start- and end-tag of an element.
 void Declaration()
           
 void disable_tracing()
          Disable tracing.
 void DoctypeDeclaration()
           
 void DoctypeExternalId()
           
 void Element()
          A XML element, either with a single empty tag, or with a starting and closing tag with optional contained content.
 java.lang.String ElExpression()
          An EL expression, not within an attribute value.
 java.lang.String ElExpressionInAttribute()
           
 void enable_tracing()
          Enable tracing.
 ParseException generateParseException()
           
 boolean getBuildTree()
           
 Token getNextToken()
          Get the next Token.
 Token getToken(int index)
          Get the specific Token.
 void JspComment()
           
 void JspDeclaration()
           
 void JspDirective()
           
 void JspDirectiveAttribute()
           
 void JspExpression()
           
 java.lang.String JspExpressionInAttribute()
           
 void JspScriptlet()
           
 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 Prolog()
          The optional prolog of a JSP, including (xml) declarations and DTD.
 void pushNode(Node n)
          push a node onto the top of the node stack
 java.lang.String QuoteIndependentAttributeValueContent()
          Partial content of an attribute value that can contain all quotes.
 Node rootNode()
          Returns the root node of the AST.
 void setBuildTree(boolean buildTree)
           
 void setInputSource(java.lang.String inputSource)
           
 void Text()
          This production groups all characters between two tags, where tag is an xml-tag "<...>" or a jsp-page-tag "<%...%>" or CDATA "".
 java.lang.String UnparsedText()
           
 java.lang.String UnparsedTextNoDoubleQuotes()
          Text that contains no double quotes, and that does not contain the start of a EL expression or value binding.
 java.lang.String UnparsedTextNoSingleQuotes()
          Text that contains no single quotes, and that does not contain the start of a EL expression or value binding.
 java.lang.String ValueBindingInAttribute()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

token_source

public JspLexer token_source
Generated Lexer.

Constructor Detail

JspParser

public JspParser(java.io.Reader stream)

JspParser

public JspParser(JspLexer 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.


CompilationUnit

public final void CompilationUnit()
                           throws ParseException
The root of the AST of a JSP.

Throws:
ParseException

Prolog

public final void Prolog()
                  throws ParseException
The optional prolog of a JSP, including (xml) declarations and DTD.

Throws:
ParseException

Content

public final void Content()
                   throws ParseException
Everything between a start-tag and the corresponding end-tag of an element.

Throws:
ParseException

ContentElementPossiblyWithText

public final void ContentElementPossiblyWithText()
                                          throws ParseException
A single (non-text) element that can occur between a start- and end-tag of an element. Possibly followed by text.

Throws:
ParseException

JspDirective

public final void JspDirective()
                        throws ParseException
Throws:
ParseException

JspDirectiveAttribute

public final void JspDirectiveAttribute()
                                 throws ParseException
Throws:
ParseException

JspScriptlet

public final void JspScriptlet()
                        throws ParseException
Throws:
ParseException

JspExpression

public final void JspExpression()
                         throws ParseException
Throws:
ParseException

JspDeclaration

public final void JspDeclaration()
                          throws ParseException
Throws:
ParseException

JspComment

public final void JspComment()
                      throws ParseException
Throws:
ParseException

Text

public final void Text()
                throws ParseException
This production groups all characters between two tags, where tag is an xml-tag "<...>" or a jsp-page-tag "<%...%>" or CDATA "". Text consists of unparsed text and/or Expression Language expressions.

Throws:
ParseException

UnparsedText

public final java.lang.String UnparsedText()
                                    throws ParseException
Throws:
ParseException

UnparsedTextNoSingleQuotes

public final java.lang.String UnparsedTextNoSingleQuotes()
                                                  throws ParseException
Text that contains no single quotes, and that does not contain the start of a EL expression or value binding.

Throws:
ParseException

UnparsedTextNoDoubleQuotes

public final java.lang.String UnparsedTextNoDoubleQuotes()
                                                  throws ParseException
Text that contains no double quotes, and that does not contain the start of a EL expression or value binding.

Throws:
ParseException

ElExpression

public final java.lang.String ElExpression()
                                    throws ParseException
An EL expression, not within an attribute value.

Throws:
ParseException

ValueBindingInAttribute

public final java.lang.String ValueBindingInAttribute()
                                               throws ParseException
Throws:
ParseException

ElExpressionInAttribute

public final java.lang.String ElExpressionInAttribute()
                                               throws ParseException
Throws:
ParseException

CData

public final void CData()
                 throws ParseException
Throws:
ParseException

Element

public final void Element()
                   throws ParseException
A XML element, either with a single empty tag, or with a starting and closing tag with optional contained content.

Throws:
ParseException

Attribute

public final void Attribute()
                     throws ParseException
Throws:
ParseException

AttributeValue

public final void AttributeValue()
                          throws ParseException
The value of an attribute of an element. EL expressions, JSF value bindings, and JSP expressions are parsed as sub-nodes of the AttributeValue node.

Throws:
ParseException

QuoteIndependentAttributeValueContent

public final java.lang.String QuoteIndependentAttributeValueContent()
                                                             throws ParseException
Partial content of an attribute value that can contain all quotes. This groups EL expressions, value bindings, and JSP expressions.

Throws:
ParseException

JspExpressionInAttribute

public final java.lang.String JspExpressionInAttribute()
                                                throws ParseException
Throws:
ParseException

CommentTag

public final void CommentTag()
                      throws ParseException
Throws:
ParseException

Declaration

public final void Declaration()
                       throws ParseException
Throws:
ParseException

DoctypeDeclaration

public final void DoctypeDeclaration()
                              throws ParseException
Throws:
ParseException

DoctypeExternalId

public final void DoctypeExternalId()
                             throws ParseException
Throws:
ParseException