private int getIntValue(Long number, ISyntaxNode node) throws SyntaxNodeException { if (number > Integer.MAX_VALUE || number < Integer.MIN_VALUE) { String message = String.format("Number %d is outside the valid range %d - %d", number.longValue(), Integer.MIN_VALUE, Integer.MAX_VALUE); throw SyntaxNodeExceptionUtils.createError(message, node); } return number.intValue(); }
public static void processError(String message, ISyntaxNode syntaxNode, Exception ex, IBindingContext bindingContext) { SyntaxNodeException error = SyntaxNodeExceptionUtils.createError(message, ex, syntaxNode); bindingContext.addError(error); }
public static void processError(String message, ISyntaxNode syntaxNode, Exception ex, IBindingContext bindingContext) { SyntaxNodeException error = SyntaxNodeExceptionUtils.createError(message, ex, syntaxNode); bindingContext.addError(error); }
private void validateForeignTable(ITable foreignTable, String foreignKeyTableName) throws SyntaxNodeException { if (foreignTable == null) { String message = String.format("Table '%s' is not found", foreignKeyTableName); throw SyntaxNodeExceptionUtils.createError(message, null, foreignKeyTable); } else if (foreignTable.getTableSyntaxNode().hasErrors()) { String message = String.format("Foreign table '%s' has errors", foreignKeyTableName); throw SyntaxNodeExceptionUtils.createError(message, null, foreignKeyTable); } }
protected IParsedCode getInvalidCode(String message, IOpenSourceCodeModule source) { SyntaxNodeException error = SyntaxNodeExceptionUtils.createError(message, source); SyntaxNodeException[] errors = new SyntaxNodeException[] { error }; return new ParsedCode(null, source, errors, null); } }
public static SyntaxNodeException createError(String message, Exception ex, ILocation location, IOpenSourceCodeModule source) { Logger logger = LoggerFactory.getLogger(SyntaxNodeExceptionUtils.class); logger.debug(message, ex); return new SyntaxNodeException(message, ex, location, source); }
public static SyntaxNodeException createError(Exception ex, ILocation location, IOpenSourceCodeModule source) { return createError(formatErrorMessage(ex), ex, location, source); }
/** * Gets code that cannot be parsed by parser. * * @param source source * @return {@link IParsedCode} instance */ private IParsedCode getInvalidCode(IOpenSourceCodeModule source) { String message = String.format("Invalid source type: %s", source.getUri()); SyntaxNodeException error = SyntaxNodeExceptionUtils.createError(message, source); return new ParsedCode(null, source, new SyntaxNodeException[] { error }, null); }
private void addError(Collection<OpenLMessage> messages, TableSyntaxNode tableSyntaxNode, String message) { SyntaxNodeException sne = SyntaxNodeExceptionUtils.createError(message, tableSyntaxNode); tableSyntaxNode.addError(sne); messages.add(OpenLMessagesUtils.newErrorMessage(sne)); }
/** * Gets code that cannot be parsed by parser. * * @param source source * @return {@link IParsedCode} instance */ private IParsedCode getInvalidCode(IOpenSourceCodeModule source) { String message = String.format("Invalid source type: %s", source.getUri()); SyntaxNodeException error = SyntaxNodeExceptionUtils.createError(message, source); return new ParsedCode(null, source, new SyntaxNodeException[] { error }, null); }
protected static IBoundNode makeErrorNode(String message, ISyntaxNode node, IBindingContext bindingContext) { SyntaxNodeException error = SyntaxNodeExceptionUtils.createError(message, node); bindingContext.addError(error); return new ErrorBoundNode(node); }
protected static IBoundNode makeErrorNode(Exception exception, ISyntaxNode node, IBindingContext bindingContext) { SyntaxNodeException error = SyntaxNodeExceptionUtils.createError(exception, node); bindingContext.addError(error); return new ErrorBoundNode(node); }
protected static IBoundNode makeErrorNode(String message, Exception exception, ISyntaxNode node, IBindingContext bindingContext) { SyntaxNodeException error = SyntaxNodeExceptionUtils.createError(message, exception, node); bindingContext.addError(error); return new ErrorBoundNode(node); }
private SyntaxNodeException createIndexNotFoundError(ITable foreignTable, ILogicalTable valuesTable, String src, Exception ex, IBindingContext bindingContext) { String message = String .format("Index Key %s is not found in the foreign table %s", src, foreignTable.getName()); return SyntaxNodeExceptionUtils .createError(message, ex, null, new GridCellSourceCodeModule(valuesTable.getSource(), bindingContext)); }
private void setOpenl(OpenlSyntaxNode openl) { if (this.openl == null) { this.openl = openl; } else { if (!this.openl.getOpenlName().equals(openl.getOpenlName())) { SyntaxNodeException error = SyntaxNodeExceptionUtils .createError("Only one openl statement is allowed", null, openl); addError(error); } } } }
public IBoundNode bind(ISyntaxNode node, IBindingContext bindingContext) throws Exception { if (node.getNumberOfChildren() != 2) { throw SyntaxNodeExceptionUtils.createError("Binary node must have 2 subnodes", node); } int index = node.getType().lastIndexOf('.'); String methodName = node.getType().substring(index + 1); IBoundNode[] children = bindChildren(node, bindingContext); return bindOperator(node, methodName, children[0], children[1], bindingContext); }
private String getName(ILogicalTable row, IBindingContext cxt) throws OpenLCompilationException { GridCellSourceCodeModule nameCellSource = getCellSource(row, cxt, 1); IdentifierNode[] idn = getIdentifierNode(nameCellSource); if (idn.length != 1) { String errorMessage = String.format("Bad field name: %s", nameCellSource.getCode()); throw SyntaxNodeExceptionUtils.createError(errorMessage, null, null, nameCellSource); } else { return idn[0].getIdentifier(); } }
public IBoundNode bind(ISyntaxNode node, IBindingContext bindingContext) throws Exception { if (node.getNumberOfChildren() != 2) { throw SyntaxNodeExceptionUtils.createError("Binary node must have 2 subnodes", node); } int index = node.getType().lastIndexOf('.'); String methodName = node.getType().substring(index + 1); IBoundNode[] children = bindChildren(node, bindingContext); return bindOperator(node, methodName, children[0], children[1], bindingContext); }
private String getName(ILogicalTable row, IBindingContext cxt) throws OpenLCompilationException { GridCellSourceCodeModule nameCellSource = DatatypeTableBoundNode.getCellSource(row, cxt, 1); IdentifierNode[] idn = DatatypeTableBoundNode.getIdentifierNode(nameCellSource); if (idn.length != 1) { String errorMessage = String.format("Bad constant name: %s", nameCellSource.getCode()); throw SyntaxNodeExceptionUtils.createError(errorMessage, null, null, nameCellSource); } else { return idn[0].getIdentifier(); } }
private void registerIncludeError(TableSyntaxNode tableSyntaxNode, IGridTable table, int i, String include, Exception t) { SyntaxNodeException se = SyntaxNodeExceptionUtils.createError("Include '" + include + "' is not found", t, LocationUtils.createTextInterval(include), new GridCellSourceCodeModule(table, 1, i, null)); addError(se); tableSyntaxNode.addError(se); }