commit 398e026250f6d7d1687bdf04a8a27a61946d088f
Author: Juergen Spitzmueller <sp...@lyx.org>
Date:   Fri Feb 9 11:42:18 2018 +0100

    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
---
 src/LaTeX.cpp |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/LaTeX.cpp b/src/LaTeX.cpp
index f92d7be..d7e1c3c 100644
--- a/src/LaTeX.cpp
+++ b/src/LaTeX.cpp
@@ -697,7 +697,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;
@@ -732,8 +732,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] == ')') {

Reply via email to