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


Java EmptyStatement类代码示例

本文整理汇总了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;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:17,代码来源:Parser.java

示例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;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:12,代码来源:CodeFormatterVisitor.java

示例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));
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:31,代码来源:Parser.java

示例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);
}
 
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:5,代码来源:SetGeneratedByVisitor.java

示例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();
		}
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:69,代码来源:CodeFormatterVisitor.java

示例6: endVisit

import org.eclipse.jdt.internal.compiler.ast.EmptyStatement; //导入依赖的package包/类
@Override
public void endVisit(EmptyStatement x, BlockScope scope) {
  push(null);
}
 
开发者ID:WeTheInternet,项目名称:xapi,代码行数:5,代码来源:GwtAstBuilder.java

示例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);
}
 
开发者ID:redundent,项目名称:lombok,代码行数:6,代码来源:SetGeneratedByVisitor.java


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