Java 类org.eclipse.jdt.internal.compiler.ast.LabeledStatement 实例源码

项目:Eclipse-Postfix-Code-Completion    文件:CodeFormatterVisitor.java   
/**
 * @see org.eclipse.jdt.internal.compiler.ASTVisitor#visit(org.eclipse.jdt.internal.compiler.ast.LabeledStatement, org.eclipse.jdt.internal.compiler.lookup.BlockScope)
 */
public boolean visit(LabeledStatement labeledStatement, BlockScope scope) {

    this.scribe.printNextToken(TerminalTokens.TokenNameIdentifier);
    this.scribe.printNextToken(TerminalTokens.TokenNameCOLON, this.preferences.insert_space_before_colon_in_labeled_statement);
    if (this.preferences.insert_space_after_colon_in_labeled_statement) {
        this.scribe.space();
    }
    if (this.preferences.insert_new_line_after_label) {
        this.scribe.printNewLine();
    }
    final Statement statement = labeledStatement.statement;
    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);
    }
    return false;
}
项目:Eclipse-Postfix-Code-Completion    文件:FlowContext.java   
public FlowContext getTargetContextForBreakLabel(char[] labelName) {
    FlowContext current = this, lastNonReturningSubRoutine = null;
    while (current != null) {
        if (current.isNonReturningContext()) {
            lastNonReturningSubRoutine = current;
        }
        char[] currentLabelName;
        if (((currentLabelName = current.labelName()) != null)
            && CharOperation.equals(currentLabelName, labelName)) {
            ((LabeledStatement)current.associatedNode).bits |= ASTNode.LabelUsed;
            if (lastNonReturningSubRoutine == null)
                return current;
            return lastNonReturningSubRoutine;
        }
        current = current.getLocalParent();
    }
    // not found
    return null;
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:CodeFormatterVisitor.java   
/**
 * @see org.eclipse.jdt.internal.compiler.ASTVisitor#visit(org.eclipse.jdt.internal.compiler.ast.LabeledStatement, org.eclipse.jdt.internal.compiler.lookup.BlockScope)
 */
public boolean visit(LabeledStatement labeledStatement, BlockScope scope) {

    this.scribe.printNextToken(TerminalTokens.TokenNameIdentifier);
    this.scribe.printNextToken(TerminalTokens.TokenNameCOLON, this.preferences.insert_space_before_colon_in_labeled_statement);
    if (this.preferences.insert_space_after_colon_in_labeled_statement) {
        this.scribe.space();
    }
    if (this.preferences.insert_new_line_after_label) {
        this.scribe.printNewLine();
    }
    final Statement statement = labeledStatement.statement;
    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);
    }
    return false;
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:FlowContext.java   
public FlowContext getTargetContextForBreakLabel(char[] labelName) {
    FlowContext current = this, lastNonReturningSubRoutine = null;
    while (current != null) {
        if (current.isNonReturningContext()) {
            lastNonReturningSubRoutine = current;
        }
        char[] currentLabelName;
        if (((currentLabelName = current.labelName()) != null)
            && CharOperation.equals(currentLabelName, labelName)) {
            ((LabeledStatement)current.associatedNode).bits |= ASTNode.LabelUsed;
            if (lastNonReturningSubRoutine == null)
                return current;
            return lastNonReturningSubRoutine;
        }
        current = current.getLocalParent();
    }
    // not found
    return null;
}
项目:Eclipse-Postfix-Code-Completion    文件:Parser.java   
protected void consumeStatementLabel() {
    // LabeledStatement ::= 'Identifier' ':' Statement
    // LabeledStatementNoShortIf ::= 'Identifier' ':' StatementNoShortIf

    //optimize push/pop
    Statement statement = (Statement) this.astStack[this.astPtr];
    this.astStack[this.astPtr] =
        new LabeledStatement(
            this.identifierStack[this.identifierPtr],
            statement,
            this.identifierPositionStack[this.identifierPtr--],
            this.endStatementPosition);
    this.identifierLengthPtr--;
}
项目:Eclipse-Postfix-Code-Completion    文件:FlowContext.java   
public FlowContext getTargetContextForContinueLabel(char[] labelName) {
    FlowContext current = this;
    FlowContext lastContinuable = null;
    FlowContext lastNonReturningSubRoutine = null;

    while (current != null) {
        if (current.isNonReturningContext()) {
            lastNonReturningSubRoutine = current;
        } else {
            if (current.isContinuable()) {
                lastContinuable = current;
            }
        }

        char[] currentLabelName;
        if ((currentLabelName = current.labelName()) != null && CharOperation.equals(currentLabelName, labelName)) {
            ((LabeledStatement)current.associatedNode).bits |= ASTNode.LabelUsed;

            // matching label found
            if ((lastContinuable != null)
                    && (current.associatedNode.concreteStatement()  == lastContinuable.associatedNode)) {

                if (lastNonReturningSubRoutine == null) return lastContinuable;
                return lastNonReturningSubRoutine;
            }
            // label is found, but not a continuable location
            return FlowContext.NotContinuableContext;
        }
        current = current.getLocalParent();
    }
    // not found
    return null;
}
项目:Eclipse-Postfix-Code-Completion    文件:ProblemReporter.java   
public void unusedLabel(LabeledStatement statement) {
    int severity = computeSeverity(IProblem.UnusedLabel);
    if (severity == ProblemSeverities.Ignore) return;
    String[] arguments = new String[] {new String(statement.label)};
    this.handle(
        IProblem.UnusedLabel,
        arguments,
        arguments,
        severity,
        statement.sourceStart,
        statement.labelEnd);
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:FlowContext.java   
public FlowContext getTargetContextForContinueLabel(char[] labelName) {
    FlowContext current = this;
    FlowContext lastContinuable = null;
    FlowContext lastNonReturningSubRoutine = null;

    while (current != null) {
        if (current.isNonReturningContext()) {
            lastNonReturningSubRoutine = current;
        } else {
            if (current.isContinuable()) {
                lastContinuable = current;
            }
        }

        char[] currentLabelName;
        if ((currentLabelName = current.labelName()) != null && CharOperation.equals(currentLabelName, labelName)) {
            ((LabeledStatement)current.associatedNode).bits |= ASTNode.LabelUsed;

            // matching label found
            if ((lastContinuable != null)
                    && (current.associatedNode.concreteStatement()  == lastContinuable.associatedNode)) {

                if (lastNonReturningSubRoutine == null) return lastContinuable;
                return lastNonReturningSubRoutine;
            }
            // label is found, but not a continuable location
            return FlowContext.NotContinuableContext;
        }
        current = current.getLocalParent();
    }
    // not found
    return null;
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:ProblemReporter.java   
public void unusedLabel(LabeledStatement statement) {
    int severity = computeSeverity(IProblem.UnusedLabel);
    if (severity == ProblemSeverities.Ignore) return;
    String[] arguments = new String[] {new String(statement.label)};
    this.handle(
        IProblem.UnusedLabel,
        arguments,
        arguments,
        severity,
        statement.sourceStart,
        statement.labelEnd);
}
项目:xapi    文件:GwtAstBuilder.java   
@Override
public void endVisit(LabeledStatement x, BlockScope scope) {
  try {
    JStatement statement = pop(x.statement);
    if (statement == null) {
      push(null);
      return;
    }
    SourceInfo info = makeSourceInfo(x);
    push(new JLabeledStatement(info, getOrCreateLabel(info, x.label), statement));
  } catch (Throwable e) {
    throw translateException(x, e);
  }
}
项目:lombok-ianchiu    文件:SetGeneratedByVisitor.java   
@Override public boolean visit(LabeledStatement node, BlockScope scope) {
    fixPositions(setGeneratedBy(node, source));
    return super.visit(node, scope);
}
项目:EasyMPermission    文件:SetGeneratedByVisitor.java   
@Override public boolean visit(LabeledStatement node, BlockScope scope) {
    fixPositions(setGeneratedBy(node, source));
    return super.visit(node, scope);
}
项目:lombok    文件:SetGeneratedByVisitor.java   
@Override public boolean visit(LabeledStatement node, BlockScope scope) {
    setGeneratedBy(node, source);
    applyOffsetASTNode(node);
    return super.visit(node, scope);
}