// create SourceCode wrappers for scripts
Set<SourceCode> scriptSet = new LinkedHashSet<SourceCode>();
for (Iterator iter = info.getScripts().iterator(); iter.hasNext(); )
{
Script script = (Script) iter.next();
if (!script.isEmbedded())
{
scriptSet.add(new SourceCode(script.getText(), script.getXmlLineNumber(), out, map));
}
else
{
// use Source.getName() to construct the new VirtualFile name
String n = source.getName().replace('\\', '/') + ":" + script.getXmlLineNumber() + "," + script.getEndXmlLineNumber();
VirtualFile f = new TextFile(script.getText(), n, source.getParent(), MimeMappings.AS, source.getLastModified());
// line number map is for error reporting, so the names must come from error reporting...
LineNumberMap m = new LineNumberMap(source.getNameForReporting(), n);
m.put(script.getXmlLineNumber(), 1, (script.getEndXmlLineNumber() - script.getXmlLineNumber()));
// C: add this so that when unexpected EOF occurs, (last line + 1) maps to the last line
// in the original XML Script block.
m.put(script.getEndXmlLineNumber(), script.getEndXmlLineNumber() - script.getXmlLineNumber() + 1, 1);
// 'n' must match 'n' in the include directive...
source.addSourceFragment(n, f, m);
// 'n' must match 'n' in the addSourceFragment call.
scriptSet.add(new SourceCode("include \"" + n + "\";", script.getXmlLineNumber(), out, map));
}
}
// create SourceCode wrappers for metadata entries
Set<SourceCode> metadataSet = new LinkedHashSet<SourceCode>();
for (Iterator iter = info.getMetadata().iterator(); iter.hasNext(); )
{
Script script = (Script)iter.next();
metadataSet.add(new SourceCode(script.getText(), script.getXmlLineNumber(), out, map));
}
// create SourceCode wrappers for variable declarations
Map<String, SourceCode> varDeclMap = new LinkedHashMap<String, SourceCode>();
for (Iterator iter = info.getVarDecls().values().iterator(); iter.hasNext(); )