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


Java Token.NAME属性代码示例

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


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

示例1: getScriptObjectName

/**
 * 
 * @param n
 * @param objectName
 * @return
 */
private static String getScriptObjectName( Node n, String objectName )
{
	if ( n == null )
		return null;
	String result = null;
	if ( n.getType( ) == Token.NAME )
	{
		if ( objectName.equals( n.getString( ) ) )
		{
			Node dimNameNode = n.getNext( );
			if ( dimNameNode == null
					|| dimNameNode.getType( ) != Token.STRING )
				return null;

			return dimNameNode.getString( );
		}
	}

	result = getScriptObjectName( n.getFirstChild( ), objectName );
	if ( result == null )
		result = getScriptObjectName( n.getLastChild( ), objectName );

	return result;
}
 
开发者ID:eclipse,项目名称:birt,代码行数:30,代码来源:CubeQueryUtil.java

示例2: getConstantExpression

/**
 * Return the Constant Expression referred by the total constants.
 * @param child
 * @return
 */
public static ConstantExpression getConstantExpression( Node child )
{
	if ( child.getFirstChild( ).getType( ) == Token.NAME
		&& child.getFirstChild( ).getString( ).equalsIgnoreCase( TOTAL )
		&& child.getLastChild( ).getType( ) == Token.STRING )
	{
		String property = child.getLastChild( ).getString( );
		if ( CURRENT_GROUP.equalsIgnoreCase( property )
			|| OVERALL.equalsIgnoreCase( property ) )
			return new ConstantExpression( property.toUpperCase( ) );
		if ( NO_FILTER.equalsIgnoreCase( property ) )
			return new ConstantExpression();
	}
	return null;
}
 
开发者ID:eclipse,项目名称:birt,代码行数:20,代码来源:AggregationConstantsUtil.java

示例3: getScriptObjectName

/**
 * 
 * @param n
 * @param objectName
 * @return
 */
private static void getScriptObjectName( Node n, String objectName, Set nameSet )
{
	if ( n == null )
		return;
	String result = null;
	if ( n.getType( ) == Token.NAME )
	{
		if ( objectName.equals( n.getString( ) ) )
		{
			Node dimNameNode = n.getNext( );
			if ( dimNameNode == null
					|| dimNameNode.getType( ) != Token.STRING )
				return;

			nameSet.add( dimNameNode.getString( ) );
		}
	}

	getScriptObjectName( n.getFirstChild( ), objectName, nameSet );
	getScriptObjectName( n.getNext( ), objectName, nameSet );
	getScriptObjectName( n.getLastChild( ), objectName, nameSet );
}
 
开发者ID:eclipse,项目名称:birt,代码行数:28,代码来源:OlapExpressionCompiler.java

示例4: visit

public boolean visit(AstNode node) {
    int tt = node.getType();
    String name = Token.typeToName(tt);
    buffer.append(node.getAbsolutePosition()).append("\t");
    buffer.append(makeIndent(node.depth()));
    buffer.append(name).append(" ");
    buffer.append(node.getPosition()).append(" ");
    buffer.append(node.getLength());
    if (tt == Token.NAME) {
        buffer.append(" ").append(((Name)node).getIdentifier());
    }
    buffer.append("\n");
    return true;  // process kids
}
 
开发者ID:MikaGuraN,项目名称:HL4A,代码行数:14,代码来源:AstNode.java

示例5: visit

@Override
public boolean visit(AstNode node) {
        int tt = node.getType();
        String name = Token.typeToName(tt);
        buffer.append(node.getAbsolutePosition()).append("\t");
        buffer.append(makeIndent(node.depth()));
        buffer.append(name).append(" ");
        buffer.append(node.getPosition()).append(" ");
        buffer.append(node.getLength());
        if (tt == Token.NAME) {
            buffer.append(" ").append(((Name)node).getIdentifier());
        }
        buffer.append("\n");
        return true;  // process kids
    }
 
开发者ID:tiffit,项目名称:TaleCraft,代码行数:15,代码来源:AstNode.java

示例6: compileDirectColRefExpr

/**
 * compile column reference expression
 * 
 * @param refNode
 * @throws BirtException
 */
private void compileDirectColRefExpr( Node refNode, ScriptNode tree,
		List columnExprList ) throws BirtException
{
	assert ( refNode.getType( ) == Token.GETPROP
			|| refNode.getType( ) == Token.GETELEM
			|| refNode.getType( ) == Token.SETELEM || refNode.getType( ) == Token.SETPROP );

	Node rowName = refNode.getFirstChild( );
	assert ( rowName != null );
	if ( rowName.getType( ) != Token.NAME )
	{
		if ( refNode.getType( ) == Token.GETPROP
				|| refNode.getType( ) == Token.GETELEM
				|| refNode.getType( ) == Token.SETELEM
				|| refNode.getType( ) == Token.SETPROP )
		{
			compileOuterColRef( refNode, tree, columnExprList );
			compileRowPositionRef( refNode, tree, columnExprList );
			return;
		}
		compileComplexExpr( refNode, tree, columnExprList );
		return;
	}
	else
		compileSimpleColumnRefExpr( refNode, tree, columnExprList );
}
 
开发者ID:eclipse,项目名称:birt,代码行数:32,代码来源:ExpressionParserUtility.java

示例7: visit

@Override
public boolean visit(AstNode node) {
	if( Token.NAME == node.getType()){
		if(node.getParent().getType() == Token.CALL){
			FunctionCall parent = (FunctionCall)node.getParent();
			if(parent.getTarget()==node){
				resultSoFar.add(safeGetString(node));
			}
		}
	}
	return true;
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:12,代码来源:FormulaInfo.java

示例8: visit

@Override
public boolean visit(AstNode node) {
          int tt = node.getType();
          String name = Token.typeToName(tt);
          buffer.append(node.getAbsolutePosition()).append("\t");
          buffer.append(makeIndent(node.depth()));
          buffer.append(name).append(" ");
          buffer.append(node.getPosition()).append(" ");
          buffer.append(node.getLength());
          if (tt == Token.NAME) {
              buffer.append(" ").append(((Name)node).getIdentifier());
          }
          buffer.append("\n");
          return true;  // process kids
      }
 
开发者ID:oswetto,项目名称:LoboEvolution,代码行数:15,代码来源:AstNode.java

示例9: getScriptObjectName

/**
 * 
 * @param n
 * @param objectName
 * @return
 */
private static String getScriptObjectName( Node n, String objectName )
{
	if ( n == null )
		return null;
	String result = null;
	if ( n.getType( ) == Token.NAME )
	{
		if ( objectName.equals( n.getString( ) ) )
		{
			Node dimNameNode = n.getNext( );
			if ( dimNameNode == null
					|| dimNameNode.getType( ) != Token.STRING )
				return null;

			return dimNameNode.getString( );
		}
	}

	result = getScriptObjectName( n.getFirstChild( ), objectName );
	if ( result == null )
		result = getScriptObjectName( n.getLastChild( ), objectName );
	
	if ( result == null )
		result = getScriptObjectName( n.getNext(), objectName );

	return result;
}
 
开发者ID:eclipse,项目名称:birt,代码行数:33,代码来源:OlapExpressionCompiler.java

示例10: getAggregationFunction

/**
 * An aggregation expression in the form of Total.xxx for example Total.sum(
 * row.x ) This means the first child is a GETPROP node, and its left child
 * is "Total" and its right child is "sum"
 * 
 * @param callNode
 * @return @throws
 *         DataException
 */
protected IAggrFunction getAggregationFunction( Node callNode )
		throws DataException
{

	Node firstChild = callNode.getFirstChild( );
	if ( firstChild.getType( ) != Token.GETPROP )
		return null;

	Node getPropLeftChild = firstChild.getFirstChild( );
	if ( getPropLeftChild.getType( ) != Token.NAME
			|| !getPropLeftChild.getString( ).equals( TOTAL ) )
		return null;

	Node getPropRightChild = firstChild.getLastChild( );
	if ( getPropRightChild.getType( ) != Token.STRING )
		return null;

	String aggrFuncName = getPropRightChild.getString( );
	IAggrFunction agg = AggregationManager.getInstance( )
			.getAggregation( aggrFuncName );
	if ( agg == null )
	{
		// Aggr function name after Total is invalid; this will eventuall
		// cause
		// an error. Report error now
		throw new DataException( ResourceConstants.INVALID_TOTAL_NAME,
				aggrFuncName );
	}
	return agg;
}
 
开发者ID:eclipse,项目名称:birt,代码行数:39,代码来源:AbstractExpressionCompiler.java

示例11: getDirectColRefExpr

/**
 * if the Node is row Node, return true
 * 
 * @param refNode
 * @return
 */
private static boolean getDirectColRefExpr( Node refNode, boolean mode )
{
	assert ( refNode.getType( ) == Token.GETPROP || refNode.getType( ) == Token.GETELEM );

	Node rowName = refNode.getFirstChild( );
	assert ( rowName != null );
	if ( rowName.getType( ) != Token.NAME )
		return false;

	String str = rowName.getString( );
	assert ( str != null );
	if ( mode && !str.equals( STRING_ROW ) )
		return false;
	else if ( !mode && !str.equals( STRING_DATASET_ROW ) )
		return false;

	Node rowColumn = rowName.getNext( );
	assert ( rowColumn != null );

	if ( refNode.getType( ) == Token.GETPROP
			&& rowColumn.getType( ) == Token.STRING )
	{
		return true;
	}
	else if ( refNode.getType( ) == Token.GETELEM )
	{
		if ( rowColumn.getType( ) == Token.NUMBER
				|| rowColumn.getType( ) == Token.STRING )
			return true;
	}

	return false;
}
 
开发者ID:eclipse,项目名称:birt,代码行数:39,代码来源:ExpressionUtility.java

示例12: getDirectColRefExpr

/**
 * if the Node is row Node, return true
 * 
 * @param refNode
 * @return
 */
private static boolean getDirectColRefExpr( Node refNode )
{
	assert ( refNode.getType( ) == Token.GETPROP || refNode.getType( ) == Token.GETELEM );

	Node rowName = refNode.getFirstChild( );
	assert ( rowName != null );
	if ( rowName.getType( ) != Token.NAME )
		return false;

	String str = rowName.getString( );
	assert ( str != null );
	if ( !str.equals( STRING_ROW ) )
		return false;

	Node rowColumn = rowName.getNext( );
	assert ( rowColumn != null );

	if ( refNode.getType( ) == Token.GETPROP
			&& rowColumn.getType( ) == Token.STRING )
	{
		return true;
	}
	else if ( refNode.getType( ) == Token.GETELEM )
	{
		if ( rowColumn.getType( ) == Token.NUMBER
				|| rowColumn.getType( ) == Token.STRING )
			return true;
	}

	return false;
}
 
开发者ID:eclipse,项目名称:birt,代码行数:37,代码来源:ExpressionUtility.java

示例13: JavaScriptIdentifier

JavaScriptIdentifier(String value, ScriptOrFnScope declaredScope) {
    super(Token.NAME, value);
    this.declaredScope = declaredScope;
}
 
开发者ID:benetech,项目名称:Secure-App-Generator,代码行数:4,代码来源:JavaScriptIdentifier.java

示例14: findFeaturePathsUnder

protected static Set<String> findFeaturePathsUnder(Node node, List<String> pathSoFar) {
	Set<String> resultSoFar = new TreeSet<String>();
	switch (node.getType()) {
	case Token.NAME: // e.g. the x in x + 42
		if (pathSoFar != null) {
			pathSoFar.add(node.getString());
		} else {
			resultSoFar.add(node.getString());
		}
		break;
	case Token.STRING:
		if (pathSoFar != null) {
			pathSoFar.add(node.getString());
		}
		break;
	case Token.GETPROP: // e.g. foo.bar
		boolean topLevel = pathSoFar == null;
		if (topLevel) {
			pathSoFar = new ArrayList<String>();
		}
		for (Node child = node.getFirstChild(); child != null; child = child.getNext()) {
			resultSoFar.addAll(findFeaturePathsUnder(child, pathSoFar));
		}
		if (topLevel) {
			resultSoFar.add(getPathString(pathSoFar));
		}
		return resultSoFar;
	case Token.SETNAME: // Left-hand variable being written:  x in x = y;
	case Token.VAR:
	case Token.CALL:
		// ignore the left side and process the right side now
		resultSoFar.addAll(findFeaturePathsWithinRightSide(node));
		break;
	default:
		break;
	}
	// Now do the nested subexpressions, for all cases that said break instead of return.
	for (Node child = node.getFirstChild(); child != null; child = child.getNext()) {
		resultSoFar.addAll(findFeaturePathsUnder(child, pathSoFar));
	}
	return resultSoFar;
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:42,代码来源:FormulaInfo.java

示例15: JavaScriptIdentifier

JavaScriptIdentifier(String value, ScriptOrFnScope declaredScope,
		boolean normalVar) {
	super(Token.NAME, value);
	this.declaredScope = declaredScope;
	this.normalVar = normalVar;
}
 
开发者ID:cursem,项目名称:ScriptCompressor,代码行数:6,代码来源:JavaScriptIdentifier.java


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