filesProcessed=filesProcessed?filesProcessed.slice():[];// making a copy
letcap,filePath,mdSrc,errorMessage;
// store parent file path to check circular references
if(parentFilePath){
filesProcessed.push(parentFilePath);
}
while((cap=options.includeRe.exec(src))){
letincludePath=cap[1].trim();
constsansBracesMatch=BRACES_RE.exec(includePath);
if(!sansBracesMatch&&!options.bracesAreOptional){
errorMessage=`INCLUDE statement '${src.trim()}' MUST have '()' braces around the include path ('${includePath}')`;
}elseif(sansBracesMatch){
includePath=sansBracesMatch[1].trim();
}elseif(!/^\s/.test(cap[1])){
// path SHOULD have been preceeded by at least ONE whitespace character!
/* eslint max-len: "off" */
errorMessage=`INCLUDE statement '${src.trim()}': when not using braces around the path ('${includePath}'), it MUST be preceeded by at least one whitespace character to separate the include keyword and the include path.`;
}
if(!errorMessage){
filePath=path.resolve(rootdir,includePath);
// check if child file exists or if there is a circular reference