All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.sourceforge.pmd.lang.jsp.ast.Jsp.jj Maven / Gradle / Ivy

/*@bgen(jjtree) Generated By:JJTree: Do not edit this line. Jsp.jj */
/*@egen*//*
 * Allow boolean attributes
 *
 * Juan Mart\u00edn Sotuyo Dodero 06/2017
 *====================================================================
 * Added capability for Tracking Tokens.
 *
 * Amit Kumar Prasad 10/2015
 *====================================================================
 * JSP Parser for PMD.
 * It supports supports more-or-less well written JSP files.
 * The JSP Document style is supported, except for inline DTD.
 * The JSP Page style (<% ... %>) is supported.
 * Java code is not parsed.
 * Script code inside  is not parsed.
 */

options {
	USER_CHAR_STREAM = true;
	                      
	UNICODE_INPUT=true;
	FORCE_LA_CHECK = false;
	IGNORE_CASE = true;
	STATIC = false;

	           
	             
}

PARSER_BEGIN(JspParserImpl)
package net.sourceforge.pmd.lang.jsp.ast;

/**
 * JSP Parser for PMD.
 * @author Pieter, Application Engineers NV/SA, http://www.ae.be
 * @deprecated Since 7.5.0. JspParserImpl should have been package private because this is an implementation class
 * that should not be used directly.
 */
@Deprecated
public class JspParserImpl/*@bgen(jjtree)*/implements JspParserImplTreeConstants/*@egen*/ {/*@bgen(jjtree)*/
  protected JJTJspParserImplState jjtree = new JJTJspParserImplState();

/*@egen*/


	/**
	* Counter used to keep track of unclosed tags
	*/
	private OpenTagRegister tagRegister = new OpenTagRegister();

	/**
	 * Return the contents of a quote.
	 * @param quote String - starting and ending with " or '
	 * @return String a substring of quote: quote without the first and list
	 * character.
	 */
	private static String quoteContent(String quote) {
		return quote.substring(1, quote.length()-1);
	}

	/**
	 * Return the contents of a EL expression or a Value Binding expression.
	 * @param expression String - starting with ${ or #{ and ending with }
	 * @return String a substring of expression: expression without the first two and list
	 * characters.
	 */
	private static String expressionContent(String expression) {
		return expression.substring(2, expression.length()-1).trim();
	}
}

PARSER_END(JspParserImpl)


/** ******************************************************************** */
/** *************************  JSP LEXICON  **************************** */
/** ******************************************************************** */


/* This JavaCC lexicon has the following states:
 * - StartTagState : this is the state entered after the "<" of a tag, until a
 *    non-whitespace is found.
 *    This is only for tags, not for xml-comments, declarations, etc.
 * - AfterTagState : this is the state entered after the closing ">" of a tag,
 *    or xml-comment or declaration, until some non-whitespace is found
 * - CommentState : the state between ""
 * - DeclarationState : the state between ""
 * - CDataState : the state between ""
 * - InTagState : the state when inside a tag
 * - AttrValueStatue : the state when starting an attribute value, before the starting single or double quote
 * - DocTypeState : the state when inside a doctype declaration
 * - ElExpressionState : the state when inside a ElExpression
 * - DocTypeState : inside a document type declaration
 * - DocTypeExternalIdState : inside an "external id" part of a dtd
 * - AttrValueBetweenSingleQuotesState : inside an attribute that is surrounded by single quotes (')
 * - AttrValueBetweenDoubleQuotesState : inside an attribute that is surrounded by double quotes (")
 * - JspDirectiveState : inside a JSP directive not yet reaching the attributes of the directive
 * - JspDirectiveAttributesState : inside the attributes part of a directive
 * - JspScriptletState : inside a scriptlet <% ... %>
 * - JspExpressionState : inside an expression <%= ... %>
 * - JspDeclarationState : inside a declaration <%! ... %>
 * - JspCommentState : inside a comment <%-- ... --%>
 * - HtmlScriptContentState : inside an HTML script 
 */


<*> TOKEN :
{
  <#ALPHA_CHAR: [
       "$",
       "A"-"Z",
       "_",
       "a"-"z",
       "\u00c0"-"\u00d6",
       "\u00d8"-"\u00f6",
       "\u00f8"-"\u00ff"
      ] >
| <#NUM_CHAR:   [
       "0"-"9"
      ] >
| <#ALPHANUM_CHAR: (  |  ) >
| <#IDENTIFIER_CHAR: (  | [ "_", "-", ".", ":" ] ) >
| <#IDENTIFIER:  ()* >
| <#XMLNAME: ( | "_" | ":") ()* >
| <#QUOTED_STRING_NO_BREAKS: ( "'" ( ~["'", "\r", "\n"] )* "'" ) 
                    | ( "\"" ( ~["\"", "\r", "\n"] )* "\"" ) >
| <#QUOTED_STRING: ( "'" ( ~["'"] )* "'" ) | ( "\"" ( ~["\""] )* "\"" ) >
| <#WHITESPACE: ( " " | "\t" | "\n" | "\r" ) >
| <#NEWLINE:    ( "\r\n" | "\r" | "\n" ) >
| <#QUOTE:      ( "'" | "\"" )>
| <#NO_WHITESPACE_OR_LT_OR_DOLLAR: (~[" ", "\t", "\n", "\r", "<", "$", "#"])>
| <#DOLLAR_OR_HASH: ("$" | "#")>
| <#NO_OPENBRACE: (~["{"]) >
| <#NO_LT_OR_DOLLAR_OR_HASH: (~["<","$","#"])>
| <#NO_ENDTAG_START: (~["<"]~["/"]) >
| <#TEXT_IN_EL: (~["}", "'", "\""])+ >
| <#EL_ESCAPE: ("\\${" | "\\#{") >

	// anything but --%>
| <#NO_JSP_COMMENT_END: (~["-"] | "-" ~["-"] | "--" ~["%"] | "--%" ~[">"])+ > 
| <#NO_JSP_TAG_END: ( ~["%"] | ("%" ~[">"]) )+ >
| <#NO_JSP_TAG_END_EXCEPT_QUOTED: ( ~["%", "\"", "'"] | ("%" ~[">"]) |  )+ >
}


 SKIP :
{
  < ()+ >
}

 SPECIAL_TOKEN :
{
  < ()+ >
}

 TOKEN : 
{
   	: StartTagState
|  	: StartTagState
|  	: CommentState
| 	: StartTagState
| 	: DocTypeState
|    : CDataState
|    : JspCommentState
|    : JspDeclarationState
| 	: JspScriptletState
|  	: JspDirectiveState
|    : InTagState
}

 TOKEN :
{	
	 | )* "}")
						|
					("#{" ( | )* "}")
					>
|	|
					  |
					  )+ >
}

 TOKEN :
{
	 > : JspDirectiveAttributesState
}

 TOKEN :
{
	 >
|	" > : AfterTagState
}

 TOKEN :
{
	" > : AfterTagState
|	 >
}

 TOKEN :
{
	" > : AfterTagState
|	 >
}

 TOKEN :
{
	" > : AfterTagState
|	 >
}

 TOKEN : 
{
	" > : AfterTagState
|	 >
}

 TOKEN : 
{
	)+ >
}

 TOKEN:
{
	) > : DocTypeExternalIdState
}

 TOKEN:
{
	
|	
|	" > : AfterTagState
|	) >
}


 TOKEN :
{
	
  | ") > : AfterTagState
}

 TOKEN :
{
   > : InTagState
|           : DEFAULT
}

 TOKEN :
{
   | "${" ( | )* "}") >
| "            >            : AfterTagState
| " | "!>") >            : AfterTagState
| " >                 : AfterTagState
|  : AttrValueBetweenSingleQuotesState
|  : AttrValueBetweenDoubleQuotesState
|  { input_stream.backup(1);} : AttrValueNoQuotesState
|  : InTagState //support for empty attributes
}

 TOKEN:
{
	 | )* "}" >
|	 | )* "}" >
|	" >
}

 TOKEN :
{
     : InTagState
|     )+ >

}

 TOKEN :
{
	 : InTagState
|	 )+ >
|	 : InTagState
}

 TOKEN :
{
	 : InTagState
|	 )+ >
|	 : InTagState
}

 TOKEN : 
{
  < COMMENT_END:  ("--" (" ")* ">" | "->") > : AfterTagState 
| < COMMENT_TEXT: (~[]) >
}

 TOKEN :
{
		 
		|   : AfterTagState
}

/** ******************************************************************** */
/** *************************  JSP GRAMMAR  **************************** */
/** ******************************************************************** */

/**
 * The root of the AST of a JSP.
 */
ASTCompilationUnit CompilationUnit() :
{/*@bgen(jjtree) CompilationUnit */
  ASTCompilationUnit jjtn000 = new ASTCompilationUnit(JJTCOMPILATIONUNIT);
  boolean jjtc000 = true;
  jjtree.openNodeScope(jjtn000);
/*@egen*/}
{/*@bgen(jjtree) CompilationUnit */
  try {
/*@egen*/
  Prolog()
  
  Content() /*@bgen(jjtree)*/
  {
    jjtree.closeNodeScope(jjtn000, true);
    jjtc000 = false;
  }
/*@egen*/ 
  { return jjtn000; }/*@bgen(jjtree)*/
  } catch (Throwable jjte000) {
    if (jjtc000) {
      jjtree.clearNodeScope(jjtn000);
      jjtc000 = false;
    } else {
      jjtree.popNode();
    }
    if (jjte000 instanceof RuntimeException) {
      throw (RuntimeException)jjte000;
    }
    if (jjte000 instanceof net.sourceforge.pmd.lang.ast.ParseException) {
      throw (net.sourceforge.pmd.lang.ast.ParseException)jjte000;
    }
    throw (Error)jjte000;
  } finally {
    if (jjtc000) {
      jjtree.closeNodeScope(jjtn000, true);
    }
  }
/*@egen*/
}

/**
 * The optional prolog of a JSP, including (xml) declarations and DTD.
 */
void Prolog()       :
{}
{
	(
    	LOOKAHEAD( ( CommentTag() | JspComment() )* 	Declaration() )
    	( CommentTag() | JspComment() )*
	  	Declaration()
	)?
	
    (
    	LOOKAHEAD( ( CommentTag() | JspComment() )* 	DoctypeDeclaration() )
    	( CommentTag() | JspComment() )*
	    DoctypeDeclaration()
	)?
}

/**
 * Everything between a start-tag and the corresponding end-tag of an element (if an end tag exists).
 */
void Content() :
{/*@bgen(jjtree) Content */
  ASTContent jjtn000 = new ASTContent(JJTCONTENT);
  boolean jjtc000 = true;
  jjtree.openNodeScope(jjtn000);
/*@egen*/}
{/*@bgen(jjtree) Content */
        try {
/*@egen*/ 
	( Text() | ContentElement()	)*/*@bgen(jjtree)*/
        } catch (Throwable jjte000) {
          if (jjtc000) {
            jjtree.clearNodeScope(jjtn000);
            jjtc000 = false;
          } else {
            jjtree.popNode();
          }
          if (jjte000 instanceof RuntimeException) {
            throw (RuntimeException)jjte000;
          }
          if (jjte000 instanceof net.sourceforge.pmd.lang.ast.ParseException) {
            throw (net.sourceforge.pmd.lang.ast.ParseException)jjte000;
          }
          throw (Error)jjte000;
        } finally {
          if (jjtc000) {
            jjtree.closeNodeScope(jjtn000, true);
          }
        }
/*@egen*/
}

/**
 * A single (non-text) element that can occur between a start-tag and end-tag of an element.
 * 
 */
void ContentElement()       :
{}
{
	( 
		CommentTag() 
	  |	Element() 
	  | CData() 
	  | JspComment() 
	  | JspDeclaration() 
	  | JspExpression() 
	  | JspScriptlet()
	  | JspDirective() 
      | HtmlScript()
	)
}

void JspDirective() :
{/*@bgen(jjtree) JspDirective */
        ASTJspDirective jjtn000 = new ASTJspDirective(JJTJSPDIRECTIVE);
        boolean jjtc000 = true;
        jjtree.openNodeScope(jjtn000);
/*@egen*/ 	net.sourceforge.pmd.lang.ast.impl.javacc.JavaccToken t; }
{/*@bgen(jjtree) JspDirective */
        try {
/*@egen*/
	
	t =  { jjtn000.setName(t.getImage()); }
	
	(
		JspDirectiveAttribute()
	)*
	/*@bgen(jjtree)*/
        } catch (Throwable jjte000) {
          if (jjtc000) {
            jjtree.clearNodeScope(jjtn000);
            jjtc000 = false;
          } else {
            jjtree.popNode();
          }
          if (jjte000 instanceof RuntimeException) {
            throw (RuntimeException)jjte000;
          }
          if (jjte000 instanceof net.sourceforge.pmd.lang.ast.ParseException) {
            throw (net.sourceforge.pmd.lang.ast.ParseException)jjte000;
          }
          throw (Error)jjte000;
        } finally {
          if (jjtc000) {
            jjtree.closeNodeScope(jjtn000, true);
          }
        }
/*@egen*/
}

void JspDirectiveAttribute() : 
{/*@bgen(jjtree) JspDirectiveAttribute */
        ASTJspDirectiveAttribute jjtn000 = new ASTJspDirectiveAttribute(JJTJSPDIRECTIVEATTRIBUTE);
        boolean jjtc000 = true;
        jjtree.openNodeScope(jjtn000);
/*@egen*/	net.sourceforge.pmd.lang.ast.impl.javacc.JavaccToken t; }
{/*@bgen(jjtree) JspDirectiveAttribute */
        try {
/*@egen*/
	t =  { jjtn000.setName(t.getImage()); }
	
	t = /*@bgen(jjtree)*/
                                            {
                                              jjtree.closeNodeScope(jjtn000, true);
                                              jjtc000 = false;
                                            }
/*@egen*/ { jjtn000.setValue(quoteContent(t.getImage())); }/*@bgen(jjtree)*/
        } finally {
          if (jjtc000) {
            jjtree.closeNodeScope(jjtn000, true);
          }
        }
/*@egen*/
}

void JspScriptlet() :
{/*@bgen(jjtree) JspScriptlet */
        ASTJspScriptlet jjtn000 = new ASTJspScriptlet(JJTJSPSCRIPTLET);
        boolean jjtc000 = true;
        jjtree.openNodeScope(jjtn000);
/*@egen*/	net.sourceforge.pmd.lang.ast.impl.javacc.JavaccToken t; }
{/*@bgen(jjtree) JspScriptlet */
        try {
/*@egen*/
	
	t =  { jjtn000.setContent(t.getImage().trim()); }
	/*@bgen(jjtree)*/
        } finally {
          if (jjtc000) {
            jjtree.closeNodeScope(jjtn000, true);
          }
        }
/*@egen*/
}

void JspExpression() :
{/*@bgen(jjtree) JspExpression */
        ASTJspExpression jjtn000 = new ASTJspExpression(JJTJSPEXPRESSION);
        boolean jjtc000 = true;
        jjtree.openNodeScope(jjtn000);
/*@egen*/	net.sourceforge.pmd.lang.ast.impl.javacc.JavaccToken t; }
{/*@bgen(jjtree) JspExpression */
        try {
/*@egen*/
	
	t =  { jjtn000.setContent(t.getImage().trim()); }
	/*@bgen(jjtree)*/
        } finally {
          if (jjtc000) {
            jjtree.closeNodeScope(jjtn000, true);
          }
        }
/*@egen*/
}

void JspDeclaration() :
{/*@bgen(jjtree) JspDeclaration */
        ASTJspDeclaration jjtn000 = new ASTJspDeclaration(JJTJSPDECLARATION);
        boolean jjtc000 = true;
        jjtree.openNodeScope(jjtn000);
/*@egen*/	net.sourceforge.pmd.lang.ast.impl.javacc.JavaccToken t; }
{/*@bgen(jjtree) JspDeclaration */
        try {
/*@egen*/
	
	t =  { jjtn000.setContent(t.getImage().trim()); }
	/*@bgen(jjtree)*/
        } finally {
          if (jjtc000) {
            jjtree.closeNodeScope(jjtn000, true);
          }
        }
/*@egen*/
}

void JspComment() :
{/*@bgen(jjtree) JspComment */
        ASTJspComment jjtn000 = new ASTJspComment(JJTJSPCOMMENT);
        boolean jjtc000 = true;
        jjtree.openNodeScope(jjtn000);
/*@egen*/ 	net.sourceforge.pmd.lang.ast.impl.javacc.JavaccToken t; }
{/*@bgen(jjtree) JspComment */
        try {
/*@egen*/
	
	t =  { jjtn000.setContent(t.getImage().trim()); }
	/*@bgen(jjtree)*/
        } finally {
          if (jjtc000) {
            jjtree.closeNodeScope(jjtn000, true);
          }
        }
/*@egen*/
}

/**
 * This production groups all characters between two tags, where
 * tag is an xml-tag "<...>" or a jsp-page-tag "<%...%>" or CDATA "<![CDATA[...]]>".
 * Text consists of unparsed text and/or Expression Language expressions.
 */
void Text() :
{/*@bgen(jjtree) Text */
        ASTText jjtn000 = new ASTText(JJTTEXT);
        boolean jjtc000 = true;
        jjtree.openNodeScope(jjtn000);
/*@egen*/
	StringBuilder content = new StringBuilder();
	String tmp;
}
{/*@bgen(jjtree) Text */
          try {
/*@egen*/	 
	  (	
	  	tmp = UnparsedText() { content.append(tmp); }
	  | tmp = ElExpression() { content.append(tmp); }
	  )+/*@bgen(jjtree)*/
                {
                  jjtree.closeNodeScope(jjtn000, true);
                  jjtc000 = false;
                }
/*@egen*/
		{jjtn000.setContent(content.toString());}/*@bgen(jjtree)*/
          } catch (Throwable jjte000) {
            if (jjtc000) {
              jjtree.clearNodeScope(jjtn000);
              jjtc000 = false;
            } else {
              jjtree.popNode();
            }
            if (jjte000 instanceof RuntimeException) {
              throw (RuntimeException)jjte000;
            }
            if (jjte000 instanceof net.sourceforge.pmd.lang.ast.ParseException) {
              throw (net.sourceforge.pmd.lang.ast.ParseException)jjte000;
            }
            throw (Error)jjte000;
          } finally {
            if (jjtc000) {
              jjtree.closeNodeScope(jjtn000, true);
            }
          }
/*@egen*/
	  
}

String UnparsedText() :
{/*@bgen(jjtree) UnparsedText */
  ASTUnparsedText jjtn000 = new ASTUnparsedText(JJTUNPARSEDTEXT);
  boolean jjtc000 = true;
  jjtree.openNodeScope(jjtn000);
/*@egen*/ net.sourceforge.pmd.lang.ast.impl.javacc.JavaccToken t; }
{/*@bgen(jjtree) UnparsedText */
        try {
/*@egen*/   
	t = /*@bgen(jjtree)*/
        {
          jjtree.closeNodeScope(jjtn000, true);
          jjtc000 = false;
        }
/*@egen*/ 
	{
		jjtn000.setContent(t.getImage());
		return t.getImage();
	}/*@bgen(jjtree)*/
        } finally {
          if (jjtc000) {
            jjtree.closeNodeScope(jjtn000, true);
          }
        }
/*@egen*/
}

String UnparsedTextNoWhitespace()               :
{/*@bgen(jjtree) UnparsedText */
  ASTUnparsedText jjtn000 = new ASTUnparsedText(JJTUNPARSEDTEXT);
  boolean jjtc000 = true;
  jjtree.openNodeScope(jjtn000);
/*@egen*/ net.sourceforge.pmd.lang.ast.impl.javacc.JavaccToken t;}
{/*@bgen(jjtree) UnparsedText */
  try {
/*@egen*/
  (
    t = 
  )/*@bgen(jjtree)*/
  {
    jjtree.closeNodeScope(jjtn000, true);
    jjtc000 = false;
  }
/*@egen*/
  {
		jjtn000.setContent(t.getImage());
		return t.getImage();
  }/*@bgen(jjtree)*/
  } finally {
    if (jjtc000) {
      jjtree.closeNodeScope(jjtn000, true);
    }
  }
/*@egen*/
}

  

/**
 * Text that contains no single quotes, and that does not contain the start
 * of a EL expression or value binding.
 */
String UnparsedTextNoSingleQuotes()               : 
{/*@bgen(jjtree) UnparsedText */
  ASTUnparsedText jjtn000 = new ASTUnparsedText(JJTUNPARSEDTEXT);
  boolean jjtc000 = true;
  jjtree.openNodeScope(jjtn000);
/*@egen*/ net.sourceforge.pmd.lang.ast.impl.javacc.JavaccToken t; }
{/*@bgen(jjtree) UnparsedText */
        try {
/*@egen*/
	t = /*@bgen(jjtree)*/
        {
          jjtree.closeNodeScope(jjtn000, true);
          jjtc000 = false;
        }
/*@egen*/ 
	{ 
		jjtn000.setContent(t.getImage());
		return t.getImage();
	}/*@bgen(jjtree)*/
        } finally {
          if (jjtc000) {
            jjtree.closeNodeScope(jjtn000, true);
          }
        }
/*@egen*/
}

/**
 * Text that contains no double quotes, and that does not contain the start
 * of a EL expression or value binding.
 */
String UnparsedTextNoDoubleQuotes()               : 
{/*@bgen(jjtree) UnparsedText */
  ASTUnparsedText jjtn000 = new ASTUnparsedText(JJTUNPARSEDTEXT);
  boolean jjtc000 = true;
  jjtree.openNodeScope(jjtn000);
/*@egen*/ net.sourceforge.pmd.lang.ast.impl.javacc.JavaccToken t; }
{/*@bgen(jjtree) UnparsedText */
        try {
/*@egen*/
	t = /*@bgen(jjtree)*/
        {
          jjtree.closeNodeScope(jjtn000, true);
          jjtc000 = false;
        }
/*@egen*/ 
	{ 
		jjtn000.setContent(t.getImage());
		return t.getImage();
	}/*@bgen(jjtree)*/
        } finally {
          if (jjtc000) {
            jjtree.closeNodeScope(jjtn000, true);
          }
        }
/*@egen*/
}

/**
 * An EL expression, not within an attribute value.
 */
String ElExpression() :
{/*@bgen(jjtree) ElExpression */
        ASTElExpression jjtn000 = new ASTElExpression(JJTELEXPRESSION);
        boolean jjtc000 = true;
        jjtree.openNodeScope(jjtn000);
/*@egen*/ 	net.sourceforge.pmd.lang.ast.impl.javacc.JavaccToken t; }
{/*@bgen(jjtree) ElExpression */
        try {
/*@egen*/
	t = /*@bgen(jjtree)*/
        {
          jjtree.closeNodeScope(jjtn000, true);
          jjtc000 = false;
        }
/*@egen*/ 
	{ 
		jjtn000.setContent(expressionContent(t.getImage()));
		return t.getImage();
	}/*@bgen(jjtree)*/
        } finally {
          if (jjtc000) {
            jjtree.closeNodeScope(jjtn000, true);
          }
        }
/*@egen*/
}

String ValueBindingInAttribute()               :
{/*@bgen(jjtree) ValueBinding */
        ASTValueBinding jjtn000 = new ASTValueBinding(JJTVALUEBINDING);
        boolean jjtc000 = true;
        jjtree.openNodeScope(jjtn000);
/*@egen*/	net.sourceforge.pmd.lang.ast.impl.javacc.JavaccToken t; }
{/*@bgen(jjtree) ValueBinding */
        try {
/*@egen*/
	t = /*@bgen(jjtree)*/
        {
          jjtree.closeNodeScope(jjtn000, true);
          jjtc000 = false;
        }
/*@egen*/ 
	{ 
		jjtn000.setContent(expressionContent(t.getImage()));
		return t.getImage();
	}/*@bgen(jjtree)*/
        } finally {
          if (jjtc000) {
            jjtree.closeNodeScope(jjtn000, true);
          }
        }
/*@egen*/
}

String ElExpressionInAttribute()               :
{/*@bgen(jjtree) ElExpression */
        ASTElExpression jjtn000 = new ASTElExpression(JJTELEXPRESSION);
        boolean jjtc000 = true;
        jjtree.openNodeScope(jjtn000);
/*@egen*/	net.sourceforge.pmd.lang.ast.impl.javacc.JavaccToken t; }
{/*@bgen(jjtree) ElExpression */
        try {
/*@egen*/
	t = /*@bgen(jjtree)*/
        {
          jjtree.closeNodeScope(jjtn000, true);
          jjtc000 = false;
        }
/*@egen*/ 
	{ 
		jjtn000.setContent(expressionContent(t.getImage()));
		return t.getImage();
	}/*@bgen(jjtree)*/
        } finally {
          if (jjtc000) {
            jjtree.closeNodeScope(jjtn000, true);
          }
        }
/*@egen*/
}

void CData() :
{/*@bgen(jjtree) CData */
        ASTCData jjtn000 = new ASTCData(JJTCDATA);
        boolean jjtc000 = true;
        jjtree.openNodeScope(jjtn000);
/*@egen*/
	StringBuilder content = new StringBuilder();
	net.sourceforge.pmd.lang.ast.impl.javacc.JavaccToken t;
}
{/*@bgen(jjtree) CData */
        try {
/*@egen*/
	 ( t =   { content.append(t.getImage()); } )* /*@bgen(jjtree)*/
        {
          jjtree.closeNodeScope(jjtn000, true);
          jjtc000 = false;
        }
/*@egen*/
	{
		jjtn000.setContent(content.toString());
	}/*@bgen(jjtree)*/
        } finally {
          if (jjtc000) {
            jjtree.closeNodeScope(jjtn000, true);
          }
        }
/*@egen*/
}

/**
 * A XML element, either with a single empty tag, or with a starting and closing tag
 * with optional contained content.
 */
void Element() :
{/*@bgen(jjtree) Element */
        ASTElement jjtn000 = new ASTElement(JJTELEMENT);
        boolean jjtc000 = true;
        jjtree.openNodeScope(jjtn000);
/*@egen*/
	net.sourceforge.pmd.lang.ast.impl.javacc.JavaccToken startTag;
	net.sourceforge.pmd.lang.ast.impl.javacc.JavaccToken endTag;
	String tagName;
}
{/*@bgen(jjtree) Element */
    try {
/*@egen*/
    (
	      (
	         
	    	startTag =  { tagName = startTag.getImage();
	    							jjtn000.setName(tagName);
	    							tagRegister.openTag(jjtn000);
	    							}
	   	  )
	      (Attribute())*
	      ( 
	    	(
	    	  { jjtn000.setEmpty(false);}

		   	 (Content())
		    	
			 ( 
			  endTag =  {tagRegister.closeTag(endTag.getImage());}
		      )?
	    	)
	   		|  
	     	(/*@bgen(jjtree)*/
                                {
                                  jjtree.closeNodeScope(jjtn000, true);
                                  jjtc000 = false;
                                }
/*@egen*/ { jjtn000.setEmpty(true);
	     					  jjtn000.setUnclosed(false);
	     					}
	     	)  
	      )
   )/*@bgen(jjtree)*/
    } catch (Throwable jjte000) {
      if (jjtc000) {
        jjtree.clearNodeScope(jjtn000);
        jjtc000 = false;
      } else {
        jjtree.popNode();
      }
      if (jjte000 instanceof RuntimeException) {
        throw (RuntimeException)jjte000;
      }
      if (jjte000 instanceof net.sourceforge.pmd.lang.ast.ParseException) {
        throw (net.sourceforge.pmd.lang.ast.ParseException)jjte000;
      }
      throw (Error)jjte000;
    } finally {
      if (jjtc000) {
        jjtree.closeNodeScope(jjtn000, true);
      }
    }
/*@egen*/
}

void Attribute() : 
{/*@bgen(jjtree) Attribute */
        ASTAttribute jjtn000 = new ASTAttribute(JJTATTRIBUTE);
        boolean jjtc000 = true;
        jjtree.openNodeScope(jjtn000);
/*@egen*/	net.sourceforge.pmd.lang.ast.impl.javacc.JavaccToken t; }
{/*@bgen(jjtree) Attribute */
  try {
/*@egen*/
  t =  { jjtn000.setName(t.getImage()); }
  (
  	 
  	AttributeValue()
  )?/*@bgen(jjtree)*/
  } catch (Throwable jjte000) {
    if (jjtc000) {
      jjtree.clearNodeScope(jjtn000);
      jjtc000 = false;
    } else {
      jjtree.popNode();
    }
    if (jjte000 instanceof RuntimeException) {
      throw (RuntimeException)jjte000;
    }
    if (jjte000 instanceof net.sourceforge.pmd.lang.ast.ParseException) {
      throw (net.sourceforge.pmd.lang.ast.ParseException)jjte000;
    }
    throw (Error)jjte000;
  } finally {
    if (jjtc000) {
      jjtree.closeNodeScope(jjtn000, true);
    }
  }
/*@egen*/
}

/**
 * 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.
 */
void AttributeValue() : 
{/*@bgen(jjtree) AttributeValue */
        ASTAttributeValue jjtn000 = new ASTAttributeValue(JJTATTRIBUTEVALUE);
        boolean jjtc000 = true;
        jjtree.openNodeScope(jjtn000);
/*@egen*/
	StringBuilder content = new StringBuilder();
	String tmp;
	net.sourceforge.pmd.lang.ast.impl.javacc.JavaccToken t = null ;
}
{/*@bgen(jjtree) AttributeValue */
        try {
/*@egen*/
  	(
	  	( 	
		  	( (	tmp = UnparsedTextNoDoubleQuotes() 
			  |	tmp = QuoteIndependentAttributeValueContent()
			) { content.append(tmp); } )*
			( 	 
			  |	t =  { content.append(t.getImage().substring(0, 1)); }
			) 
		)
		|
	  	( 	
		  	( ( tmp = UnparsedTextNoSingleQuotes() | tmp = QuoteIndependentAttributeValueContent() )
		  	{ content.append(tmp); } )*
			( 	 
			  | t =   { content.append(t.getImage().substring(0, 1)); }
			 ) 
		)
		|
	  	( 
		  	( ( tmp = UnparsedTextNoWhitespace() | tmp = QuoteIndependentAttributeValueContent() )
		  		{ content.append(tmp); }
		  	)*
			(  ) 
		)
		|  
	)/*@bgen(jjtree)*/
        {
          jjtree.closeNodeScope(jjtn000, true);
          jjtc000 = false;
        }
/*@egen*/
	{ jjtn000.setValue( content.toString() );
	}/*@bgen(jjtree)*/
        } catch (Throwable jjte000) {
          if (jjtc000) {
            jjtree.clearNodeScope(jjtn000);
            jjtc000 = false;
          } else {
            jjtree.popNode();
          }
          if (jjte000 instanceof RuntimeException) {
            throw (RuntimeException)jjte000;
          }
          if (jjte000 instanceof net.sourceforge.pmd.lang.ast.ParseException) {
            throw (net.sourceforge.pmd.lang.ast.ParseException)jjte000;
          }
          throw (Error)jjte000;
        } finally {
          if (jjtc000) {
            jjtree.closeNodeScope(jjtn000, true);
          }
        }
/*@egen*/
}

/**
 * Partial content of an attribute value that can contain all quotes.
 * This groups EL expressions, value bindings, and JSP expressions.
 */
String QuoteIndependentAttributeValueContent()       :
{ 	String tmp; }
{
	(	tmp = ElExpressionInAttribute()
	| 	tmp = ValueBindingInAttribute()
  	| 	tmp = JspExpressionInAttribute()
	)
	{ return tmp; }
}

String JspExpressionInAttribute() : 
{/*@bgen(jjtree) JspExpressionInAttribute */
        ASTJspExpressionInAttribute jjtn000 = new ASTJspExpressionInAttribute(JJTJSPEXPRESSIONINATTRIBUTE);
        boolean jjtc000 = true;
        jjtree.openNodeScope(jjtn000);
/*@egen*/ 	net.sourceforge.pmd.lang.ast.impl.javacc.JavaccToken t; }
{/*@bgen(jjtree) JspExpressionInAttribute */
        try {
/*@egen*/
	t = /*@bgen(jjtree)*/
        {
          jjtree.closeNodeScope(jjtn000, true);
          jjtc000 = false;
        }
/*@egen*/ 
	{ 
		jjtn000.setContent(t.getImage().substring(3, t.getImage().length()-2).trim()); // without <% and %>
		return t.getImage();
	}/*@bgen(jjtree)*/
        } finally {
          if (jjtc000) {
            jjtree.closeNodeScope(jjtn000, true);
          }
        }
/*@egen*/
}

void CommentTag() :
{/*@bgen(jjtree) CommentTag */
        ASTCommentTag jjtn000 = new ASTCommentTag(JJTCOMMENTTAG);
        boolean jjtc000 = true;
        jjtree.openNodeScope(jjtn000);
/*@egen*/
	StringBuilder content = new StringBuilder();
	net.sourceforge.pmd.lang.ast.impl.javacc.JavaccToken t;
}
{/*@bgen(jjtree) CommentTag */
  try {
/*@egen*/
  
  ( t =  { content.append(t.getImage()); } )* 
  /*@bgen(jjtree)*/
        {
          jjtree.closeNodeScope(jjtn000, true);
          jjtc000 = false;
        }
/*@egen*/
  	{
		jjtn000.setContent(content.toString().trim());
	}/*@bgen(jjtree)*/
  } finally {
    if (jjtc000) {
      jjtree.closeNodeScope(jjtn000, true);
    }
  }
/*@egen*/
}
  
void Declaration() :
{/*@bgen(jjtree) Declaration */
        ASTDeclaration jjtn000 = new ASTDeclaration(JJTDECLARATION);
        boolean jjtc000 = true;
        jjtree.openNodeScope(jjtn000);
/*@egen*/	net.sourceforge.pmd.lang.ast.impl.javacc.JavaccToken t; }
{/*@bgen(jjtree) Declaration */
  try {
/*@egen*/
   
  t =  { jjtn000.setName(t.getImage()); }
  (Attribute())* 
  /*@bgen(jjtree)*/
  } catch (Throwable jjte000) {
    if (jjtc000) {
      jjtree.clearNodeScope(jjtn000);
      jjtc000 = false;
    } else {
      jjtree.popNode();
    }
    if (jjte000 instanceof RuntimeException) {
      throw (RuntimeException)jjte000;
    }
    if (jjte000 instanceof net.sourceforge.pmd.lang.ast.ParseException) {
      throw (net.sourceforge.pmd.lang.ast.ParseException)jjte000;
    }
    throw (Error)jjte000;
  } finally {
    if (jjtc000) {
      jjtree.closeNodeScope(jjtn000, true);
    }
  }
/*@egen*/
}

void DoctypeDeclaration() :
{/*@bgen(jjtree) DoctypeDeclaration */
        ASTDoctypeDeclaration jjtn000 = new ASTDoctypeDeclaration(JJTDOCTYPEDECLARATION);
        boolean jjtc000 = true;
        jjtree.openNodeScope(jjtn000);
/*@egen*/	net.sourceforge.pmd.lang.ast.impl.javacc.JavaccToken t; }
{/*@bgen(jjtree) DoctypeDeclaration */
        try {
/*@egen*/
	
	 
	 t =  { jjtn000.setName(t.getImage()); }
	 ()?
	 (DoctypeExternalId() 	 ()?)? 
 	/*@bgen(jjtree)*/
        } catch (Throwable jjte000) {
          if (jjtc000) {
            jjtree.clearNodeScope(jjtn000);
            jjtc000 = false;
          } else {
            jjtree.popNode();
          }
          if (jjte000 instanceof RuntimeException) {
            throw (RuntimeException)jjte000;
          }
          if (jjte000 instanceof net.sourceforge.pmd.lang.ast.ParseException) {
            throw (net.sourceforge.pmd.lang.ast.ParseException)jjte000;
          }
          throw (Error)jjte000;
        } finally {
          if (jjtc000) {
            jjtree.closeNodeScope(jjtn000, true);
          }
        }
/*@egen*/
}

void DoctypeExternalId() :
{/*@bgen(jjtree) DoctypeExternalId */
        ASTDoctypeExternalId jjtn000 = new ASTDoctypeExternalId(JJTDOCTYPEEXTERNALID);
        boolean jjtc000 = true;
        jjtree.openNodeScope(jjtn000);
/*@egen*/
	net.sourceforge.pmd.lang.ast.impl.javacc.JavaccToken systemLiteral;
	net.sourceforge.pmd.lang.ast.impl.javacc.JavaccToken pubIdLiteral;
}
{/*@bgen(jjtree) DoctypeExternalId */
                try {
/*@egen*/
		(	
			 
			systemLiteral = /*@bgen(jjtree)*/
                                {
                                  jjtree.closeNodeScope(jjtn000, true);
                                  jjtc000 = false;
                                }
/*@egen*/ 
				{ jjtn000.setUri(quoteContent(systemLiteral.getImage())); }
		)
	| 	
		(	
			 
			pubIdLiteral =  
				{ jjtn000.setPublicId(quoteContent(pubIdLiteral.getImage())); }
			 
			systemLiteral = /*@bgen(jjtree)*/
                                {
                                  jjtree.closeNodeScope(jjtn000, true);
                                  jjtc000 = false;
                                }
/*@egen*/ 
				{ jjtn000.setUri(quoteContent(systemLiteral.getImage())); }
		)/*@bgen(jjtree)*/
                } finally {
                  if (jjtc000) {
                    jjtree.closeNodeScope(jjtn000, true);
                  }
                }
/*@egen*/
}

void HtmlScript() :
{/*@bgen(jjtree) HtmlScript */
        ASTHtmlScript jjtn000 = new ASTHtmlScript(JJTHTMLSCRIPT);
        boolean jjtc000 = true;
        jjtree.openNodeScope(jjtn000);
/*@egen*/
	StringBuilder content = new StringBuilder();
	String tagName;
	net.sourceforge.pmd.lang.ast.impl.javacc.JavaccToken t;
}
{/*@bgen(jjtree) HtmlScript */
        try {
/*@egen*/
  	         {}
  	(Attribute() )*             {}
  	(
  	  (
  	   				    {token_source.SwitchTo(HtmlScriptContentState);}
  	   (t =   { content.append(t.getImage()); })*
	   /*@bgen(jjtree)*/
                                                {
                                                  jjtree.closeNodeScope(jjtn000, true);
                                                  jjtc000 = false;
                                                }
/*@egen*/		{ jjtn000.setContent(content.toString().trim());}
	  )
	|
	  (
	    
	  )
	)/*@bgen(jjtree)*/
        } catch (Throwable jjte000) {
          if (jjtc000) {
            jjtree.clearNodeScope(jjtn000);
            jjtc000 = false;
          } else {
            jjtree.popNode();
          }
          if (jjte000 instanceof RuntimeException) {
            throw (RuntimeException)jjte000;
          }
          if (jjte000 instanceof net.sourceforge.pmd.lang.ast.ParseException) {
            throw (net.sourceforge.pmd.lang.ast.ParseException)jjte000;
          }
          throw (Error)jjte000;
        } finally {
          if (jjtc000) {
            jjtree.closeNodeScope(jjtn000, true);
          }
        }
/*@egen*/	
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy