static CompModule alloy_parseStream (List<Object> seenDollar,
Map<String,String> loaded, Map<String,String> fc, CompModule root,
int lineOffset, String filename, String prefix, int initialResolutionMode) throws Err, FileNotFoundException, IOException {
Reader isr=null;
try {
if (root==null && prefix.length()!=0) throw new ErrorFatal("Internal error (parse subfile with root==null)");
if (root!=null && prefix.length()==0) throw new ErrorFatal("Internal error (parse topfile with root!=null)");
CompModule u = new CompModule(root, filename, prefix);
u.resolution = initialResolutionMode;
String content = fc!=null ? fc.get(filename) : null;
if (content==null && loaded!=null) content = loaded.get(filename);
if (content==null) content = Util.readAll(filename);
if (loaded!=null) loaded.put(filename,content);
content = Util.convertLineBreak(content);
isr = new StringReader(content);
CompFilter s = new CompFilter(u, seenDollar, filename, lineOffset, new BufferedReader(isr));
CompParser p = new CompParser(s);
p.alloymodule=u;
try {p.parse();} catch(Throwable ex) {if (ex instanceof Err) throw (Err)ex; throw new ErrorFatal("Parser Exception", ex);}
return u;
} finally {
Util.close(isr);
}
}