Java Code Examples for org.apache.velocity.runtime.parser.node.Node#getColumn()
The following examples show how to use
org.apache.velocity.runtime.parser.node.Node#getColumn() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Evaluate.java From velocity-engine with Apache License 2.0 | 4 votes |
/** * Initialize and check arguments. * @param rs * @param context * @param node * @throws TemplateInitException */ public void init(RuntimeServices rs, InternalContextAdapter context, Node node) throws TemplateInitException { super.init( rs, context, node ); /** * Check that there is exactly one argument and it is a string or reference. */ int argCount = node.jjtGetNumChildren(); if (argCount == 0) { throw new TemplateInitException( "#" + getName() + "() requires exactly one argument", null, rsvc.getLogContext().getStackTrace(), context.getCurrentTemplateName(), node.getColumn(), node.getLine()); } if (argCount > 1) { /* * use line/col of second argument */ throw new TemplateInitException( "#" + getName() + "() requires exactly one argument", null, rsvc.getLogContext().getStackTrace(), context.getCurrentTemplateName(), node.jjtGetChild(1).getColumn(), node.jjtGetChild(1).getLine()); } Node childNode = node.jjtGetChild(0); if ( childNode.getType() != ParserTreeConstants.JJTSTRINGLITERAL && childNode.getType() != ParserTreeConstants.JJTREFERENCE ) { throw new TemplateInitException( "#" + getName() + "() argument must be a string literal or reference", null, rsvc.getLogContext().getStackTrace(), context.getCurrentTemplateName(), childNode.getColumn(), childNode.getLine()); } }
Example 2
Source File: Info.java From velocity-engine with Apache License 2.0 | 4 votes |
public Info(Node node) { this(node.getTemplateName(), node.getLine(), node.getColumn()); }