예제 #1
0
 /// <seealso cref="org.apache.velocity.runtime.visitor.BaseVisitor.visit(NVelocity.Runtime.Paser.Node.ASTEscape, java.lang.Object)">
 /// </seealso>
 /// <since> 1.5
 /// </since>
 public override object Visit(ASTEscape node, object data)
 {
     return(ShowNode(node, data));
 }
예제 #2
0
		/// <summary>  Used to catch and process escape sequences in grammatical constructs
		/// as escapes outside of VTL are just characters.  Right now we have both
		/// this and the EscapeDirective() construction because in the EscapeDirective()
		/// case, we want to suck in the #&lt;directive&gt; and here we don't.  We just want
		/// the escapes to render correctly
		/// </summary>
		public void Escape()
		{
			/*@bgen(jjtree) Escape */
			ASTEscape jjtn000 = new ASTEscape(this, ParserTreeConstants.ESCAPE);
			bool jjtc000 = true;
			nodeTree.OpenNodeScope(jjtn000);
			try
			{
				Token t;
				int count = 0;
				bool control = false;
				while(true)
				{
					t = ConsumeToken(ParserConstants.DOUBLE_ESCAPE);
					count++;
					if (jj_2_2(2))
					{
						;
					}
					else
					{
						//UPGRADE_NOTE: Labeled break statement was changed to a goto statement. 'ms-help://MS.VSCC/commoner/redir/redirect.htm?keyword="jlca1012"'
						goto label_2_brk;
					}
				}
				//UPGRADE_NOTE: Label 'label_2_brk' was added. 'ms-help://MS.VSCC/commoner/redir/redirect.htm?keyword="jlca1011"'
				label_2_brk:
				;

				nodeTree.CloseNodeScope(jjtn000, true);
				jjtc000 = false;
				/*
				* first, check to see if we have a control directive
				*/
				switch(t.Next.Kind)
				{
					case ParserConstants.IF_DIRECTIVE:
					case ParserConstants.ELSE_DIRECTIVE:
					case ParserConstants.ELSEIF_DIRECTIVE:
					case ParserConstants.END:
					case ParserConstants.STOP_DIRECTIVE:
						control = true;
						break;
				}

				/*
				* if that failed, lets lookahead to see if we matched a PD or a VM
				*/

				if (IsDirective(t.Next.Image.Substring(1)))
					control = true;
				else if (runtimeServices.IsVelocimacro(t.Next.Image.Substring(1), currentTemplateName))
					control = true;

				t.Image = string.Empty;

				for(int i = 0; i < count; i++)
					t.Image += (control ? "\\" : "\\\\");
			}
			finally
			{
				if (jjtc000)
				{
					nodeTree.CloseNodeScope(jjtn000, true);
				}
			}
		}
예제 #3
0
 /// <seealso cref="NVelocity.Runtime.Paser.Node.ParserVisitor.visit(NVelocity.Runtime.Paser.Node.ASTEscape, java.lang.Object)">
 /// </seealso>
 /// <since> 1.5
 /// </since>
 public virtual object Visit(ASTEscape node, object data)
 {
     data = node.ChildrenAccept(this, data);
     return(data);
 }