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


Java Token.EXPR_RESULT属性代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: hasSideEffects

@Override
public boolean hasSideEffects()
{
    switch (getType()) {
      case Token.ASSIGN:
      case Token.ASSIGN_ADD:
      case Token.ASSIGN_BITAND:
      case Token.ASSIGN_BITOR:
      case Token.ASSIGN_BITXOR:
      case Token.ASSIGN_DIV:
      case Token.ASSIGN_LSH:
      case Token.ASSIGN_MOD:
      case Token.ASSIGN_MUL:
      case Token.ASSIGN_RSH:
      case Token.ASSIGN_SUB:
      case Token.ASSIGN_URSH:
      case Token.BLOCK:
      case Token.BREAK:
      case Token.CALL:
      case Token.CATCH:
      case Token.CATCH_SCOPE:
      case Token.CONST:
      case Token.CONTINUE:
      case Token.DEC:
      case Token.DELPROP:
      case Token.DEL_REF:
      case Token.DO:
      case Token.ELSE:
      case Token.ENTERWITH:
      case Token.ERROR:         // Avoid cascaded error messages
      case Token.EXPORT:
      case Token.EXPR_RESULT:
      case Token.FINALLY:
      case Token.FUNCTION:
      case Token.FOR:
      case Token.GOTO:
      case Token.IF:
      case Token.IFEQ:
      case Token.IFNE:
      case Token.IMPORT:
      case Token.INC:
      case Token.JSR:
      case Token.LABEL:
      case Token.LEAVEWITH:
      case Token.LET:
      case Token.LETEXPR:
      case Token.LOCAL_BLOCK:
      case Token.LOOP:
      case Token.NEW:
      case Token.REF_CALL:
      case Token.RETHROW:
      case Token.RETURN:
      case Token.RETURN_RESULT:
      case Token.SEMI:
      case Token.SETELEM:
      case Token.SETELEM_OP:
      case Token.SETNAME:
      case Token.SETPROP:
      case Token.SETPROP_OP:
      case Token.SETVAR:
      case Token.SET_REF:
      case Token.SET_REF_OP:
      case Token.SWITCH:
      case Token.TARGET:
      case Token.THROW:
      case Token.TRY:
      case Token.VAR:
      case Token.WHILE:
      case Token.WITH:
      case Token.WITHEXPR:
      case Token.YIELD:
        return true;

      default:
        return false;
    }
}
 
开发者ID:MikaGuraN,项目名称:HL4A,代码行数:77,代码来源:AstNode.java

示例5: hasSideEffects

public boolean hasSideEffects()
{
    switch (getType()) {
      case Token.ASSIGN:
      case Token.ASSIGN_ADD:
      case Token.ASSIGN_BITAND:
      case Token.ASSIGN_BITOR:
      case Token.ASSIGN_BITXOR:
      case Token.ASSIGN_DIV:
      case Token.ASSIGN_LSH:
      case Token.ASSIGN_MOD:
      case Token.ASSIGN_MUL:
      case Token.ASSIGN_RSH:
      case Token.ASSIGN_SUB:
      case Token.ASSIGN_URSH:
      case Token.BLOCK:
      case Token.BREAK:
      case Token.CALL:
      case Token.CATCH:
      case Token.CATCH_SCOPE:
      case Token.CONST:
      case Token.CONTINUE:
      case Token.DEC:
      case Token.DELPROP:
      case Token.DEL_REF:
      case Token.DO:
      case Token.ELSE:
      case Token.ENTERWITH:
      case Token.ERROR:         // Avoid cascaded error messages
      case Token.EXPORT:
      case Token.EXPR_RESULT:
      case Token.FINALLY:
      case Token.FUNCTION:
      case Token.FOR:
      case Token.GOTO:
      case Token.IF:
      case Token.IFEQ:
      case Token.IFNE:
      case Token.IMPORT:
      case Token.INC:
      case Token.JSR:
      case Token.LABEL:
      case Token.LEAVEWITH:
      case Token.LET:
      case Token.LETEXPR:
      case Token.LOCAL_BLOCK:
      case Token.LOOP:
      case Token.NEW:
      case Token.REF_CALL:
      case Token.RETHROW:
      case Token.RETURN:
      case Token.RETURN_RESULT:
      case Token.SEMI:
      case Token.SETELEM:
      case Token.SETELEM_OP:
      case Token.SETNAME:
      case Token.SETPROP:
      case Token.SETPROP_OP:
      case Token.SETVAR:
      case Token.SET_REF:
      case Token.SET_REF_OP:
      case Token.SWITCH:
      case Token.TARGET:
      case Token.THROW:
      case Token.TRY:
      case Token.VAR:
      case Token.WHILE:
      case Token.WITH:
      case Token.WITHEXPR:
      case Token.YIELD:
        return true;

      default:
        return false;
    }
}
 
开发者ID:middle2tw,项目名称:whackpad,代码行数:76,代码来源:AstNode.java

示例6: hasSideEffects

@Override
public boolean hasSideEffects()
  {
      switch (getType()) {
        case Token.ASSIGN:
        case Token.ASSIGN_ADD:
        case Token.ASSIGN_BITAND:
        case Token.ASSIGN_BITOR:
        case Token.ASSIGN_BITXOR:
        case Token.ASSIGN_DIV:
        case Token.ASSIGN_LSH:
        case Token.ASSIGN_MOD:
        case Token.ASSIGN_MUL:
        case Token.ASSIGN_RSH:
        case Token.ASSIGN_SUB:
        case Token.ASSIGN_URSH:
        case Token.BLOCK:
        case Token.BREAK:
        case Token.CALL:
        case Token.CATCH:
        case Token.CATCH_SCOPE:
        case Token.CONST:
        case Token.CONTINUE:
        case Token.DEC:
        case Token.DELPROP:
        case Token.DEL_REF:
        case Token.DO:
        case Token.ELSE:
        case Token.ENTERWITH:
        case Token.ERROR:         // Avoid cascaded error messages
        case Token.EXPORT:
        case Token.EXPR_RESULT:
        case Token.FINALLY:
        case Token.FUNCTION:
        case Token.FOR:
        case Token.GOTO:
        case Token.IF:
        case Token.IFEQ:
        case Token.IFNE:
        case Token.IMPORT:
        case Token.INC:
        case Token.JSR:
        case Token.LABEL:
        case Token.LEAVEWITH:
        case Token.LET:
        case Token.LETEXPR:
        case Token.LOCAL_BLOCK:
        case Token.LOOP:
        case Token.NEW:
        case Token.REF_CALL:
        case Token.RETHROW:
        case Token.RETURN:
        case Token.RETURN_RESULT:
        case Token.SEMI:
        case Token.SETELEM:
        case Token.SETELEM_OP:
        case Token.SETNAME:
        case Token.SETPROP:
        case Token.SETPROP_OP:
        case Token.SETVAR:
        case Token.SET_REF:
        case Token.SET_REF_OP:
        case Token.SWITCH:
        case Token.TARGET:
        case Token.THROW:
        case Token.TRY:
        case Token.VAR:
        case Token.WHILE:
        case Token.WITH:
        case Token.WITHEXPR:
        case Token.YIELD:
          return true;

        default:
          return false;
      }
  }
 
开发者ID:tiffit,项目名称:TaleCraft,代码行数:77,代码来源:AstNode.java

示例7: isColumnExpression

/**
 * whether the expression is column reference
 * 
 * @param expression
 * @return
 */
public static boolean isColumnExpression( String expression )
{
	boolean isColumn = false;
	if ( expression == null || expression.trim( ).length( ) == 0 )
		return isColumn;
	if ( compiledExprCache.containsKey( expression ) )
		return ( (Boolean) compiledExprCache.get( expression ) ).booleanValue( );
	Context context = Context.enter( );
	ScriptNode tree;
	try
	{
		CompilerEnvirons m_compilerEnv = new CompilerEnvirons( );
		m_compilerEnv.initFromContext( context );
		Parser p = new Parser( m_compilerEnv, context.getErrorReporter( ) );
		AstRoot root = p.parse( expression, null, 0 );
		IRFactory ir = new IRFactory( m_compilerEnv );
		tree = ir.transformTree( root );
	}
	catch ( Exception e )
	{
		compiledExprCache.put( expression, Boolean.valueOf( false ) );
		return false;
	}
	finally
	{
		Context.exit( );
	}

	if ( tree.getFirstChild( ) == tree.getLastChild( ) )
	{
		// A single expression
		if ( tree.getFirstChild( ).getType( ) != Token.EXPR_RESULT
				&& tree.getFirstChild( ).getType( ) != Token.EXPR_VOID
				&& tree.getFirstChild( ).getType( ) != Token.BLOCK )
		{
			isColumn = false;
		}
		Node exprNode = tree.getFirstChild( );
		Node child = exprNode.getFirstChild( );
		assert ( child != null );
		if ( child.getType( ) == Token.GETELEM
				|| child.getType( ) == Token.GETPROP )
			isColumn = getDirectColRefExpr( child );
		else
			isColumn = false;
	}
	else
	{
		isColumn = false;
	}

	compiledExprCache.put( expression, Boolean.valueOf( isColumn ) );
	return isColumn;
}
 
开发者ID:eclipse,项目名称:birt,代码行数:60,代码来源:ExpressionUtility.java

示例8: processScriptTree

/**
 * process the script tree to produce a <code>CompiledExpression</code>
 * 
 * @param expression
 * @param tree
 * @param context
 * @return @throws
 *         DataException
 */
private CompiledExpression processScriptTree( String expression,
		ScriptNode tree, Context context ) throws DataException

{
	CompiledExpression expr;
	if ( tree.getFirstChild( ) == tree.getLastChild( ) )
	{
		if( tree.getFirstChild( ) == null )
			throw new DataException( "Expression parse error: first child is null. The expression is " + expression,
					expression );
		// A single expression
		if ( tree.getFirstChild( ).getType( ) != Token.EXPR_RESULT
				&& tree.getFirstChild( ).getType( ) != Token.EXPR_VOID
				&& tree.getFirstChild( ).getType( ) != Token.BLOCK )
		{
			// This should never happen?
			throw new DataException( ResourceConstants.INVALID_JS_EXPR,
					expression );
		}
		Node child, parent = tree;
		Node exprNode = parent.getFirstChild( );
		child = exprNode.getFirstChild( );
		if ( child.getNext( ) != null )
			child = exprNode;
		else
		{
			parent = exprNode;
		}
		assert ( child != null && parent != null );
		expr = processChild( context, false, parent, child, tree );
	}
	else
	{
		// complex expressions
		// Multiple expressions exist; we should produce complex expressions
		// However, individual subexpressions still needs to be processed
		// to identify the interesting subexpressions
		expr = compileComplexExpr( context, tree, false );
	}
	if ( expr instanceof BytecodeExpression )
		compileForBytecodeExpr( context, tree, expr );
	return expr;
}
 
开发者ID:eclipse,项目名称:birt,代码行数:52,代码来源:AbstractExpressionCompiler.java

示例9: isColumnExpression

/**
 * whether the expression is column reference
 * @param expression
 * @return
 */
public static boolean isColumnExpression( String expression, boolean mode )
{
	boolean isColumn = false;
	if ( expression == null || expression.trim( ).length( ) == 0 )
		return isColumn;
	if ( getCompiledExpCacheMap( mode ).containsKey( expression ) )
	{
		return ( (Boolean)  getCompiledExpCacheMap( mode ).get( expression ) ).booleanValue( );
	}
	Context context = Context.enter( );
	ScriptNode tree;
	try
	{
		CompilerEnvirons m_compilerEnv = new CompilerEnvirons( );
		m_compilerEnv.initFromContext( context );
		Parser p = new Parser( m_compilerEnv, context.getErrorReporter( ) );
		AstRoot root = p.parse( expression, null, 0 );
		IRFactory ir = new IRFactory( m_compilerEnv );
		tree = ir.transformTree( root );
	}
	catch ( Exception e )
	{
		getCompiledExpCacheMap( mode ).put( expression,
				Boolean.valueOf( false ) );
		return false;
	}
	finally
	{
		Context.exit( );
	}

	if ( tree.getFirstChild( ) == tree.getLastChild( ) )
	{
		// A single expression
		if ( tree.getFirstChild( ).getType( ) != Token.EXPR_RESULT
				&& tree.getFirstChild( ).getType( ) != Token.EXPR_VOID
				&& tree.getFirstChild( ).getType( ) != Token.BLOCK )
		{
			isColumn = false;
		}
		Node exprNode = tree.getFirstChild( );
		Node child = exprNode.getFirstChild( );
		assert ( child != null );
		if ( child.getType( ) == Token.GETELEM
				|| child.getType( ) == Token.GETPROP )
			isColumn = getDirectColRefExpr( child, mode );
		else
			isColumn = false;
	}
	else
	{
		isColumn = false;
	}
	getCompiledExpCacheMap( mode ).put( expression,
			Boolean.valueOf( isColumn ) );
	return isColumn;
}
 
开发者ID:eclipse,项目名称:birt,代码行数:62,代码来源:ExpressionUtility.java

示例10: setHasResult

/**
 * Called by the parser to set node type to EXPR_RESULT
 * if this node is not within a Function.
 */
public void setHasResult() {
    type = Token.EXPR_RESULT;
}
 
开发者ID:MikaGuraN,项目名称:HL4A,代码行数:7,代码来源:ExpressionStatement.java

示例11: hasSideEffects

/**
 * Returns true if this node has side effects
 * @throws IllegalStateException if expression has not yet
 * been set.
 */
@Override
public boolean hasSideEffects() {
    return type == Token.EXPR_RESULT || expr.hasSideEffects();
}
 
开发者ID:MikaGuraN,项目名称:HL4A,代码行数:9,代码来源:ExpressionStatement.java


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