if (node instanceof ParseNodeComment) {
continue;
}
if (node instanceof ParseNodeModule) {
if (moduleName != null) {
throw new ParseException("Duplicate use of the 'module' keyword for resource '" + resourceName + "'");
}
if (count > 0) {
throw new ParseException("The 'module' keyword must be the first declaration in the module file for resource '" + resourceName + "'");
}
moduleName = ((ParseNodeModule) node).getModuleName();
}
count++;
}
Set<String> uses = new LinkedHashSet<String>();
Set<String> imports = new LinkedHashSet<String>();
count = 0;
for (ParseNode node : nodes) {
if ((node instanceof ParseNodeComment) || (node instanceof ParseNodeModule)) {
continue;
}
String message = "The 'uses' and 'import' keywords must be the first declaration in the module file or follow the 'module' declaration";
if (node instanceof ParseNodeUses) {
if (count > 0) {
throw new ParseException(message);
}
uses.add(((ParseNodeUses) node).getUses());
continue;
}
if (node instanceof ParseNodeImport) {
if (count > 0) {
throw new ParseException(message);
}
imports.add(((ParseNodeImport) node).getImported());
continue;
}
count++;