@Override public String getPath(Object impl) { com.oracle.truffle.api.source.Source source = (com.oracle.truffle.api.source.Source) impl; return source.getPath(); }
@Override public String getPath() { return key.base.getPath(); }
@Override public String getPath(Object impl) { com.oracle.truffle.api.source.Source source = (com.oracle.truffle.api.source.Source) impl; return source.getPath(); }
@Override public String getPath() { return base.getPath(); }
private String formatFileName() { if (sourceSection == null) { return "<Unknown>"; } Source source = sourceSection.getSource(); if (source == null) { // TODO the source == null branch can be removed if the deprecated // SourceSection#createUnavailable has be removed. return "<Unknown>"; } else if (source.getPath() == null) { return source.getName(); } else { return source.getPath(); } }
private static String formatPath(SourceSection sourceSection) { if (sourceSection.getSource().getPath() != null) { Path path = FileSystems.getDefault().getPath(".").toAbsolutePath(); Path filePath = FileSystems.getDefault().getPath(sourceSection.getSource().getPath()).toAbsolutePath(); try { return path.relativize(filePath).toString(); } catch (IllegalArgumentException e) { // relativization failed } } return sourceSection.getSource().getName(); }
@Override public boolean test(Source source) { boolean internal = (internals || !source.isInternal()); boolean file = testWildcardExpressions(source.getPath(), filterFile); boolean mimeType = filterLanguage.equals("") || filterLanguage.equals(source.getMimeType()); return internal && file && mimeType; } });
static String getShortDescription(SourceSection sourceSection) { if (sourceSection == null || sourceSection.getSource() == null) { // TODO the source == null branch can be removed if the deprecated // SourceSection#createUnavailable has be removed. return "<Unknown>"; } StringBuilder b = new StringBuilder(); if (sourceSection.getSource().getPath() == null) { b.append(sourceSection.getSource().getName()); } else { Path pathAbsolute = Paths.get(sourceSection.getSource().getPath()); Path pathBase = new File("").getAbsoluteFile().toPath(); try { Path pathRelative = pathBase.relativize(pathAbsolute); b.append(pathRelative.toFile()); } catch (IllegalArgumentException e) { b.append(sourceSection.getSource().getName()); } } b.append("~").append(formatIndices(sourceSection, true)); return b.toString(); }
static String getShortDescription(SourceSection sourceSection) { if (sourceSection.getSource() == null) { // TODO the source == null branch can be removed if the deprecated // SourceSection#createUnavailable has be removed. return "<Unknown>"; } StringBuilder b = new StringBuilder(); if (sourceSection.getSource().getPath() == null) { b.append(sourceSection.getSource().getName()); } else { Path pathAbsolute = Paths.get(sourceSection.getSource().getPath()); Path pathBase = new File("").getAbsoluteFile().toPath(); try { Path pathRelative = pathBase.relativize(pathAbsolute); b.append(pathRelative.toFile()); } catch (IllegalArgumentException e) { b.append(sourceSection.getSource().getName()); } } b.append("~").append(formatIndices(sourceSection, true)); return b.toString(); }
final boolean equalAttributes(Source other) { return Objects.equals(getMimeType(), other.getMimeType()) && Objects.equals(getLanguage(), other.getLanguage()) && Objects.equals(getName(), other.getName()) && Objects.equals(getPath(), other.getPath()) && isInternal() == other.isInternal() && isInteractive() == other.isInteractive(); }
curLineNo = 1; out.println(); out.println(source.getPath());
/** * {@inheritDoc} * * @since 1.0 */ @Override public String toString() { return "Source [language=" + getLanguage() + ", name=" + getName() + ", path=" + getPath() + ", internal=" + isInternal() + ", cached=" + isCached() + ", interactive=" + isInteractive() + ", hasBytes=" + hasBytes() + ", hasCharacters=" + hasCharacters() + ", URL=" + getURL() + ", URI=" + getURI() + ", mimeType=" + getMimeType() + "]"; }
static JSONObject sourceSectionToJSON(SourceSection sourceSection) { JSONObject sourceSectionJson = new JSONObject(); if (sourceSection != null) { Source source = sourceSection.getSource(); if (source != null) { if (source.getLanguage() != null) { sourceSectionJson.put("language", source.getLanguage().toString()); } String path = source.getPath(); if (path != null) { sourceSectionJson.put("path", path); } } sourceSectionJson.put("source_name", sourceSection.getSource().getName()); sourceSectionJson.put("start_line", sourceSection.getStartLine()); sourceSectionJson.put("end_line", sourceSection.getEndLine()); sourceSectionJson.put("start_column", sourceSection.getStartColumn()); sourceSectionJson.put("end_column", sourceSection.getEndColumn()); } return sourceSectionJson; }