@Override protected void emitUnassignedTokens(EObject semanticObject, ISynTransition transition, INode fromNode, INode toNode) { if (transition.getAmbiguousSyntaxes().isEmpty()) return; List<INode> transitionNodes = collectNodes(fromNode, toNode); for (AbstractElementAlias syntax : transition.getAmbiguousSyntaxes()) { List<INode> syntaxNodes = getNodesFor(transitionNodes, syntax); if (match_Disjunction_VerticalLineKeyword_0_1_1_0_a.equals(syntax)) emit_Disjunction_VerticalLineKeyword_0_1_1_0_a(semanticObject, getLastNavigableState(), syntaxNodes); else if (match_Disjunction_VerticalLineKeyword_0_1_1_0_p.equals(syntax)) emit_Disjunction_VerticalLineKeyword_0_1_1_0_p(semanticObject, getLastNavigableState(), syntaxNodes); else if (match_Disjunction_VerticalLineKeyword_1_1_0_a.equals(syntax)) emit_Disjunction_VerticalLineKeyword_1_1_0_a(semanticObject, getLastNavigableState(), syntaxNodes); else if (match_Disjunction_VerticalLineKeyword_1_1_0_p.equals(syntax)) emit_Disjunction_VerticalLineKeyword_1_1_0_p(semanticObject, getLastNavigableState(), syntaxNodes); else acceptNodes(getLastNavigableState(), syntaxNodes); } }
/** * Get JSDoc comment for the given element. The element may be an AST node such as <code>N4MethodDeclaration</code> * or a type model element such as <code>TMethod</code>. In the latter case, this method will follow the link to the * AST which may cause a load of the N4JS resource if it is not fully loaded (i.e. if only the TModule was loaded * from the Xtext index). * <p> * Thus, <b>this method may have a side effect on the containing resource of the given element</b>. If that is not * desired, use method {@link #getDocSafely(ResourceSet, EObject)} instead. */ public String getDoc(EObject element) { if (element == null) throw new IllegalArgumentException("element must not be null"); if (element.eIsProxy()) { return null; // throw new IllegalArgumentException("element must not be proxy: " + element.toString()); } final List<INode> docNodes = documentationProviderExt.getDocumentationNodes(element); if (!docNodes.isEmpty()) { final StringBuilder sb = new StringBuilder(docNodes.get(0).getText()); for (int idx = 1; idx < docNodes.size(); idx++) { sb.append("\n").append(docNodes.get(idx).getText()); } return sb.toString(); } return null; }
@Override public BigDecimal toValue(String string, INode node) { if (Strings.isEmpty(string)) throw new N4JSValueConverterException(IssueCodes.getMessageForVCO_BINARYINT_CONVERT_EMPTY_STR(), IssueCodes.VCO_BINARYINT_CONVERT_EMPTY_STR, node, null); if (string.length() <= 2) { throw new N4JSValueConverterWithValueException( IssueCodes.getMessageForVCO_BINARYINT_CONVERT_TOO_SHORT(string), IssueCodes.VCO_BINARYINT_CONVERT_TOO_SHORT, node, BigDecimal.ZERO, null); } try { return new BigDecimal(new BigInteger(string.substring(2), 2)); } catch (NumberFormatException e) { throw new N4JSValueConverterException(IssueCodes.getMessageForVCO_HEXINT_CONVERT_STR(string), IssueCodes.VCO_HEXINT_CONVERT_STR, node, null); } }
/** * Naive comment lookup, that doesn't consider parent. Returns comment that is closest to the lookup element. If * flag is provided includes doublestar comments into search. Doublestar comments are prioritized over single star * comments. * * Throws {@link InstantiationException} when it stumbles upon MultiLine comment that doesn't start with proper * markers (</*> and <*\/>) * * @param eObject * element on which lookup is performed * @param considerDoubleStar * swithc to include in luukup comments with double star * @return CommentCandidate for given eObject. * @throws InstantiationException * if comment on element is malformatted. */ public CommentCandidate findJSDocComment(EObject eObject, boolean considerDoubleStar) throws InstantiationException { if (eObject == null) { return null; } List<INode> comments = findMultiLineComments(eObject); // fast result if (comments == null || comments.isEmpty()) { return null; } if (considerDoubleStar) { return pickCommentConsiderDoubleStar(comments); } return pickCommentNoDoubleStar(comments); }
/** * This is aware of warnings from the {@link N4JSStringValueConverter}. * * Issues from the parser are commonly treated as errors but here we want to create a warning. */ @Override protected void addSyntaxErrors() { if (isValidationDisabled()) return; // EList.add unnecessarily checks for uniqueness by default // so we use #addUnique below to save some CPU cycles for heavily broken // models BasicEList<Diagnostic> errorList = (BasicEList<Diagnostic>) getErrors(); BasicEList<Diagnostic> warningList = (BasicEList<Diagnostic>) getWarnings(); for (INode error : getParseResult().getSyntaxErrors()) { XtextSyntaxDiagnostic diagnostic = createSyntaxDiagnostic(error); String code = diagnostic.getCode(); if (AbstractN4JSStringValueConverter.WARN_ISSUE_CODE.equals(code) || RegExLiteralConverter.ISSUE_CODE.equals(code) || LegacyOctalIntValueConverter.ISSUE_CODE.equals(code)) { warningList.addUnique(diagnostic); } else if (!InternalSemicolonInjectingParser.SEMICOLON_INSERTED.equals(code)) { errorList.addUnique(diagnostic); } } }
private XtextSyntaxDiagnostic createSyntaxDiagnostic(INode error) { SyntaxErrorMessage syntaxErrorMessage = error.getSyntaxErrorMessage(); if (org.eclipse.xtext.diagnostics.Diagnostic.SYNTAX_DIAGNOSTIC_WITH_RANGE.equals(syntaxErrorMessage .getIssueCode())) { String[] issueData = syntaxErrorMessage.getIssueData(); if (issueData.length == 1) { String data = issueData[0]; int colon = data.indexOf(':'); return new XtextSyntaxDiagnosticWithRange(error, Integer.valueOf(data.substring(0, colon)), Integer.valueOf(data.substring(colon + 1)), null) { @Override public int getLine() { return getNode().getTotalStartLine(); } }; } } return new XtextSyntaxDiagnostic(error); }
@Override public String serializeCrossRef(EObject semanticObject, CrossReference crossref, EObject target, INode node, Acceptor errors) { if (((InternalEObject) target).eProxyURI() != null) { if (((InternalEObject) target).eProxyURI().toString().startsWith("#")) { return super.serializeCrossRef(semanticObject, crossref, getEObjectfromEProxy(semanticObject, target), node, errors); } } return super.serializeCrossRef(semanticObject, crossref, target, node, errors); }
@Override protected void emitUnassignedTokens(EObject semanticObject, ISynTransition transition, INode fromNode, INode toNode) { if (transition.getAmbiguousSyntaxes().isEmpty()) return; List<INode> transitionNodes = collectNodes(fromNode, toNode); for (AbstractElementAlias syntax : transition.getAmbiguousSyntaxes()) { List<INode> syntaxNodes = getNodesFor(transitionNodes, syntax); acceptNodes(getLastNavigableState(), syntaxNodes); } }
@Override public Location getLocation(EObject eObject) { INode node = NodeModelUtils.getNode(eObject); if (node != null) { return new Location(Type.XTEXT_LOCATION, node.getStartLine()); } return new Location(Type.XTEXT_LOCATION, -1); }
/** * Select comment closest to lookup element. Assume comments to be ordered list. Includes comments with doublestar * in search results. DoubleStar comments are prioritized over singlestar comemnts. * * @param comments * list of commnets on luukup elements * @throws InstantiationException * if comment is malformed */ protected CommentCandidate pickCommentConsiderDoubleStar(List<INode> comments) throws InstantiationException { // one commemnt - wins if (comments.size() == 1) { return new CommentCandidate(comments.get(0).getText()); } // multiple comments // arrList has reversed order ListIterator<INode> iter = comments.listIterator(comments.size()); // so far best candidate String bestCandidateString = iter.previous().getText(); if (bestCandidateString.startsWith("/**")) { return new CommentCandidate(bestCandidateString); // automatic win } // if we get here we have first single star comment, so // check if there is supreme candidate String candidateTextString = ""; while (iter.hasPrevious()) { candidateTextString = iter.previous().getText(); if (candidateTextString.startsWith("/**")) { bestCandidateString = candidateTextString; break; // first supreme wins } } return new CommentCandidate(bestCandidateString); }
@Override public BigDecimal toValue(String string, INode node) { if (Strings.isEmpty(string)) throw new ValueConverterException("Couldn't convert empty string to an int value.", node, null); try { return new BigDecimal(string); } catch (NumberFormatException e) { throw new ValueConverterException("Couldn't convert '" + string + "' to an int value.", node, e); } }
/** * Checks whether the dead code analysis produces the expected result: dead code found or no dead code found. * * @param expectation * "dead code" or "no dead code" * @param offset * the offset where the XPECT comment is used */ @Xpect @ParameterParser(syntax = "('at' arg1=OFFSET)?") public void deadCode(@StringExpectation IStringExpectation expectation, // @ThisResource XtextResource resource, INode offset) { if (offset == null) { return; } String actual = evaluateDeadCode(offset); expectation.assertEquals(actual); }
/***/ @Creates public IEObjectCoveringRegion IEObjectCoveringRegion() { final boolean haveRegion = region != null; int offset = haveRegion ? region.getOffset() : this.matchedOffset; int length = haveRegion ? region.getLength() : 0; int endOffset = offset + length; EObject semanticObject = null; INode node = NodeModelUtils.findLeafNodeAtOffset(resource.getParseResult().getRootNode(), offset); while (node != null) { EObject actualObject = NodeModelUtils.findActualSemanticObjectFor(node); if (actualObject != null) { if (haveRegion) { int nodeEndOffset = node.getEndOffset(); if (nodeEndOffset <= endOffset || semanticObject == null) { semanticObject = actualObject; } if (nodeEndOffset >= endOffset) { break; } } else { // no region given, just a matched offset if (semanticObject == null) { semanticObject = actualObject; break; } } } node = node.getParent(); } return new EObjectCoveringRegion(semanticObject, offset); }
@Override protected void emitUnassignedTokens(EObject semanticObject, ISynTransition transition, INode fromNode, INode toNode) { if (transition.getAmbiguousSyntaxes().isEmpty()) return; List<INode> transitionNodes = collectNodes(fromNode, toNode); for (AbstractElementAlias syntax : transition.getAmbiguousSyntaxes()) { List<INode> syntaxNodes = getNodesFor(transitionNodes, syntax); if (match_ProjectDescription___RightCurlyBracketKeyword_17_3_SourcesKeyword_17_0_LeftCurlyBracketKeyword_17_1__q.equals(syntax)) emit_ProjectDescription___RightCurlyBracketKeyword_17_3_SourcesKeyword_17_0_LeftCurlyBracketKeyword_17_1__q(semanticObject, getLastNavigableState(), syntaxNodes); else if (match_ProjectDescription___RightCurlyBracketKeyword_18_3_ModuleFiltersKeyword_18_0_LeftCurlyBracketKeyword_18_1__q.equals(syntax)) emit_ProjectDescription___RightCurlyBracketKeyword_18_3_ModuleFiltersKeyword_18_0_LeftCurlyBracketKeyword_18_1__q(semanticObject, getLastNavigableState(), syntaxNodes); else if (match_VersionConstraint_RightParenthesisKeyword_0_2_1_q.equals(syntax)) emit_VersionConstraint_RightParenthesisKeyword_0_2_1_q(semanticObject, getLastNavigableState(), syntaxNodes); else acceptNodes(getLastNavigableState(), syntaxNodes); } }
private String getPropertyAsString(ParameterizedPropertyAccessExpression propAccessExpr) { final StringBuilder sb = new StringBuilder(); for (INode node : NodeModelUtils.findNodesForFeature(propAccessExpr, N4JSPackage.eINSTANCE.getParameterizedPropertyAccessExpression_Property())) { sb.append(NodeModelUtils.getTokenText(node)); } return sb.toString(); }
NodeModelTokenSource(INode node, int startOffset, int endOffset, ContentAssistTokenTypeMapper tokenTypeMapper, N4JSGrammarAccess grammarAccess) { this.startOffset = startOffset; this.endOffset = endOffset; this.tokenTypeMapper = tokenTypeMapper; this.leafNodes = node.getLeafNodes().iterator(); this.rightCurlyInBlock = grammarAccess.getBlockAccess().getRightCurlyBracketKeyword_2(); this.rightCurlyInArrowExpression = grammarAccess.getArrowExpressionAccess().getRightCurlyBracketKeyword_1_0_2(); this.semicolon = grammarAccess.getSemiAccess().getSemicolonKeyword(); }
/** * Compute changes that will remove all imports. * * @param resource * the resource to modify * @param document * the document connected to the xtextResource, for textual changes. * @return list of changes to the document. */ public static List<IChange> getImportDeletionChanges(XtextResource resource, IXtextDocument document) throws BadLocationException { List<IChange> changes = new ArrayList<>(); List<ScriptElement> elements = XtextResourceUtils.getScript(resource).getScriptElements(); // elements.filter(ImportDeclaration).map[findActualNodeFor(it)].forEach[changes.add(document.removeNodeButKeepComments(it))] for (ScriptElement el : elements) { if (el instanceof ImportDeclaration) { INode nodeToRemove = NodeModelUtils.findActualNodeFor(el); changes.add(removeNodeButKeepComments(document, nodeToRemove)); } } return changes; }
@Override protected String getUnassignedRuleCallToken(EObject semanticObject, RuleCall ruleCall, INode node) { if (ruleCall.getRule() == grammarAccess.getNO_LINE_TERMINATORRule()) return getNO_LINE_TERMINATORToken(semanticObject, ruleCall, node); else if (ruleCall.getRule() == grammarAccess.getSemiRule()) return getSemiToken(semanticObject, ruleCall, node); else if (ruleCall.getRule() == grammarAccess.getTemplateExpressionEndRule()) return getTemplateExpressionEndToken(semanticObject, ruleCall, node); return ""; }
@Override protected void emitUnassignedTokens(EObject semanticObject, ISynTransition transition, INode fromNode, INode toNode) { if (transition.getAmbiguousSyntaxes().isEmpty()) return; List<INode> transitionNodes = collectNodes(fromNode, toNode); for (AbstractElementAlias syntax : transition.getAmbiguousSyntaxes()) { List<INode> syntaxNodes = getNodesFor(transitionNodes, syntax); if(match_Primary_LeftParenthesisKeyword_1_0_a.equals(syntax)) emit_Primary_LeftParenthesisKeyword_1_0_a(semanticObject, getLastNavigableState(), syntaxNodes); else if(match_Primary_LeftParenthesisKeyword_1_0_p.equals(syntax)) emit_Primary_LeftParenthesisKeyword_1_0_p(semanticObject, getLastNavigableState(), syntaxNodes); else acceptNodes(getLastNavigableState(), syntaxNodes); } }
/** * Installs proxies for all non containment references and only if the node representing the EObject that contains * the cross reference has got leaf nodes (as a leaf node represents the cross reference). * * @param resource * the N4JSResource * @param obj * the EObject containing the cross reference * @param producer * the error/warning producer * @param parentNode * the node representing obj inside the node model */ private void installProxies(N4JSResource resource, EObject obj, IDiagnosticProducer producer, ICompositeNode parentNode, boolean dontCheckParent) { final EClass eClass = obj.eClass(); if (eClass.getEAllReferences().size() - eClass.getEAllContainments().size() == 0) return; for (INode node = parentNode.getFirstChild(); node != null; node = node.getNextSibling()) { EObject grammarElement = node.getGrammarElement(); if (grammarElement instanceof CrossReference && hasLeafNodes(node)) { producer.setNode(node); CrossReference crossReference = (CrossReference) grammarElement; final EReference eRef = GrammarUtil.getReference(crossReference, eClass); if (eRef == null) { ParserRule parserRule = GrammarUtil.containingParserRule(crossReference); final String feature = GrammarUtil.containingAssignment(crossReference).getFeature(); throw new IllegalStateException("Couldn't find EReference for crossreference '" + eClass.getName() + "::" + feature + "' in parser rule '" + parserRule.getName() + "'."); } createAndSetProxy(resource, obj, node, eRef, crossReference, producer); afterCreateAndSetProxy(obj, node, eRef, crossReference, producer); } else if (grammarElement instanceof RuleCall && node instanceof ICompositeNode) { RuleCall ruleCall = (RuleCall) grammarElement; AbstractRule calledRule = ruleCall.getRule(); if (calledRule instanceof ParserRule && ((ParserRule) calledRule).isFragment()) { installProxies(resource, obj, producer, (ICompositeNode) node, true); } } } if (!dontCheckParent && shouldCheckParentNode(parentNode)) { installProxies(resource, obj, producer, parentNode.getParent(), dontCheckParent); } }
/** * Select comment closest to lookup element. Assume comments to be ordered list. Ignores comments starting with * doublestar. * * @param comments * list of commnets on luukup elements * @throws InstantiationException * if comment is malformed */ protected CommentCandidate pickCommentNoDoubleStar(List<INode> comments) throws InstantiationException { ListIterator<INode> iter = comments.listIterator(comments.size()); String candidateTextString = null; while (iter.hasPrevious()) { candidateTextString = iter.previous().getText(); if (!candidateTextString.startsWith("/**")) { return new CommentCandidate(candidateTextString); } } return null; }
/** * The node itself has content or if it is a composite node its last child node is a leaf (i.e. this child node has * no further child nodes). */ @Override protected boolean hasLeafNodes(INode node) { if (node.getTotalLength() > 0) return true; if (node instanceof ICompositeNode) { return ((ICompositeNode) node).getLastChild() instanceof ILeafNode; } return false; }
@Override public Triple<EObject, EReference, INode> getLazyProxyInformation(int idx) { // note: following line was copied from the old index-URI implementation (the one that used field "uris") // to make the new implementation behave as the old one; whether doing a demand load here actually // makes sense remains to be reconsidered (see IDEBUG-257 and IDEBUG-233) ... contents.get(0); // trigger demand load if necessary return super.getLazyProxyInformation(idx); }
/** * Creates a new value converter exception. */ protected N4JSValueConverterWithValueException newN4JSValueConverterException(char c, INode node, String value) { if (c == '"') return new N4JSValueConverterWithValueException(IssueCodes.getMessageForVCO_STRING_DOUBLE_QUOTE(), IssueCodes.VCO_STRING_DOUBLE_QUOTE, node, value, null); else return new N4JSValueConverterWithValueException(IssueCodes.getMessageForVCO_STRING_QUOTE(), IssueCodes.VCO_STRING_QUOTE, node, value, null); }
@Override public List<EObject> getLinkedObjects(EObject context, EReference ref, INode node) throws IllegalNodeException { final EClass requiredType = ref.getEReferenceType(); if (requiredType == null) return Collections.<EObject> emptyList(); final String crossRefString = getCrossRefNodeAsString(context, ref, node); if (crossRefString != null && !crossRefString.equals("")) { final IScope scope = getScope(context, ref); QualifiedName qualifiedLinkName = qualifiedNameConverter.toQualifiedName(crossRefString); IEObjectDescription eObjectDescription = scope.getSingleElement(qualifiedLinkName); if (IEObjectDescriptionWithError.isErrorDescription(eObjectDescription) && context.eResource() != null && !n4jsCore.isNoValidate(context.eResource().getURI())) { addError(context, node, IEObjectDescriptionWithError.getDescriptionWithError(eObjectDescription)); } else if (eObjectDescription instanceof UnresolvableObjectDescription) { return Collections.<EObject> singletonList((EObject) context.eGet(ref, false)); } if (eObjectDescription != null) { EObject candidate = eObjectDescription.getEObjectOrProxy(); if (!candidate.eIsProxy() && candidate.eResource() == null) { // Error is necessary since EMF catches all exceptions in EcoreUtil#resolve throw new AssertionError("Found an instance without resource and without URI"); } return Collections.singletonList(candidate); } } return Collections.emptyList(); }
/** * Converts the cross reference specified by the given parameters to a string. * * As {@link #getCrossRefNodeAsString(INode)}, but gets more information passed in to decide if some special * handling is required. By default, simply delegates to {@code #getCrossRefNodeAsString(INode)}. */ public String getCrossRefNodeAsString(EObject context, EReference ref, INode node) { if (ref == NAMED_IMPORT_SPECIFIER__IMPORTED_ELEMENT && context instanceof DefaultImportSpecifier) { // special case: we got a default import of the form: import localName from "some/module" return N4JSLanguageConstants.EXPORT_DEFAULT_NAME; // "default" } // standard cases: String result = getCrossRefNodeAsString(node); if (ref == PARAMETERIZED_TYPE_REF__DECLARED_TYPE && context instanceof ParameterizedTypeRef) { // special case: we might have a reference to a type C imported via namespace import: NS.C // -> replace '.' by '/' to make it a valid qualified name result = result != null ? result.replace('.', '/') : null; } return result; }
/** * Add the error to the resource of the given {@code context} if it does support validation. * * @param context * the context object that caused the error. * @param node * the error location. * @param error * the actual error description. */ protected void addError(EObject context, INode node, IEObjectDescriptionWithError error) { N4JSResource resource = (N4JSResource) context.eResource(); if (resource.isValidationDisabled()) return; List<Diagnostic> list = resource.getErrors(); // Convert key value user data to String array String[] userData = null; if (error.getUserDataKeys() != null) { ArrayList<String> userDataList = new ArrayList<>(error.getUserDataKeys().length * 2); for (String userDataKey : error.getUserDataKeys()) { final String userDataValue = error.getUserData(userDataKey); if (userDataValue != null) { userDataList.add(userDataKey); userDataList.add(userDataValue); } } userData = userDataList.toArray(new String[userDataList.size()]); } Diagnostic diagnostic = new XtextLinkingDiagnostic(node, error.getMessage(), error.getIssueCode(), userData); if (!list.contains(diagnostic)) list.add(diagnostic); }
@Override protected String getUnassignedRuleCallToken(EObject semanticObject, RuleCall ruleCall, INode node) { return ""; }
/** * OpSingleAssign: * '=' * ; */ protected String getOpSingleAssignToken(EObject semanticObject, RuleCall ruleCall, INode node) { if (node != null) return getTokenText(node); return "="; }
/** * terminal BRACKET_OPEN: '('; */ protected String getBRACKET_OPENToken(EObject semanticObject, RuleCall ruleCall, INode node) { if (node != null) return getTokenText(node); return "("; }
@Override protected String getUnassignedRuleCallToken(EObject semanticObject, RuleCall ruleCall, INode node) { if (ruleCall.getRule() == grammarAccess.getIDRule()) return getIDToken(semanticObject, ruleCall, node); return ""; }
/** * Create a new exception for the given node with the recovered value. */ public BogusRegExLiteralException(String message, INode node, String value) { super(message, node, value, null); }
/** * IMPORT: 'import'; */ protected String getIMPORTToken(EObject semanticObject, RuleCall ruleCall, INode node) { if (node != null) return getTokenText(node); return "import"; }
/** * Returns a string with name and position of the described object. The position is specified by line number (if * possible, otherwise the uri fragment of the proxy is used). If the object is a {@link SyntaxRelatedTElement}, a * "T" is used as a prefix of the line number. * * The following examples shows different mappings, depending on the described object: * <table> * <tr> * <th>Mapping</th> * <th>Described Object</th> * </tr> * <tr> * <td><code>bar - 42</code></td> * <td>Some element "bar", located in same resource on line 42</td> * </tr> * <tr> * <td><code>foo - T23</code></td> * <td>A type "foo" (or other syntax related element, a function is a type) which syntax related element (from which * the type is build) is located in same file on line 23</td> * </tr> * <tr> * <td><code>Infinity - global.n4ts:3</code></td> * <td>An element "Infinity", located in another resource "global.n4ts" on line 3.</td> * </tr> * <tr> * <td><code>decodeURI - global.n4ts:11</code></td> * <td>An element "decodeURI", located in another resource "global.n4ts" on line 11. Although the element may be a * type, there is no syntax related element because "n4ts" directly describes types.</td> * </tr> * </table> * * @param currentURI * the current resource's URI, if described object is in same resource, resource name is omitted * @param desc * the object descriptor */ public static String descriptionToNameWithPosition(URI currentURI, boolean withLineNumber, IEObjectDescription desc) { String name = desc.getName().toString(); EObject eobj = desc.getEObjectOrProxy(); if (eobj == null) { return "No EObject or proxy for " + name + " at URI " + desc.getEObjectURI(); } String location = ""; if (eobj instanceof SyntaxRelatedTElement) { EObject syntaxElement = ((SyntaxRelatedTElement) eobj).getAstElement(); if (syntaxElement != null) { location += "T"; eobj = syntaxElement; } } Resource eobjRes = eobj.eResource(); URI uri = eobjRes == null ? null : eobjRes.getURI(); if (uri != currentURI && uri != null) { location = uri.lastSegment(); if (eobj.eIsProxy() || withLineNumber) { location += ":"; } } if (eobj.eIsProxy()) { URI proxyUri = desc.getEObjectURI(); location += "proxy:" + simpleURIString(proxyUri); } else if (withLineNumber) { INode node = NodeModelUtils.findActualNodeFor(eobj); if (node == null) { location += "no node:" + simpleURIString(desc.getEObjectURI()); } else { location += node.getStartLine(); } } return name + SEPARATOR + location; }
@Override protected N4JSValueConverterWithValueException newN4JSValueConverterException(INode node, String value) { return new N4JSValueConverterWithValueException(IssueCodes.getMessageForVCO_TEMPLATE_QUOTE(), IssueCodes.VCO_TEMPLATE_QUOTE, node, -1 /* offset relative to node */, value.length() + 1, value, null); }