protected IConditionEvaluator[] prepareConditions() throws Exception { int nConditions = table.getNumberOfConditions(); final IConditionEvaluator[] evaluators = new IConditionEvaluator[nConditions]; SyntaxNodeExceptionCollector syntaxNodeExceptionCollector = new SyntaxNodeExceptionCollector(); for (int i = 0; i < nConditions; i++) { final int index = i; syntaxNodeExceptionCollector.run(new Runnable() { @Override public void run() throws Exception { ICondition condition = table.getCondition(index); evaluators[index] = prepareCondition(condition); } }); } syntaxNodeExceptionCollector.throwIfAny("Error:"); return evaluators; }
private void prepareParamValues(CompositeMethod method, OpenlToolAdaptor ota, RuleRow ruleRow) throws Exception { int len = nValues(); IParameterDeclaration[] paramDecl = getParams(method.getMethodBodyBoundNode().getSyntaxNode().getModule(), method.getSignature(), method.getDeclaringClass(), method.getType(), ota.getOpenl(), ota.getBindingContext()); boolean[] paramIndexed = getParamIndexed(paramDecl); IStorageBuilder<?>[] builders = makeStorageBuilders(len, paramDecl); SyntaxNodeExceptionCollector syntaxNodeExceptionCollector = new SyntaxNodeExceptionCollector(); int actualStorageSize = scale.getActualSize(len); for (int i = 0; i < actualStorageSize; i++) { int ruleN = scale.getLogicalIndex(i); loadParamsFromColumn(ota, ruleRow, paramDecl, paramIndexed, syntaxNodeExceptionCollector, ruleN, builders); } syntaxNodeExceptionCollector.throwIfAny("Error:"); storage = new IStorage<?>[builders.length]; for (int i = 0; i < builders.length; i++) { storage[i] = builders[i].optimizeAndBuild(); } }
public void throwIfAny() throws SyntaxNodeException { throwIfAny(StringUtils.EMPTY); }
syntaxNodeExceptionCollector.addSyntaxNodeException(e);
public void throwIfAny() throws SyntaxNodeException { throwIfAny(StringUtils.EMPTY); }
private void addConstants(final IBindingContext cxt) throws Exception { final ILogicalTable dataTable = DatatypeHelper.getNormalizedDataPartTable(table, openl, cxt); normalizedData = dataTable; int tableHeight = 0; if (dataTable != null) { tableHeight = dataTable.getHeight(); } SyntaxNodeExceptionCollector syntaxNodeExceptionCollector = new SyntaxNodeExceptionCollector(); for (int i = 0; i < tableHeight; i++) { final int index = i; syntaxNodeExceptionCollector.run(new Runnable() { @Override public void run() throws Exception { ILogicalTable row = dataTable.getRow(index); processRow(row, cxt); } }); } syntaxNodeExceptionCollector.throwIfAny(); }
private void checkInheritedFieldsDuplication(final IBindingContext cxt) throws Exception { final IOpenClass superClass = dataType.getSuperClass(); if (superClass != null) { SyntaxNodeExceptionCollector syntaxNodeExceptionCollector = new SyntaxNodeExceptionCollector(); for (final Entry<String, IOpenField> field : dataType.getDeclaredFields().entrySet()) { syntaxNodeExceptionCollector.run(new Runnable() { @Override public void run() throws Exception { IOpenField fieldInParent = superClass.getField(field.getKey()); if (fieldInParent != null) { if (fieldInParent.getType().getInstanceClass().equals( field.getValue().getType().getInstanceClass())) { BindHelper .processWarn(String.format("Field [%s] has been already defined in class \"%s\"", field.getKey(), fieldInParent.getDeclaringClass().getDisplayName(0)), tableSyntaxNode, cxt); } else { throw SyntaxNodeExceptionUtils.createError(String.format( "Field [%s] has been already defined in class \"%s\" with another type", field.getKey(), fieldInParent.getDeclaringClass().getDisplayName(0)), tableSyntaxNode); } } } }); } syntaxNodeExceptionCollector.throwIfAny(); } }
private List<RuntimeOperation> compileNestedNodes(List<AlgorithmTreeNode> nodesToProcess) throws Exception { final List<RuntimeOperation> emittedOperations = new ArrayList<RuntimeOperation>(); SyntaxNodeExceptionCollector syntaxNodeExceptionCollector = new SyntaxNodeExceptionCollector(); // process nodes by groups of linked nodes for (int i = 0, linkedNodesGroupSize; i < nodesToProcess.size(); i += linkedNodesGroupSize) { if (hasUnreachableCode(nodesToProcess, i)) { IOpenSourceCodeModule errorSource = nodesToProcess.get(i + 1).getAlgorithmRow().getOperation() .asSourceCodeModule(); throw SyntaxNodeExceptionUtils.createError("Unreachable code. Operations after BREAK,CONTINUE not allowed.", errorSource); } linkedNodesGroupSize = AlgorithmCompilerTool.getLinkedNodesGroupSize(nodesToProcess, i); final List<AlgorithmTreeNode> nodesToCompile = nodesToProcess.subList(i, i + linkedNodesGroupSize); syntaxNodeExceptionCollector.run(new Runnable() { @Override public void run() throws Exception { emittedOperations.addAll(compileLinkedNodesGroup(nodesToCompile)); } }); } syntaxNodeExceptionCollector.throwIfAny("Compilation fails!"); return emittedOperations; }
SyntaxNodeExceptionCollector syntaxNodeExceptionCollector = new SyntaxNodeExceptionCollector(); for (int i = 0; i < tableHeight; i++) { final int index = i; syntaxNodeExceptionCollector.run(new Runnable() { @Override public void run() throws Exception { syntaxNodeExceptionCollector.run(new Runnable() { @Override public void run() throws Exception { syntaxNodeExceptionCollector.throwIfAny();