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