本文整理汇总了Java中org.eclipse.cdt.core.dom.ast.IASTDeclaration类的典型用法代码示例。如果您正苦于以下问题:Java IASTDeclaration类的具体用法?Java IASTDeclaration怎么用?Java IASTDeclaration使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IASTDeclaration类属于org.eclipse.cdt.core.dom.ast包,在下文中一共展示了IASTDeclaration类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visit
import org.eclipse.cdt.core.dom.ast.IASTDeclaration; //导入依赖的package包/类
@Override
public int visit(IASTDeclaration node) {
/* ********************************************************************************************
* BE CAREFULL: The order of the tests is important because choices are not mutually exclusive
* ex: ICPPASTFunctionDefinition is a sub-interface of IASTFunctionDefinition
* ******************************************************************************************** */
if (node instanceof IASTSimpleDeclaration) {
return visit((IASTSimpleDeclaration)node);
}
else if (node instanceof ICPPASTFunctionDefinition) {
return visit((ICPPASTFunctionDefinition)node);
}
else if (node instanceof IASTFunctionDefinition) {
return visit((IASTFunctionDefinition)node);
}
else if (node instanceof ICPPASTTemplateDeclaration) {
return visit((ICPPASTTemplateDeclaration)node);
}
else if (node instanceof ICPPASTVisibilityLabel) {
return visit((ICPPASTVisibilityLabel)node);
}
//else ICPPASTUsingDirective, ...
return super.visit(node);
}
示例2: visit
import org.eclipse.cdt.core.dom.ast.IASTDeclaration; //导入依赖的package包/类
@Override
protected int visit(ICPPASTCompositeTypeSpecifier node) {
Class fmx;
/* Gets the key (IBinding) of the node to recover the famix type entity */
super.visit(node);
fmx = (Class) dico.getEntityByKey(nodeBnd);
this.getContext().push(fmx);
for (IASTDeclaration decl : node.getDeclarations(/*includeInactive*/true)) {
decl.accept(this);
}
returnedEntity = getContext().pop();
return PROCESS_SKIP;
}
示例3: visit
import org.eclipse.cdt.core.dom.ast.IASTDeclaration; //导入依赖的package包/类
@Override
protected int visit(ICPPASTCompositeTypeSpecifier node) {
Class fmx;
/* Gets the key (IBinding) of the node to recover the famix type entity */
super.visit(node);
fmx = (Class) dico.getEntityByKey(nodeBnd);
/*
* Visiting possible template methods
*/
this.getContext().push(fmx);
for (IASTDeclaration decl : node.getDeclarations(/*includeInactive*/true)) {
decl.accept(this);
}
returnedEntity = getContext().pop();
return PROCESS_SKIP;
}
示例4: visit
import org.eclipse.cdt.core.dom.ast.IASTDeclaration; //导入依赖的package包/类
/** Visiting a struct in C
* similar to C++ but no template
*/
@Override
protected int visit(ICASTCompositeTypeSpecifier node) {
Class fmx;
// compute nodeName and binding
super.visit(node);
fmx = dico.ensureFamixClass(nodeBnd, "struct "+nodeName.toString(), (ContainerEntity)getContext().top());
fmx.setIsStub(false); // used to say TRUE if could not find a binding. Not too sure ...
dico.addSourceAnchor(fmx, filename, node.getFileLocation());
this.getContext().push(fmx);
for (IASTDeclaration decl : node.getDeclarations(/*includeInactive*/true)) {
decl.accept(this);
}
returnedEntity = getContext().pop();
return PROCESS_SKIP;
}
示例5: visit
import org.eclipse.cdt.core.dom.ast.IASTDeclaration; //导入依赖的package包/类
@Override
public int visit(ICPPASTNamespaceDefinition node) {
Namespace fmx;
nodeName = node.getName();
if (! nodeName.toString().equals("")) {
nodeBnd = resolver.getBinding(nodeName);
fmx = dico.ensureFamixNamespace(nodeBnd, nodeName.toString(), (Namespace) this.getContext().top());
fmx.setIsStub(false);
this.getContext().push(fmx);
}
for (IASTDeclaration decl : node.getDeclarations()) {
decl.accept(this);
}
if (! nodeName.toString().equals("")) {
getContext().pop();
}
return PROCESS_SKIP;
}
示例6: visit
import org.eclipse.cdt.core.dom.ast.IASTDeclaration; //导入依赖的package包/类
@Override
protected int visit(IASTCompositeTypeSpecifier node) {
Class fmx;
super.visit(node);
fmx = (Class) dico.getEntityByKey(nodeBnd);
this.getContext().push(fmx);
for (IASTDeclaration decl : node.getDeclarations(/*includeInactive*/true)) {
decl.accept(this);
}
returnedEntity = getContext().pop();
return PROCESS_SKIP;
}
示例7: visit
import org.eclipse.cdt.core.dom.ast.IASTDeclaration; //导入依赖的package包/类
public int visit(ICASTKnRFunctionDeclarator declarator) {
err("CKnRFunctionDeclarator: " + declarator.getRawSignature());
IASTName[] names = declarator.getParameterNames();
IASTDeclaration[] declarations = declarator.getParameterDeclarations();
Map<IASTName, IASTDeclarator> map = new HashMap<IASTName, IASTDeclarator>();
for (IASTName name : names)
map.put(name, declarator.getDeclaratorForParameterName(name));
// TODO: implement
// check add getDeclarator, getParameterNames, getParameterDeclarations
throw new RuntimeException("NYI");
}
示例8: visit
import org.eclipse.cdt.core.dom.ast.IASTDeclaration; //导入依赖的package包/类
public int visit(IASTDeclaration declaration) {
if (declaration instanceof IASTFunctionDefinition) {
functionDefinitions.add((IASTFunctionDefinition) declaration);
}
return PROCESS_CONTINUE;
}
示例9: main
import org.eclipse.cdt.core.dom.ast.IASTDeclaration; //导入依赖的package包/类
public static void main(String[] args) throws IOException {
String sourceFile = "/Users/wul/Downloads/cppcheck-1.63/cli/main.cpp";
IASTTranslationUnitCore astTranslationUnitCore = new ASTTranslationUnitCore();
IASTTranslationUnit astTranslationUnit = astTranslationUnitCore.parseFile(
sourceFile, ParserLanguage.CPP, false, false
);
System.out.println(astTranslationUnit.getFilePath());
ASTDeclarationsVisitor astDeclarationsVisitor = new ASTDeclarationsVisitor();
astTranslationUnit.accept(astDeclarationsVisitor);
for (IASTDeclaration declaration: astDeclarationsVisitor.getDeclarations()) {
System.out.println(declaration.getRawSignature());
}
}
示例10: visit
import org.eclipse.cdt.core.dom.ast.IASTDeclaration; //导入依赖的package包/类
public int visit(IASTDeclaration decl) {
if ("IASTTranslationUnit.OWNED_DECLARATION - IASTDeclaration for IASTTranslationUnit".equals(decl.getPropertyInParent().getName()))
{
curDecl = cnt; //设置当前函数块的序号
}
// System.out.println("Visiting decl: " + decl.getRawSignature());
// System.out.println(decl.getPropertyInParent().getName());
setThings(decl.getPropertyInParent().getName(),"Visiting decl: " + decl.getRawSignature());
return PROCESS_CONTINUE;
}
示例11: problemDeclaration
import org.eclipse.cdt.core.dom.ast.IASTDeclaration; //导入依赖的package包/类
@Override
protected IASTDeclaration[] problemDeclaration(int offset, BacktrackException bt, DeclarationOptions option) {
try {
switch (LT(1)) {
case IProCToken.tEXEC:
switch (LT(2)) {
case IProCToken.tSQL:
case IProCToken.tORACLE:
case IProCToken.tTOOLS:
case IProCToken.tIAF:
IASTStatement stmt = getNodeFactory().newCompoundStatement();
// skip to semicolon or END-EXEC
int endOfProc = IToken.tSEMI;
IToken t = consume();
while (true) {
switch (t.getType()) {
case IProCToken.tEXECUTE:
switch (LT(1)) {
case IProCToken.tDECLARE:
case IProCToken.tBEGIN:
endOfProc = IProCToken.tEND_EXEC;
break;
}
break;
}
final int type = t.getType();
if (type == IToken.tIDENTIFIER || type >= IProCToken.FIRST_IProCToken) {
final int p_offset = t.getOffset();
final int p_endOffset = t.getEndOffset();
final int p_length = t.getLength();
IASTName name = getNodeFactory().newName(t.getCharImage());
((ASTNode) name).setOffsetAndLength(p_offset, p_length);
IBinding binding = new ProCBinding(name);
name.setBinding(binding);
IASTLabelStatement label_statement = getNodeFactory().newLabelStatement(name, null);
setRange(label_statement, p_offset, p_endOffset);
label_statement.setParent(stmt);
((IASTCompoundStatement) stmt).addStatement(label_statement);
}
if (type == endOfProc) {
break;
}
t = consume();
}
return new IASTDeclaration[] {};
}
}
} catch (EndOfFileException e) {
return new IASTDeclaration[] {};
}
return super.problemDeclaration(offset, bt, option);
}
示例12: visit
import org.eclipse.cdt.core.dom.ast.IASTDeclaration; //导入依赖的package包/类
public int visit(IASTDeclaration declaration) {
declarations.add(declaration);
return PROCESS_CONTINUE;
}
示例13: leave
import org.eclipse.cdt.core.dom.ast.IASTDeclaration; //导入依赖的package包/类
public int leave(IASTDeclaration decl) {
unsetThings();
//System.out.println("Leaving decl: " + decl.getRawSignature());
return PROCESS_CONTINUE;
}