当前位置: 首页>>代码示例>>C#>>正文


C# INode.jjtGetNumChildren方法代码示例

本文整理汇总了C#中INode.jjtGetNumChildren方法的典型用法代码示例。如果您正苦于以下问题:C# INode.jjtGetNumChildren方法的具体用法?C# INode.jjtGetNumChildren怎么用?C# INode.jjtGetNumChildren使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在INode的用法示例。


在下文中一共展示了INode.jjtGetNumChildren方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: render

	public override bool render(InternalContextAdapter context, TextWriter writer, INode node) {
	    /*
	    *  what is our arg?
	    */
	    INode n = node.jjtGetChild(0);

	    if (n.Type == ParserTreeConstants.JJTSTRINGLITERAL) {
		try {
		    String element = (String) node.jjtGetChild(0).value_Renamed(context);
		    TemplateHandler th = (TemplateHandler) rsvc.getApplicationAttribute("NVelocity.Dvsl.TemplateHandler");

		    th.RegisterMatch(element, (SimpleNode) node.jjtGetChild(node.jjtGetNumChildren() - 1));
		} catch (System.Exception ee) {}}

	    return true;
	}
开发者ID:BackupTheBerlios,项目名称:ch3etah-svn,代码行数:16,代码来源:MatchDirective.cs

示例2: init

	/// <summary>   The major meat of VelocimacroProxy, init() checks the # of arguments, patches the
	/// macro body, renders the macro into an AST, and then inits the AST, so it is ready
	/// for quick rendering.  Note that this is only AST dependant stuff. Not context.
	/// </summary>
	public override void  init(RuntimeServices rs, InternalContextAdapter context, INode node) {
	    base.init(rs, context, node);

	    /*
	    *  how many args did we get?
	    */

	    int i = node.jjtGetNumChildren();

	    /*
	    *  right number of args?
	    */

	    if (NumArgs != i) {
		rsvc.error("VM #" + macroName + ": error : too " + ((NumArgs > i)?"few":"many") + " arguments to macro. Wanted " + NumArgs + " got " + i);

		return ;
	    }

	    /*
	    *  get the argument list to the instance use of the VM
	    */
	    callingArgs = getArgArray(node);

	    /*
	    *  now proxy each arg in the context
	    */
	    setupMacro(callingArgs, callingArgTypes);
	    return ;
	}
开发者ID:BackupTheBerlios,项目名称:ch3etah-svn,代码行数:34,代码来源:VelocimacroProxy.cs

示例3: getArgArray

	/// <summary>   gets the args to the VM from the instance-use AST
	/// </summary>
	private System.String[] getArgArray(INode node) {
	    int numArgs = node.jjtGetNumChildren();

	    System.String[] args = new System.String[numArgs];
	    callingArgTypes = new int[numArgs];

	    /*
	    *  eat the args
	    */
	    int i = 0;
	    Token t = null;
	    Token tLast = null;

	    while (i < numArgs) {
		args[i] = "";
		/*
		*  we want string literalss to lose the quotes.  #foo( "blargh" ) should have 'blargh' patched 
		*  into macro body.  So for each arg in the use-instance, treat the stringlierals specially...
		*/

		callingArgTypes[i] = node.jjtGetChild(i).Type;


		if (false && node.jjtGetChild(i).Type == NVelocity.Runtime.Parser.ParserTreeConstants.JJTSTRINGLITERAL) {
		    args[i] += node.jjtGetChild(i).FirstToken.image.Substring(1, (node.jjtGetChild(i).FirstToken.image.Length - 1) - (1));
		} else {
		    /*
		    *  just wander down the token list, concatenating everything together
		    */
		    t = node.jjtGetChild(i).FirstToken;
		    tLast = node.jjtGetChild(i).LastToken;

		    while (t != tLast) {
			args[i] += t.image;
			t = t.next;
		    }

		    /*
		    *  don't forget the last one... :)
		    */
		    args[i] += t.image;
		}
		i++;
	    }
	    return args;
	}
开发者ID:BackupTheBerlios,项目名称:ch3etah-svn,代码行数:48,代码来源:VelocimacroProxy.cs

示例4: render

	/// <summary>  iterates through the argument list and renders every
	/// argument that is appropriate.  Any non appropriate
	/// arguments are logged, but render() continues.
	/// </summary>
	public override bool render(InternalContextAdapter context, System.IO.TextWriter writer, INode node) {
	    /*
	    *  get our arguments and check them
	    */

	    int argCount = node.jjtGetNumChildren();

	    for (int i = 0; i < argCount; i++) {
		/*
				*  we only handle StringLiterals and References right now
				*/

		INode n = node.jjtGetChild(i);

		if (n.Type == NVelocity.Runtime.Parser.ParserTreeConstants.JJTSTRINGLITERAL || n.Type == NVelocity.Runtime.Parser.ParserTreeConstants.JJTREFERENCE) {
		    if (!renderOutput(n, context, writer))
			outputErrorToStream(writer, "error with arg " + i + " please see log.");
		} else {
		    //UPGRADE_TODO: The equivalent in .NET for method 'java.Object.toString' may return a different value. 'ms-help://MS.VSCC/commoner/redir/redirect.htm?keyword="jlca1043"'
		    rsvc.error("#include() error : invalid argument type : " + n.ToString());
		    outputErrorToStream(writer, "error with arg " + i + " please see log.");
		}
	    }

	    return true;
	}
开发者ID:BackupTheBerlios,项目名称:ch3etah-svn,代码行数:30,代码来源:Include.cs


注:本文中的INode.jjtGetNumChildren方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。