Fix child document regex in scanLogFile

Several problems:
* The regex failed at names such as 1_text_2_text.tex
  (returned "2_text.tex)
* The regex failed at names such as 12_text.tex
  (returned "2_text.tex)
* Masters with digits in the name (2018_text.tex) were
  tracked as their own children

(cherry picked from commit 398e026250)
This commit is contained in:
Juergen Spitzmueller 2018-02-09 11:42:18 +01:00
parent 04e995e807
commit 2d923e4243

View File

@ -657,7 +657,7 @@ int LaTeX::scanLogFile(TeXErrors & terr)
ifstream ifs(fn.toFilesystemEncoding().c_str()); ifstream ifs(fn.toFilesystemEncoding().c_str());
bool fle_style = false; bool fle_style = false;
static regex const file_line_error(".+\\.\\D+:[0-9]+: (.+)"); static regex const file_line_error(".+\\.\\D+:[0-9]+: (.+)");
static regex const child_file(".*([0-9]+[A-Za-z]*_.+\\.tex).*"); static regex const child_file("[^0-9]*([0-9]+[A-Za-z]*_.+\\.tex).*");
// Flag for 'File ended while scanning' message. // Flag for 'File ended while scanning' message.
// We need to wait for subsequent processing. // We need to wait for subsequent processing.
string wait_for_error; string wait_for_error;
@ -692,8 +692,12 @@ int LaTeX::scanLogFile(TeXErrors & terr)
string const substr = token.substr(i + 1, len); string const substr = token.substr(i + 1, len);
if (regex_match(substr, sub, child_file)) { if (regex_match(substr, sub, child_file)) {
string const name = sub.str(1); string const name = sub.str(1);
child.push(make_pair(name, pnest)); // Sometimes also masters have a name that matches
children.push_back(name); // (if their name starts with a number and _)
if (name != file.onlyFileName()) {
child.push(make_pair(name, pnest));
children.push_back(name);
}
i += len; i += len;
} }
} else if (token[i] == ')') { } else if (token[i] == ')') {