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


Java Token.SCRIPT属性代码示例

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


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

示例1: extractArguments

/**
 * @param context
 * @param aggregateExpression
 * @param callNode
 * @throws DataException
 */
private void extractArguments( Context context,
		AggregateExpression aggregateExpression, Node callNode )
		throws DataException
{
	Node arg = callNode.getFirstChild().getNext();
	
	while( arg != null )
	{
		// need to hold on to the next argument because the tree extraction 
		// will cause us to lose the reference otherwise
		Node nextArg = arg.getNext();
		
		CompiledExpression expr = processChild( context,
				false,
				callNode,
				arg,
				null );
		if( ! ( expr instanceof BytecodeExpression ) )
		{
			aggregateExpression.addArgument( expr );
			arg = nextArg;
			continue;
		}
		
		AstRoot tree = new AstRoot( Token.SCRIPT );
		Node exprNode = new Node( Token.EXPR_RESULT);
		exprNode.addChildToFront( arg );
		tree.addChildrenToFront( exprNode );
		compileForBytecodeExpr( context, tree, expr );
		aggregateExpression.addArgument( expr );
		
		arg = nextArg;
	}
}
 
开发者ID:eclipse,项目名称:birt,代码行数:40,代码来源:ExpressionCompiler.java

示例2: extractArguments

/**
 * parse the aggregate expression's arguments
 * 
 * @param context
 * @param aggregateExpression
 * @param callNode
 * @throws DataException
 */
private void extractArguments( Context context,
		AggregateExpression aggregateExpression, Node callNode )
		throws DataException
{
	Node arg = callNode.getFirstChild( ).getNext( );
					
	while ( arg != null )
	{
		// need to hold on to the next argument because the tree extraction
		// will cause us to lose the reference otherwise
		Node nextArg = arg.getNext( );
		CompiledExpression expr = processChild( context,
				true,
				callNode,
				arg,
				null );
		if ( !( expr instanceof BytecodeExpression ) )
		{
			aggregateExpression.addArgument( expr );
			arg = nextArg;
			continue;
		}

		AstRoot tree = new AstRoot( Token.SCRIPT );
		Node exprNode = new Node( Token.EXPR_RESULT );
		exprNode.addChildToFront( arg );
		tree.addChildrenToFront( exprNode );
		if ( expr instanceof AggregateExpression )
		{
			int registry = getRegisterId( new AggregateObject( (AggregateExpression) expr ) );
			if ( registry >= 0 )
				replaceAggregateNode( registry, exprNode, arg );
		}
		
		compileForBytecodeExpr( context, tree, expr );
		aggregateExpression.addArgument( expr );
		arg = nextArg;
	}
}
 
开发者ID:eclipse,项目名称:birt,代码行数:47,代码来源:MultiPassExpressionCompiler.java

示例3: CompiledExprFromTree

/**
 * compile the expression from a script tree
 * 
 * @param expression
 * @param context
 * @param tree
 * @param columnExprList
 * @throws BirtException
 */
private void CompiledExprFromTree( String expression, Context context,
		ScriptNode tree, List columnExprList ) throws BirtException
{
	if ( tree.getFirstChild( ) == tree.getLastChild( ) )
	{
		if ( tree.getFirstChild( ).getType( ) == Token.FUNCTION )
		{
			int index = getFunctionIndex( tree.getFirstChild( ).getString( ),
					tree );
			compileFunctionNode( tree.getFunctionNode( index ),
					tree,
					columnExprList );
		}
		else
		{
			// A single expression
			if ( tree.getFirstChild( ).getType( ) != Token.EXPR_RESULT
					&& tree.getFirstChild( ).getType( ) != Token.EXPR_VOID
					&& tree.getFirstChild( ).getType( ) != Token.BLOCK
					&& tree.getFirstChild( ).getType( ) != Token.SCRIPT)
			{
				// This should never happen?
				throw new CoreException( pluginId,
						ResourceConstants.INVALID_EXPRESSION );
			}
			Node exprNode = tree.getFirstChild( );
			processChild( exprNode, tree, columnExprList );
		}
	}
	else
	{
		compileComplexExpr( tree, tree, columnExprList );
	}
}
 
开发者ID:eclipse,项目名称:birt,代码行数:43,代码来源:ExpressionParserUtility.java


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