+ private static String getParentModule(final ParseTree ctx) {
+ ParseTree current = ctx;
+ while (current != null && !(current instanceof Module_stmtContext)) {
+ current = current.getParent();
+ }
+ if (current instanceof Module_stmtContext) {
+ Module_stmtContext module = (Module_stmtContext) current;
+ for (int i = 0; i < module.getChildCount(); i++) {
+ if (module.getChild(i) instanceof StringContext) {
+ final StringContext str = (StringContext) module.getChild(i);
+ return str.getChild(0).getText();
+ }
+ }
+ }
+ return "";
+ }
+