本文整理汇总了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;
}
示例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 ;
}
示例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;
}
示例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;
}