- foundfile = sub.str(1);
- } else if (regex_match(token, sub, reg2)) {
- foundfile = sub.str(1);
- } else if (regex_match(token, sub, reg3)) {
- foundfile = sub.str(1);
- } else if (regex_match(token, sub, reg4)) {
- foundfile = sub.str(1);
- } else if (regex_match(token, sub, reg5)) {
- foundfile = sub.str(1);
- } else {
- continue;
- }
-
- // convert from native os path to unix path
- foundfile = os::internal_path(foundfile);
-
- lyxerr[Debug::DEPEND] << "Found file: "
- << foundfile << endl;
-
- // Ok now we found a file.
- // Now we should make sure that this is a file that we can
- // access through the normal paths.
- // We will not try any fancy search methods to
- // find the file.
-
- // (1) foundfile is an
- // absolute path and should
- // be inserted.
- if (AbsolutePath(foundfile)) {
- lyxerr[Debug::DEPEND] << "AbsolutePath file: "
- << foundfile << endl;
- // On initial insert we want to do the update at once
- // since this file can not be a file generated by
- // the latex run.
- if (FileInfo(foundfile).exist())
- head.insert(foundfile, true);
- }
-
- // (2) foundfile is in the tmpdir
- // insert it into head
- else if (FileInfo(OnlyFilename(foundfile)).exist()) {
- if (regex_match(foundfile, unwanted)) {
- lyxerr[Debug::DEPEND]
- << "We don't want "
- << OnlyFilename(foundfile)
- << " in the dep file"
- << endl;
- } else if (suffixIs(foundfile, ".tex")) {
- // This is a tex file generated by LyX
- // and latex is not likely to change this
- // during its runs.
- lyxerr[Debug::DEPEND]
- << "Tmpdir TeX file: "
- << OnlyFilename(foundfile)
- << endl;
- head.insert(foundfile, true);
- } else {
- lyxerr[Debug::DEPEND]
- << "In tmpdir file:"
- << OnlyFilename(foundfile)
- << endl;
- head.insert(OnlyFilename(foundfile));
+ static regex reg1_1("\\(([^()]+)");
+ smatch what;
+ string::const_iterator first = token.begin();
+ string::const_iterator end = token.end();
+
+ while (regex_search(first, end, what, reg1_1)) {
+ first = what[0].second;
+ handleFoundFile(what.str(1), head);