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


Java IASTExpression类代码示例

本文整理汇总了Java中org.eclipse.cdt.core.dom.ast.IASTExpression的典型用法代码示例。如果您正苦于以下问题:Java IASTExpression类的具体用法?Java IASTExpression怎么用?Java IASTExpression使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: parseExpression

import org.eclipse.cdt.core.dom.ast.IASTExpression; //导入依赖的package包/类
public IValue parseExpression(IString expression, IEvaluatorContext ctx) throws CoreException, IOException {
	setIEvaluatorContext(ctx);
	if (!expression.getValue().endsWith(";"))
		expression.concat(vf.string(";"));
	String expr = "void main() {\n\t" + expression.getValue() + "\n}";
	FileContent fc = FileContent.create("", expr.toCharArray());
	Map<String, String> macroDefinitions = new HashMap<String, String>();
	String[] includeSearchPaths = new String[0];
	IScannerInfo si = new ScannerInfo(macroDefinitions, includeSearchPaths);
	IncludeFileContentProvider ifcp = IncludeFileContentProvider.getEmptyFilesProvider();
	IIndex idx = null;
	int options = ILanguage.OPTION_PARSE_INACTIVE_CODE;
	IParserLogService log = new DefaultLogService();
	IASTTranslationUnit tu = GPPLanguage.getDefault().getASTTranslationUnit(fc, si, ifcp, idx, options, log);

	IASTFunctionDefinition main = (IASTFunctionDefinition) tu.getDeclarations()[0];
	IASTCompoundStatement body = (IASTCompoundStatement) main.getBody();
	IASTExpression ex = ((IASTExpressionStatement) body.getStatements()[0]).getExpression();
	ex.accept(this);
	return stack.pop();
}
 
开发者ID:cwi-swat,项目名称:clair,代码行数:22,代码来源:Parser.java

示例2: visit

import org.eclipse.cdt.core.dom.ast.IASTExpression; //导入依赖的package包/类
@Override
public int visit(IASTArrayModifier arrayModifier) {
	if (arrayModifier instanceof ICASTArrayModifier)
		throw new RuntimeException("NYI");
	ISourceLocation loc = getSourceLocation(arrayModifier);
	IList attributes = getAttributes(arrayModifier);

	IASTExpression constantExpression = arrayModifier.getConstantExpression();
	if (constantExpression == null)
		stack.push(builder.Expression_arrayModifier(attributes, loc));
	else {
		constantExpression.accept(this);
		stack.push(builder.Expression_arrayModifier(attributes, stack.pop(), loc));
	}
	return PROCESS_ABORT;
}
 
开发者ID:cwi-swat,项目名称:clair,代码行数:17,代码来源:Parser.java

示例3: visit

import org.eclipse.cdt.core.dom.ast.IASTExpression; //导入依赖的package包/类
public int visit(IASTExpression expr) {
	if("IASTFunctionCallExpression.FUNCTION_Name - IASTExpression (name) for IASTFunctionCallExpression".equals(expr.getPropertyInParent().getName()))
	{
		funcPosMap.put(expr.getRawSignature(), cnt);
		//System.out.println("expr:"+expr.getRawSignature());
	    functionMap.get(curFunc).getFuncCallList().add(expr.getRawSignature());	
	}
	
	setThings(expr.getPropertyInParent().getName(),"Visiting expr: " + expr.getRawSignature());
	//System.out.println("Visiting expr: " + expr.getPropertyInParent().getName());
	/*if(expr instanceof IASTBinaryExpression)
	{
		System.out.println("!!!!!!11");
		System.out.println("Visiting expr: "+ expr.getPropertyInParent() + expr.getRawSignature());
	}*/
	
	//System.out.println(expr.getPropertyInParent().getName());
	return PROCESS_CONTINUE;
}
 
开发者ID:elenno,项目名称:simtest,代码行数:20,代码来源:ASTVISITOR.java

示例4: visit

import org.eclipse.cdt.core.dom.ast.IASTExpression; //导入依赖的package包/类
@Override
public int visit(IASTExpression node) {
	if (node instanceof IASTFieldReference) {
		return visit((IASTFieldReference)node);
	}
	else if (node instanceof IASTIdExpression) {
		return visit((IASTIdExpression)node);
	}
	else if (node instanceof ICPPASTNewExpression) {
		return visit((ICPPASTNewExpression)node);
	}
	else if (node instanceof IASTFunctionCallExpression) {
		return visit((IASTFunctionCallExpression)node);
	}
	else if (node instanceof IASTUnaryExpression) {
		return visit((IASTUnaryExpression)node);   // to check whether this is an assignement
	}
	else if (node instanceof IASTBinaryExpression) {
		return visit((IASTBinaryExpression)node);   // to check whether this is an assignement
	}
	else if (node instanceof IASTLiteralExpression) {
		return visit((IASTLiteralExpression)node);
	}
	else if (node instanceof IASTTypeIdExpression) {
		return visit((IASTTypeIdExpression)node);
	}
	else if (node instanceof IASTCastExpression) {
		return visit((IASTCastExpression)node);
	}

	return super.visit(node);
}
 
开发者ID:Synectique,项目名称:VerveineC-Cpp,代码行数:33,代码来源:AbstractDispatcherVisitor.java

示例5: resolveType

import org.eclipse.cdt.core.dom.ast.IASTExpression; //导入依赖的package包/类
public IConstructor resolveType(IASTNode node) {
	if (node instanceof IASTExpression)
		return resolveIASTExpression((IASTExpression) node);
	if (node instanceof ICPPASTTemplateDeclaration)
		return resolveICPPASTTemplateDeclaration((ICPPASTTemplateDeclaration) node);
	if (node instanceof ICPPASTTemplateId)
		return resolveICPPASTTemplateId((ICPPASTTemplateId) node);
	return builder.TypeSymbol_any();
}
 
开发者ID:cwi-swat,项目名称:clair,代码行数:10,代码来源:TypeResolver.java

示例6: visit

import org.eclipse.cdt.core.dom.ast.IASTExpression; //导入依赖的package包/类
public int visit(IASTExpression expression) {
    // if it�s a function call
    if (expression instanceof IASTFunctionCallExpression) {
        IASTFunctionCallExpression fce = (IASTFunctionCallExpression) expression;
        IASTExpression astExpr = fce.getFunctionNameExpression();
        String fnSig = astExpr.getRawSignature();
        if (isAssertion(fnSig)) {
            ++m_NumberOfAssertions;
        }
    }
    return PROCESS_CONTINUE;
}
 
开发者ID:dheraclio,项目名称:dependometer,代码行数:13,代码来源:SourceFileParser.java

示例7: check

import org.eclipse.cdt.core.dom.ast.IASTExpression; //导入依赖的package包/类
@Override
public List<CheckResult> check(Object obj) {
    List<CheckResult> checkResults = Lists.newArrayList();

    IASTTranslationUnit translationUnit = (IASTTranslationUnit) obj;
    ASTExpressionsVisitor expressionsVisitor = new ASTExpressionsVisitor();
    translationUnit.accept(expressionsVisitor);

    for (IASTExpression expression: expressionsVisitor.getExpressions()) {
        if (!(expression instanceof IASTFunctionCallExpression))
            continue;
        IASTFunctionCallExpression callExpression = (IASTFunctionCallExpression) expression;
        if (callExpression.getFunctionNameExpression() == null)
            continue;
        if (!overflowFunctions.contains(callExpression.getFunctionNameExpression().toString()))
            continue;
        CheckResult checkResult = new CheckResult(
            ErrorItem.BUFFER_OVERFLOW_FUNCTION,
            ErrorType.RISK,
            translationUnit.getFilePath(),
            expression.getFileLocation().getStartingLineNumber(),
            expression.getFileLocation().getEndingLineNumber()
        );
        checkResults.add(checkResult);

        // log
        Map<String, Object> scopes = Maps.newHashMap();
        scopes.put("checkResult", checkResult);
        scopes.put("functionName", callExpression.getFunctionNameExpression().toString());
        String comments = compileErrorMessage(errorMessage, scopes);
        logger.error(comments);

        checkResult.setComments(comments);
    }

    return checkResults;
}
 
开发者ID:magicsky,项目名称:sya,代码行数:38,代码来源:BufferOverflowFunctionChecker.java

示例8: resolveIASTExpression

import org.eclipse.cdt.core.dom.ast.IASTExpression; //导入依赖的package包/类
private IConstructor resolveIASTExpression(IASTExpression node) {
	return resolveType(node.getExpressionType());
}
 
开发者ID:cwi-swat,项目名称:clair,代码行数:4,代码来源:TypeResolver.java

示例9: visit

import org.eclipse.cdt.core.dom.ast.IASTExpression; //导入依赖的package包/类
public int visit(IASTExpression expression) {
       expressions.add(expression);
	return PROCESS_CONTINUE;
}
 
开发者ID:magicsky,项目名称:sya,代码行数:5,代码来源:ASTExpressionsVisitor.java

示例10: leave

import org.eclipse.cdt.core.dom.ast.IASTExpression; //导入依赖的package包/类
public int leave(IASTExpression expr) {
	unsetThings();
	
//	System.out.println("Leaving expr: " + expr.getRawSignature());
	
	return PROCESS_CONTINUE;
}
 
开发者ID:elenno,项目名称:simtest,代码行数:8,代码来源:ASTVISITOR.java


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