From 2d923e4243d02b17da6f103c7cc0d2cee8d6caf5 Mon Sep 17 00:00:00 2001 From: Juergen Spitzmueller Date: Fri, 9 Feb 2018 11:42:18 +0100 Subject: [PATCH] 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 398e026250f6d7d1687bdf04a8a27a61946d088f) --- src/LaTeX.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/LaTeX.cpp b/src/LaTeX.cpp index 10540642b1..753d1966e0 100644 --- a/src/LaTeX.cpp +++ b/src/LaTeX.cpp @@ -657,7 +657,7 @@ int LaTeX::scanLogFile(TeXErrors & terr) ifstream ifs(fn.toFilesystemEncoding().c_str()); bool fle_style = false; 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. // We need to wait for subsequent processing. string wait_for_error; @@ -692,8 +692,12 @@ int LaTeX::scanLogFile(TeXErrors & terr) string const substr = token.substr(i + 1, len); if (regex_match(substr, sub, child_file)) { string const name = sub.str(1); - child.push(make_pair(name, pnest)); - children.push_back(name); + // Sometimes also masters have a name that matches + // (if their name starts with a number and _) + if (name != file.onlyFileName()) { + child.push(make_pair(name, pnest)); + children.push_back(name); + } i += len; } } else if (token[i] == ')') { -- 2.39.5