本文整理汇总了Java中org.eclipse.jdt.internal.compiler.ast.EmptyStatement类的典型用法代码示例。如果您正苦于以下问题:Java EmptyStatement类的具体用法?Java EmptyStatement怎么用?Java EmptyStatement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EmptyStatement类属于org.eclipse.jdt.internal.compiler.ast包,在下文中一共展示了EmptyStatement类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: consumeEnhancedForStatement
import org.eclipse.jdt.internal.compiler.ast.EmptyStatement; //导入依赖的package包/类
protected void consumeEnhancedForStatement() {
// EnhancedForStatement ::= EnhancedForStatementHeader Statement
// EnhancedForStatementNoShortIf ::= EnhancedForStatementHeader StatementNoShortIf
//statements
this.astLengthPtr--;
Statement statement = (Statement) this.astStack[this.astPtr--];
// foreach statement is on the ast stack
ForeachStatement foreachStatement = (ForeachStatement) this.astStack[this.astPtr];
foreachStatement.action = statement;
// remember useful empty statement
if (statement instanceof EmptyStatement) statement.bits |= ASTNode.IsUsefulEmptyStatement;
foreachStatement.sourceEnd = this.endStatementPosition;
}
示例2: visit
import org.eclipse.jdt.internal.compiler.ast.EmptyStatement; //导入依赖的package包/类
/**
* @see org.eclipse.jdt.internal.compiler.ASTVisitor#visit(org.eclipse.jdt.internal.compiler.ast.EmptyStatement, org.eclipse.jdt.internal.compiler.lookup.BlockScope)
*/
public boolean visit(EmptyStatement statement, BlockScope scope) {
if (this.preferences.put_empty_statement_on_new_line) {
this.scribe.printNewLine();
}
this.scribe.printNextToken(TerminalTokens.TokenNameSEMICOLON, this.preferences.insert_space_before_semicolon);
this.scribe.printComment(CodeFormatter.K_UNKNOWN, Scribe.BASIC_TRAILING_COMMENT);
return false;
}
示例3: consumeEmptyStatement
import org.eclipse.jdt.internal.compiler.ast.EmptyStatement; //导入依赖的package包/类
protected void consumeEmptyStatement() {
// EmptyStatement ::= ';'
char[] source = this.scanner.source;
if (source[this.endStatementPosition] == ';') {
pushOnAstStack(new EmptyStatement(this.endStatementPosition, this.endStatementPosition));
} else {
if(source.length > 5) {
int c1 = 0, c2 = 0, c3 = 0, c4 = 0;
int pos = this.endStatementPosition - 4;
while (source[pos] == 'u') {
pos--;
}
if (source[pos] == '\\' &&
!((c1 = ScannerHelper.getHexadecimalValue(source[this.endStatementPosition - 3])) > 15
|| c1 < 0
|| (c2 = ScannerHelper.getHexadecimalValue(source[this.endStatementPosition - 2])) > 15
|| c2 < 0
|| (c3 = ScannerHelper.getHexadecimalValue(source[this.endStatementPosition - 1])) > 15
|| c3 < 0
|| (c4 = ScannerHelper.getHexadecimalValue(source[this.endStatementPosition])) > 15
|| c4 < 0) &&
((char) (((c1 * 16 + c2) * 16 + c3) * 16 + c4)) == ';'){
// we have a Unicode for the ';' (/u003B)
pushOnAstStack(new EmptyStatement(pos, this.endStatementPosition));
return;
}
}
pushOnAstStack(new EmptyStatement(this.endPosition + 1, this.endStatementPosition));
}
}
示例4: visit
import org.eclipse.jdt.internal.compiler.ast.EmptyStatement; //导入依赖的package包/类
@Override public boolean visit(EmptyStatement node, BlockScope scope) {
fixPositions(setGeneratedBy(node, source));
return super.visit(node, scope);
}
示例5: formatStatements
import org.eclipse.jdt.internal.compiler.ast.EmptyStatement; //导入依赖的package包/类
private void formatStatements(BlockScope scope, final Statement[] statements, boolean insertNewLineAfterLastStatement) {
int statementsLength = statements.length;
for (int i = 0; i < statementsLength; i++) {
final Statement statement = statements[i];
if (i > 0 && (statements[i - 1] instanceof EmptyStatement) && !(statement instanceof EmptyStatement)) {
this.scribe.printNewLine();
}
statement.traverse(this, scope);
if (statement instanceof Expression) {
this.scribe.printNextToken(TerminalTokens.TokenNameSEMICOLON, this.preferences.insert_space_before_semicolon);
this.scribe.printComment(CodeFormatter.K_UNKNOWN, Scribe.BASIC_TRAILING_COMMENT);
if (i != statementsLength - 1) {
if (!(statement instanceof EmptyStatement) && !(statements[i + 1] instanceof EmptyStatement)) {
this.scribe.printNewLine();
}
} else if (i == statementsLength - 1 && insertNewLineAfterLastStatement) {
this.scribe.printNewLine();
}
} else if (statement instanceof LocalDeclaration) {
LocalDeclaration currentLocal = (LocalDeclaration) statement;
if (i < (statementsLength - 1)) {
/*
* We need to check that the next statement is a local declaration
*/
if (statements[i + 1] instanceof LocalDeclaration) {
LocalDeclaration nextLocal = (LocalDeclaration) statements[i + 1];
if (currentLocal.declarationSourceStart != nextLocal.declarationSourceStart) {
this.scribe.printNextToken(TerminalTokens.TokenNameSEMICOLON, this.preferences.insert_space_before_semicolon);
this.scribe.printComment(CodeFormatter.K_UNKNOWN, Scribe.BASIC_TRAILING_COMMENT);
if (i != statementsLength - 1) {
if (!(statement instanceof EmptyStatement) && !(statements[i + 1] instanceof EmptyStatement)) {
this.scribe.printNewLine();
}
} else if (i == statementsLength - 1 && insertNewLineAfterLastStatement) {
this.scribe.printNewLine();
}
}
} else {
this.scribe.printNextToken(TerminalTokens.TokenNameSEMICOLON, this.preferences.insert_space_before_semicolon);
this.scribe.printComment(CodeFormatter.K_UNKNOWN, Scribe.BASIC_TRAILING_COMMENT);
if (i != statementsLength - 1) {
if (!(statement instanceof EmptyStatement) && !(statements[i + 1] instanceof EmptyStatement)) {
this.scribe.printNewLine();
}
} else if (i == statementsLength - 1 && insertNewLineAfterLastStatement) {
this.scribe.printNewLine();
}
}
} else {
this.scribe.printNextToken(TerminalTokens.TokenNameSEMICOLON, this.preferences.insert_space_before_semicolon);
this.scribe.printComment(CodeFormatter.K_UNKNOWN, Scribe.BASIC_TRAILING_COMMENT);
if (i != statementsLength - 1) {
if (!(statement instanceof EmptyStatement) && !(statements[i + 1] instanceof EmptyStatement)) {
this.scribe.printNewLine();
}
} else if (i == statementsLength - 1 && insertNewLineAfterLastStatement) {
this.scribe.printNewLine();
}
}
} else if (i != statementsLength - 1) {
if (!(statement instanceof EmptyStatement) && !(statements[i + 1] instanceof EmptyStatement)) {
this.scribe.printNewLine();
}
} else if (i == statementsLength - 1 && insertNewLineAfterLastStatement) {
this.scribe.printNewLine();
}
}
}
示例6: endVisit
import org.eclipse.jdt.internal.compiler.ast.EmptyStatement; //导入依赖的package包/类
@Override
public void endVisit(EmptyStatement x, BlockScope scope) {
push(null);
}
示例7: visit
import org.eclipse.jdt.internal.compiler.ast.EmptyStatement; //导入依赖的package包/类
@Override public boolean visit(EmptyStatement node, BlockScope scope) {
setGeneratedBy(node, source);
applyOffsetASTNode(node);
return super.visit(node, scope);
}