GrammarDependencies: include all imports

For some reason, the grammar import dependency analysis only included
the first import on a line. This does not work so well...
This commit is contained in:
Daniel Halperin 2017-07-11 15:03:11 -07:00
parent a9dfca3666
commit d58e7e31bf
1 changed files with 7 additions and 7 deletions

View File

@ -216,14 +216,14 @@ class GrammarDependencies {
return;
for (GrammarAST importDecl : grammar.getAllChildrenWithType(ANTLRParser.IMPORT)) {
Tree id = importDecl.getFirstChildWithType(ANTLRParser.ID);
for (Tree id: importDecl.getAllChildrenWithType(ANTLRParser.ID)) {
// missing id is not valid, but we don't want to prevent the root cause from
// being reported by the ANTLR tool
if (id != null) {
String grammarPath = getRelativePath(grammarFile);
// missing id is not valid, but we don't want to prevent the root cause from
// being reported by the ANTLR tool
if (id != null) {
String grammarPath = getRelativePath(grammarFile);
graph.addEdge(id.getText() + ".g4", grammarPath);
graph.addEdge(id.getText() + ".g4", grammarPath);
}
}
}