use of com.nedap.archie.adlparser.antlr.Adl14Parser in project archetype-languageserver by nedap.
the class ADL14SymbolExtractor method extractSymbols.
public DocumentInformation extractSymbols(String uri, String text) throws IOException {
Adl14Lexer lexer = new Adl14Lexer(CharStreams.fromString(text));
Adl14Parser parser = new Adl14Parser(new CommonTokenStream(lexer));
ArchieErrorListener listener = new ArchieErrorListener();
parser.addErrorListener(listener);
ADL14SymbolInformationExtractingListener symbolExtractingListener = new ADL14SymbolInformationExtractingListener(uri, lexer);
// DocumentSymbolExtractingListener symbolExtractingListener = new DocumentSymbolExtractingListener();
try {
new ParseTreeWalker().walk(symbolExtractingListener, parser.adl());
} catch (Exception e) {
// this is fine. for now
e.printStackTrace();
}
archetypeId = symbolExtractingListener.getArchetypeId();
return new DocumentInformation(archetypeId, ADLVersion.VERSION_1_4, listener.getErrors(), symbolExtractingListener.getSymbols(), symbolExtractingListener.getFoldingRanges(), symbolExtractingListener.getDocumentLinks());
}
Aggregations