use of org.opengrok.indexer.analysis.CtagsReader in project OpenGrok by OpenGrok.
the class HaskellXrefTest method getTagsDefinitions.
private Definitions getTagsDefinitions() throws IOException {
InputStream res = getClass().getClassLoader().getResourceAsStream("analysis/haskell/sampletags");
assertNotNull(res, "though sampletags should stream,");
BufferedReader in = new BufferedReader(new InputStreamReader(res, StandardCharsets.UTF_8));
CtagsReader rdr = new CtagsReader();
String line;
while ((line = in.readLine()) != null) {
rdr.readLine(line);
}
return rdr.getDefinitions();
}
use of org.opengrok.indexer.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(res, tagsResourceName + " as resource");
BufferedReader in = new BufferedReader(new InputStreamReader(res, StandardCharsets.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();
}
use of org.opengrok.indexer.analysis.CtagsReader in project OpenGrok by OpenGrok.
the class PhpXrefTest method getTagsDefinitions.
private Definitions getTagsDefinitions() throws IOException {
InputStream res = getClass().getClassLoader().getResourceAsStream("analysis/php/sampletags");
assertNotNull(res, "though sampletags should stream,");
BufferedReader in = new BufferedReader(new InputStreamReader(res, StandardCharsets.UTF_8));
CtagsReader rdr = new CtagsReader();
String line;
while ((line = in.readLine()) != null) {
rdr.readLine(line);
}
return rdr.getDefinitions();
}
Aggregations