use of org.opensolaris.opengrok.analysis.CtagsReader in project OpenGrok by OpenGrok.
the class JavaXrefTest method getTagsDefinitions.
private Definitions getTagsDefinitions() throws IOException {
InputStream res = getClass().getClassLoader().getResourceAsStream("org/opensolaris/opengrok/analysis/java/sampletags");
assertNotNull("though sampletags should stream,", res);
BufferedReader in = new BufferedReader(new InputStreamReader(res, "UTF-8"));
CtagsReader rdr = new CtagsReader();
String line;
while ((line = in.readLine()) != null) {
rdr.readLine(line);
}
return rdr.getDefinitions();
}
use of org.opensolaris.opengrok.analysis.CtagsReader in project OpenGrok by OpenGrok.
the class JavaScriptXrefTest method getTagsDefinitions.
private Definitions getTagsDefinitions() throws IOException {
InputStream res = getClass().getClassLoader().getResourceAsStream("org/opensolaris/opengrok/analysis/javascript/sampletags");
assertNotNull("though sampletags should stream,", res);
BufferedReader in = new BufferedReader(new InputStreamReader(res, "UTF-8"));
CtagsReader rdr = new CtagsReader();
String line;
while ((line = in.readLine()) != null) {
rdr.readLine(line);
}
return rdr.getDefinitions();
}
use of org.opensolaris.opengrok.analysis.CtagsReader in project OpenGrok by OpenGrok.
the class LispXrefTest method getTagsDefinitions.
private Definitions getTagsDefinitions() throws IOException {
InputStream res = getClass().getClassLoader().getResourceAsStream("org/opensolaris/opengrok/analysis/lisp/sampletags");
assertNotNull("though sampletags should stream,", res);
BufferedReader in = new BufferedReader(new InputStreamReader(res, "UTF-8"));
CtagsReader rdr = new CtagsReader();
String line;
while ((line = in.readLine()) != null) {
rdr.readLine(line);
}
return rdr.getDefinitions();
}
use of org.opensolaris.opengrok.analysis.CtagsReader in project OpenGrok by OpenGrok.
the class StreamUtils method readTagsFromResource.
public static Definitions readTagsFromResource(String tagsResourceName, String rawResourceName, int tabSize) throws IOException {
InputStream res = StreamUtils.class.getClassLoader().getResourceAsStream(tagsResourceName);
assertNotNull(tagsResourceName + " as resource", res);
BufferedReader in = new BufferedReader(new InputStreamReader(res, "UTF-8"));
CtagsReader rdr = new CtagsReader();
rdr.setTabSize(tabSize);
if (rawResourceName != null) {
rdr.setSplitterSupplier(() -> {
/**
* This should return truly raw content, as the CtagsReader will
* expand tabs according to its setting.
*/
SourceSplitter splitter = new SourceSplitter();
StreamSource src = sourceFromEmbedded(rawResourceName);
try {
splitter.reset(src);
} catch (IOException ex) {
System.err.println(ex.toString());
return null;
}
return splitter;
});
}
String line;
while ((line = in.readLine()) != null) {
rdr.readLine(line);
}
return rdr.getDefinitions();
}
Aggregations