public ILocation getLocation() { if (node != null) { ISyntaxNode syntaxNode = node.getSyntaxNode(); if (syntaxNode != null) { return syntaxNode.getSourceLocation(); } } return null; }
public ILocation getLocation() { if (node != null) { ISyntaxNode syntaxNode = node.getSyntaxNode(); if (syntaxNode != null) { return syntaxNode.getSourceLocation(); } } return null; }
public SyntaxNodeException(String message, Throwable cause, ISyntaxNode syntaxNode) { this(message, cause, syntaxNode == null ? null : syntaxNode.getSourceLocation(), syntaxNode == null ? null : syntaxNode.getModule()); this.syntaxNode = syntaxNode; }
public SyntaxNodeException(String message, Throwable cause, ISyntaxNode syntaxNode) { this(message, cause, syntaxNode == null ? null : syntaxNode.getSourceLocation(), syntaxNode == null ? null : syntaxNode.getModule()); this.syntaxNode = syntaxNode; }
@Override public String getSourceLocation() { return SourceCodeURLTool.makeSourceLocationURL(source.getSourceLocation(), source.getModule()); }
@Override public String getSourceLocation() { return SourceCodeURLTool.makeSourceLocationURL(source.getSourceLocation(), source.getModule()); }
protected String getUri(OpenLMessage message) { OpenLWarnMessage warnMessage = (OpenLWarnMessage) message; ISyntaxNode syntaxNode = warnMessage.getSource(); return SourceCodeURLTool.makeSourceLocationURL(syntaxNode.getSourceLocation(), syntaxNode.getModule(), ""); }
public ILocation getSourceLocation() { if (location == null) { int n = getNumberOfChildren(); switch (n) { case 0: return null; case 1: return getChild(0).getSourceLocation(); default: ILocation startLocation = getChild(0).getSourceLocation(); if (startLocation == null) { return null; } ILocation endLocation = getChild(n - 1).getSourceLocation(); if (endLocation == null) { return null; } return new TextInterval(startLocation.getStart(), endLocation.getEnd()); } } return location; }
public ILocation getSourceLocation() { if (location == null) { int n = getNumberOfChildren(); switch (n) { case 0: return null; case 1: return getChild(0).getSourceLocation(); default: ILocation startLocation = getChild(0).getSourceLocation(); if (startLocation == null) { return null; } ILocation endLocation = getChild(n - 1).getSourceLocation(); if (endLocation == null) { return null; } return new TextInterval(startLocation.getStart(), endLocation.getEnd()); } } return location; }
public IBoundNode bind(ISyntaxNode node, IBindingContext bindingContext) throws Exception { String longName = concatChildren(node); IdentifierNode newNode = new IdentifierNode("identifier.nostrict", node.getSourceLocation(), longName, node.getModule()); return bindChildNode(newNode, bindingContext); }
public IBoundNode bind(ISyntaxNode node, IBindingContext bindingContext) throws Exception { String longName = concatChildren(node); IdentifierNode newNode = new IdentifierNode("identifier.nostrict", node.getSourceLocation(), longName, node.getModule()); return bindChildNode(newNode, bindingContext); }
public ILocation getParamTypeLocation(int paramNum) { // 0-th child is param type, 1-st child is param name. See ParameterDeclarationNodeBinder ISyntaxNode typeNode = children[paramNum].getSyntaxNode().getChild(0); while (typeNode.getNumberOfChildren() == 1 && !(typeNode instanceof IdentifierNode)) { // Get type node for array typeNode = typeNode.getChild(0); } return typeNode.getSourceLocation(); }
public ILocation getParamTypeLocation(int paramNum) { // 0-th child is param type, 1-st child is param name. See ParameterDeclarationNodeBinder ISyntaxNode typeNode = children[paramNum].getSyntaxNode().getChild(0); while (typeNode.getNumberOfChildren() == 1 && !(typeNode instanceof IdentifierNode)) { // Get type node for array typeNode = typeNode.getChild(0); } return typeNode.getSourceLocation(); }
@Override public IBoundNode bindTarget(ISyntaxNode node, IBindingContext bindingContext, IBoundNode target) { try { String longName = concatChildren(node); IdentifierNode newNode = new IdentifierNode("identifier.nostrict", node.getSourceLocation(), longName, node.getModule()); return bindTargetNode(newNode, bindingContext, target); } catch (Exception e) { return makeErrorNode("Cannot bind node", e, node, bindingContext); } }
@Override public IBoundNode bindTarget(ISyntaxNode node, IBindingContext bindingContext, IBoundNode target) { try { String longName = concatChildren(node); IdentifierNode newNode = new IdentifierNode("identifier.nostrict", node.getSourceLocation(), longName, node.getModule()); return bindTargetNode(newNode, bindingContext, target); } catch (Exception e) { return makeErrorNode("Cannot bind node", e, node, bindingContext); } }
public String[] getErrorCode() { OpenLMessage message = (OpenLMessage) messages.getRowData(); ILocation location = null; IOpenSourceCodeModule module = null; if (message instanceof OpenLErrorMessage) { OpenLErrorMessage errorMessage = (OpenLErrorMessage) message; OpenLException error = errorMessage.getError(); location = error.getLocation(); module = error.getSourceModule(); } else if (message instanceof OpenLWarnMessage) { OpenLWarnMessage warnMessage = (OpenLWarnMessage) message; ISyntaxNode source = warnMessage.getSource(); location = source.getSourceLocation(); module = source.getModule(); } return getErrorCode(location, module); }
public String[] getErrorCode() { OpenLMessage message = (OpenLMessage) messages.getRowData(); ILocation location = null; IOpenSourceCodeModule module = null; if (message instanceof OpenLErrorMessage) { OpenLErrorMessage errorMessage = (OpenLErrorMessage) message; OpenLException error = errorMessage.getError(); location = error.getLocation(); module = error.getSourceModule(); } else if (message instanceof OpenLWarnMessage) { OpenLWarnMessage warnMessage = (OpenLWarnMessage) message; ISyntaxNode source = warnMessage.getSource(); location = source.getSourceLocation(); module = source.getModule(); } return getErrorCode(location, module); }
public IBoundNode bind(ISyntaxNode node, IBindingContext bindingContext) throws Exception { String text = node.getModule().getCode(); TextInfo info = new TextInfo(text); IOpenSourceCodeModule sourceModule = new SubTextSourceCodeModule(node.getModule(), node.getSourceLocation() .getStart() .getAbsolutePosition(info), node.getSourceLocation().getEnd().getAbsolutePosition(info) + 1); IdentifierNode[] rangeParts = Tokenizer.tokenize(sourceModule, ":"); if (rangeParts.length != 2){ return makeErrorNode("Wrong Range format: " + sourceModule.getCode(), node, bindingContext); } IOpenField om = bindingContext.findRange(ISyntaxConstants.THIS_NAMESPACE, rangeParts[0].getIdentifier(), rangeParts[1].getIdentifier()); if (om != null) { return new FieldBoundNode(node, om); } return null; } }
public IBoundNode bind(ISyntaxNode node, IBindingContext bindingContext) throws Exception { String text = node.getModule().getCode(); TextInfo info = new TextInfo(text); IOpenSourceCodeModule sourceModule = new SubTextSourceCodeModule(node.getModule(), node.getSourceLocation() .getStart() .getAbsolutePosition(info), node.getSourceLocation().getEnd().getAbsolutePosition(info) + 1); IdentifierNode[] rangeParts = Tokenizer.tokenize(sourceModule, ":"); if (rangeParts.length != 2){ return makeErrorNode("Wrong Range format: " + sourceModule.getCode(), node, bindingContext); } IOpenField om = bindingContext.findRange(ISyntaxConstants.THIS_NAMESPACE, rangeParts[0].getIdentifier(), rangeParts[1].getIdentifier()); if (om != null) { return new FieldBoundNode(node, om); } return null; } }
private void addMetaInfo(ISyntaxNode node, String workbook, String sheet, Integer row, Integer column, Integer endRow, Integer endColumn) { IOpenSourceCodeModule src = node.getModule(); TextInfo text = new TextInfo(src.getCode()); ILocation location = node.getSourceLocation(); int absoluteStart = location.getStart().getAbsolutePosition(text); int absoluteEnd = location.getEnd().getAbsolutePosition(text); if (src instanceof CompositeSourceCodeModule) { int line = location.getStart().getLine(text); int lineStart = text.getPosition(line); src = ((CompositeSourceCodeModule) src).getModules()[line]; addMetaInfo(workbook, sheet, row, column, endRow, endColumn, src, absoluteStart - lineStart, absoluteEnd - lineStart); } else { addMetaInfo(workbook, sheet, row, column, endRow, endColumn, src, absoluteStart, absoluteEnd); } }