@Override public void visit(BranchingStatement obj) { boolean matchedLabel = false; boolean inLoop = false; for (LanguageObject lo : stack) { if (lo instanceof LoopStatement || lo instanceof WhileStatement) { inLoop = true; if (obj.getLabel() == null) { break; } matchedLabel |= obj.getLabel().equalsIgnoreCase(((Labeled)lo).getLabel()); } else if (obj.getLabel() != null && lo instanceof Block && obj.getLabel().equalsIgnoreCase(((Block)lo).getLabel())) { matchedLabel = true; if (obj.getMode() != BranchingMode.LEAVE) { handleValidationError(QueryPlugin.Util.getString("ValidationVisitor.invalid_label", obj.getLabel()), obj); //$NON-NLS-1$ } } } if (obj.getMode() != BranchingMode.LEAVE && !inLoop) { handleValidationError(QueryPlugin.Util.getString("ValidationVisitor.no_loop"), obj); //$NON-NLS-1$ } if (obj.getLabel() != null && !matchedLabel) { handleValidationError(QueryPlugin.Util.getString("ValidationVisitor.unknown_block_label", obj.getLabel()), obj); //$NON-NLS-1$ } }
@Override public void visit(BranchingStatement obj) { boolean matchedLabel = false; boolean inLoop = false; for (LanguageObject lo : stack) { if (lo instanceof LoopStatement || lo instanceof WhileStatement) { inLoop = true; if (obj.getLabel() == null) { break; } matchedLabel |= obj.getLabel().equalsIgnoreCase(((Labeled)lo).getLabel()); } else if (obj.getLabel() != null && lo instanceof Block && obj.getLabel().equalsIgnoreCase(((Block)lo).getLabel())) { matchedLabel = true; if (obj.getMode() != BranchingMode.LEAVE) { handleValidationError(QueryPlugin.Util.getString("ValidationVisitor.invalid_label", obj.getLabel()), obj); //$NON-NLS-1$ } } } if (obj.getMode() != BranchingMode.LEAVE && !inLoop) { handleValidationError(QueryPlugin.Util.getString("ValidationVisitor.no_loop"), obj); //$NON-NLS-1$ } if (obj.getLabel() != null && !matchedLabel) { handleValidationError(QueryPlugin.Util.getString("ValidationVisitor.unknown_block_label", obj.getLabel()), obj); //$NON-NLS-1$ } }
@Override public void visit(BranchingStatement obj) { boolean matchedLabel = false; boolean inLoop = false; for (LanguageObject lo : stack) { if (lo instanceof LoopStatement || lo instanceof WhileStatement) { inLoop = true; if (obj.getLabel() == null) { break; } matchedLabel |= obj.getLabel().equalsIgnoreCase(((Labeled)lo).getLabel()); } else if (obj.getLabel() != null && lo instanceof Block && obj.getLabel().equalsIgnoreCase(((Block)lo).getLabel())) { matchedLabel = true; if (obj.getMode() != BranchingMode.LEAVE) { handleValidationError(QueryPlugin.Util.getString("ValidationVisitor.invalid_label", obj.getLabel()), obj); //$NON-NLS-1$ } } } if (obj.getMode() != BranchingMode.LEAVE && !inLoop) { handleValidationError(QueryPlugin.Util.getString("ValidationVisitor.no_loop"), obj); //$NON-NLS-1$ } if (obj.getLabel() != null && !matchedLabel) { handleValidationError(QueryPlugin.Util.getString("ValidationVisitor.unknown_block_label", obj.getLabel()), obj); //$NON-NLS-1$ } }
public void process(ProcedurePlan env) throws TeiidComponentException { Program parentProgram = env.peek(); //find the parent program that contains the loop/while instruction while(true){ if (bs.getMode() == BranchingMode.LEAVE && bs.getLabel().equalsIgnoreCase(parentProgram.getLabel())) { env.pop(true); break; } if(parentProgram.getCurrentInstruction() instanceof RepeatedInstruction){ if (bs.getLabel() == null) { break; } RepeatedInstruction ri = (RepeatedInstruction)parentProgram.getCurrentInstruction(); if (bs.getLabel().equalsIgnoreCase(ri.getLabel())) { break; } } env.pop(true); parentProgram = env.peek(); } if (bs.getMode() != BranchingMode.CONTINUE) { env.incrementProgramCounter(); } }
@Override public void visit( BranchingStatement obj ) { switch (obj.getMode()) { case CONTINUE: append(CONTINUE); break; case BREAK: append(BREAK); break; case LEAVE: append(LEAVE); break; } if (obj.getLabel() != null) { append(SPACE); outputDisplayName(obj.getLabel()); } append(";"); //$NON-NLS-1$ }
public void process(ProcedurePlan env) throws TeiidComponentException { Program parentProgram = env.peek(); //find the parent program that contains the loop/while instruction while(true){ if (bs.getMode() == BranchingMode.LEAVE && bs.getLabel().equalsIgnoreCase(parentProgram.getLabel())) { env.pop(true); break; } if(parentProgram.getCurrentInstruction() instanceof RepeatedInstruction){ if (bs.getLabel() == null) { break; } RepeatedInstruction ri = (RepeatedInstruction)parentProgram.getCurrentInstruction(); if (bs.getLabel().equalsIgnoreCase(ri.getLabel())) { break; } } env.pop(true); parentProgram = env.peek(); } if (bs.getMode() != BranchingMode.CONTINUE) { env.incrementProgramCounter(); } }
public void process(ProcedurePlan env) throws TeiidComponentException { Program parentProgram = env.peek(); //find the parent program that contains the loop/while instruction while(true){ if (bs.getMode() == BranchingMode.LEAVE && bs.getLabel().equalsIgnoreCase(parentProgram.getLabel())) { env.pop(true); break; } if(parentProgram.getCurrentInstruction() instanceof RepeatedInstruction){ if (bs.getLabel() == null) { break; } RepeatedInstruction ri = (RepeatedInstruction)parentProgram.getCurrentInstruction(); if (bs.getLabel().equalsIgnoreCase(ri.getLabel())) { break; } } env.pop(true); parentProgram = env.peek(); } if (bs.getMode() != BranchingMode.CONTINUE) { env.incrementProgramCounter(); } }
@Override public void visit( BranchingStatement obj ) { switch (obj.getMode()) { case CONTINUE: append(CONTINUE); break; case BREAK: append(BREAK); break; case LEAVE: append(LEAVE); break; } if (obj.getLabel() != null) { append(SPACE); outputDisplayName(obj.getLabel()); } append(";"); //$NON-NLS-1$ }
@Override public void visit( BranchingStatement obj ) { switch (obj.getMode()) { case CONTINUE: append(CONTINUE); break; case BREAK: append(BREAK); break; case LEAVE: append(LEAVE); break; } if (obj.getLabel() != null) { append(SPACE); outputDisplayName(obj.getLabel()); } append(";"); //$NON-NLS-1$ }