@Override public void emitLabelStatement(LabeledStatementNode node) { writeToken(node.getLabel()); writeToken(ASEmitterTokens.COLON); getWalker().walk(node.getLabeledStatement()); }
@Override boolean hasContinueLabel(String label) { IASNode loopNode = controlFlowTreeNode.getParent(); assert loopNode != null; IASNode loopNodeParent = loopNode.getParent(); if (loopNodeParent == null) return false; IASNode loopNodeGrandParent = loopNodeParent.getParent(); if (!(loopNodeGrandParent instanceof LabeledStatementNode)) return false; LabeledStatementNode labeledStatementNode = (LabeledStatementNode)loopNodeGrandParent; String labeledStatementNodeLabel = labeledStatementNode.getLabel(); if (labeledStatementNodeLabel == null) return false; return labeledStatementNodeLabel.equals(label); } }
labelT != null ? labelT.getText() : "", labelT); statementNode = new LabeledStatementNode(labelNode); c.addItem(statementNode); substatement(statementNode.getLabeledStatement());
@Override public void emitLabelStatement(LabeledStatementNode node) { BlockNode innerBlock = node.getLabeledStatement(); if (innerBlock.getChildCount() == 1 && innerBlock.getChild(0).getNodeID() == ASTNodeID.ForEachLoopID) { getWalker().walk(node.getLabeledStatement()); return; // for each emitter will emit label in the right spot } super.emitLabelStatement(node); }
@Override boolean hasContinueLabel(String label) { IASNode loopNode = controlFlowTreeNode.getParent(); assert loopNode != null; IASNode loopNodeParent = loopNode.getParent(); if (loopNodeParent == null) return false; IASNode loopNodeGrandParent = loopNodeParent.getParent(); if (!(loopNodeGrandParent instanceof LabeledStatementNode)) return false; LabeledStatementNode labeledStatementNode = (LabeledStatementNode)loopNodeGrandParent; String labeledStatementNodeLabel = labeledStatementNode.getLabel(); if (labeledStatementNodeLabel == null) return false; return labeledStatementNodeLabel.equals(label); } }
labelT != null ? labelT.getText() : "", labelT); statementNode = new LabeledStatementNode(labelNode); c.addItem(statementNode); substatement(statementNode.getLabeledStatement());
String labelName = labelNode.getLabel(); if (labelName != null) labelMap.put(labelName, labelNode); populateLabelMap(labelMap, labelNode.getLabeledStatement());
/** * Called by a reduction's Prologue section to establish an active * {@link LabeledStatementControlFlowContext}. * * @param labeledStatement The syntax tree node for the labeled statement. */ public void startLabeledStatementControlFlowContext(LabeledStatementNode labeledStatement) throws DuplicateLabelException { String labelName = labeledStatement.getLabel(); // Scan the active control-flow contexts for a duplicate label. boolean is_duplicate = findControlFlowContextNoError(breakWithLabelCriteria(labelName)) != CONTEXT_NOT_FOUND; activeFlowContexts.add(new LabeledStatementControlFlowContext(labeledStatement, labelName)); // Throw the exception after establishing the (duplicate) context // so that the control-flow context teardown code works for this case. if ( is_duplicate ) { throw new DuplicateLabelException(labelName); } }
String labelName = labelNode.getLabel(); if (labelName != null) labelMap.put(labelName, labelNode); populateLabelMap(labelMap, labelNode.getLabeledStatement());
/** * Called by a reduction's Prologue section to establish an active * {@link LabeledStatementControlFlowContext}. * * @param labeledStatement The syntax tree node for the labeled statement. */ public void startLabeledStatementControlFlowContext(LabeledStatementNode labeledStatement) throws DuplicateLabelException { String labelName = labeledStatement.getLabel(); // Scan the active control-flow contexts for a duplicate label. boolean is_duplicate = findControlFlowContextNoError(breakWithLabelCriteria(labelName)) != CONTEXT_NOT_FOUND; activeFlowContexts.add(new LabeledStatementControlFlowContext(labeledStatement, labelName)); // Throw the exception after establishing the (duplicate) context // so that the control-flow context teardown code works for this case. if ( is_duplicate ) { throw new DuplicateLabelException(labelName); } }
writeToken(labelNode.getLabel()); writeToken(ASEmitterTokens.COLON);