本文整理汇总了Java中org.eclipse.cdt.core.dom.ast.IASTStatement类的典型用法代码示例。如果您正苦于以下问题:Java IASTStatement类的具体用法?Java IASTStatement怎么用?Java IASTStatement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IASTStatement类属于org.eclipse.cdt.core.dom.ast包,在下文中一共展示了IASTStatement类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: statement
import org.eclipse.cdt.core.dom.ast.IASTStatement; //导入依赖的package包/类
@Override
protected IASTStatement statement() throws EndOfFileException, BacktrackException {
switch (LT(1)) {
case IProCToken.tEXEC:
switch (LT(2)) {
case IProCToken.tSQL:
case IProCToken.tORACLE:
case IProCToken.tTOOLS:
case IProCToken.tIAF:
/*
* Pro*C
*/
return parseSqlStatement();
}
}
return super.statement();
}
示例2: visit
import org.eclipse.cdt.core.dom.ast.IASTStatement; //导入依赖的package包/类
public int visit(IASTStatement stmt) { // lots more
if (stmt instanceof IASTExpressionStatement)
{
if (stmt.getRawSignature().length() > 100)
{
// System.out.println("Visiting expr: "+ stmt.getPropertyInParent() + stmt.getRawSignature());
return PROCESS_SKIP;
}
}
if ("IASTFunctionDefinition.FUNCTION_BODY - Function Body for IASTFunctionDefinition".equals(stmt.getPropertyInParent().getName()))
{
curStmt = cnt;
addFunctionMover(curFunc,curDecl,curStmt);
// curFunc = "";
// curDecl = -1;
// curStmt = -1;
}
// System.out.println(stmt.getPropertyInParent().getName()+" "+"Visiting stmt: " + stmt.getRawSignature());
setThings(stmt.getPropertyInParent().getName(),
"Visiting stmt: " + stmt.getRawSignature());
return PROCESS_CONTINUE;
}
示例3: visit
import org.eclipse.cdt.core.dom.ast.IASTStatement; //导入依赖的package包/类
/**
* Visiting a statement. Used to compute some metrics on the methods:
* Cyclomatic Complexity and NumberOfStatements
*/
@Override
public int visit(IASTStatement node) {
// possible subtypes:
// IASTBreakStatement, IASTCaseStatement, IASTCompoundStatement, IASTContinueStatement, IASTDeclarationStatement, IASTDefaultStatement,
// IASTDoStatement, IASTExpressionStatement, IASTForStatement, IASTGotoStatement, IASTIfStatement, IASTLabelStatement, IASTNullStatement,
// IASTProblemStatement, IASTReturnStatement, IASTSwitchStatement, IASTWhileStatement, ICPPASTCatchHandler, ICPPASTCompoundStatement,
// ICPPASTForStatement, ICPPASTIfStatement, ICPPASTRangeBasedForStatement, ICPPASTSwitchStatement, ICPPASTTryBlockStatement, ICPPASTWhileStatement,
// IGNUASTGotoStatement
if ( (node instanceof IASTCaseStatement) ||
(node instanceof IASTDefaultStatement) ||
(node instanceof IASTDoStatement) ||
(node instanceof IASTForStatement) ||
(node instanceof IASTIfStatement) ||
(node instanceof IASTWhileStatement) ||
(node instanceof ICPPASTRangeBasedForStatement)||
(node instanceof ICPPASTTryBlockStatement) ) {
getContext().addTopMethodCyclo(1);
}
if ( (node instanceof IASTCaseStatement) || // not a statement but a case clause in a switch
(node instanceof IASTCompoundStatement)|| // block
(node instanceof IASTDefaultStatement) || // not a statement but the default clause in a switch
(node instanceof IASTLabelStatement) ) {
// nothing to do for these, all the rest counts as one statement (in the else clause)
}
else {
getContext().addTopMethodNOS(1);
}
return super.visit(node);
}
示例4: visit
import org.eclipse.cdt.core.dom.ast.IASTStatement; //导入依赖的package包/类
@Override
public int visit(IASTStatement statement) {
if (statement instanceof IASTAmbiguousStatement)
visit((IASTAmbiguousStatement) statement);
else if (statement instanceof IASTBreakStatement)
visit((IASTBreakStatement) statement);
else if (statement instanceof IASTCaseStatement)
visit((IASTCaseStatement) statement);
else if (statement instanceof IASTCompoundStatement)
visit((IASTCompoundStatement) statement);
else if (statement instanceof IASTContinueStatement)
visit((IASTContinueStatement) statement);
else if (statement instanceof IASTDeclarationStatement)
visit((IASTDeclarationStatement) statement);
else if (statement instanceof IASTDefaultStatement)
visit((IASTDefaultStatement) statement);
else if (statement instanceof IASTDoStatement)
visit((IASTDoStatement) statement);
else if (statement instanceof IASTExpressionStatement)
visit((IASTExpressionStatement) statement);
else if (statement instanceof IASTForStatement)
visit((IASTForStatement) statement);
else if (statement instanceof IASTGotoStatement)
visit((IASTGotoStatement) statement);
else if (statement instanceof IASTIfStatement)
visit((IASTIfStatement) statement);
else if (statement instanceof IASTLabelStatement)
visit((IASTLabelStatement) statement);
else if (statement instanceof IASTNullStatement)
visit((IASTNullStatement) statement);
else if (statement instanceof IASTReturnStatement)
visit((IASTReturnStatement) statement);
else if (statement instanceof IASTSwitchStatement)
visit((IASTSwitchStatement) statement);
else if (statement instanceof IASTWhileStatement)
visit((IASTWhileStatement) statement);
else if (statement instanceof ICPPASTCatchHandler)
visit((ICPPASTCatchHandler) statement);
else if (statement instanceof ICPPASTRangeBasedForStatement)
visit((ICPPASTRangeBasedForStatement) statement);
else if (statement instanceof ICPPASTTryBlockStatement)
visit((ICPPASTTryBlockStatement) statement);
else if (statement instanceof IGNUASTGotoStatement)
visit((IGNUASTGotoStatement) statement);
else if (statement instanceof IASTProblemStatement)
visit((IASTProblemStatement) statement);
else {
throw new RuntimeException(
"Statement: encountered non-implemented subtype " + statement.getClass().getName());
}
return PROCESS_ABORT;
}
示例5: problemDeclaration
import org.eclipse.cdt.core.dom.ast.IASTStatement; //导入依赖的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);
}
示例6: visit
import org.eclipse.cdt.core.dom.ast.IASTStatement; //导入依赖的package包/类
public int visit(IASTStatement statement) {
statements.add(statement);
return PROCESS_CONTINUE;
}
示例7: leave
import org.eclipse.cdt.core.dom.ast.IASTStatement; //导入依赖的package包/类
public int leave(IASTStatement stmt) {
unsetThings();
//System.out.println(" Leaving stmt: " + stmt.getRawSignature());
return PROCESS_CONTINUE;
}