+ LRegex reg1("\\\\citation\\{([^}]+)\\}");
+ LRegex reg2("\\\\bibdata\\{([^}]+)\\}");
+ LRegex reg3("\\\\bibstyle\\{([^}]+)\\}");
+ LRegex reg4("\\\\@input\\{([^}]+)\\}");
+
+ while (getline(ifs, token)) {
+ token = strip(token, '\r');
+ if (reg1.exact_match(token)) {
+ LRegex::SubMatches const & sub = reg1.exec(token);
+ string data = LSubstring(token, sub[1].first,
+ sub[1].second);
+ while (!data.empty()) {
+ string citation;
+ data = split(data, citation, ',');
+ lyxerr[Debug::LATEX] << "Citation: "
+ << citation << endl;
+ aux_info.citations.insert(citation);
+ }
+ } else if (reg2.exact_match(token)) {
+ LRegex::SubMatches const & sub = reg2.exec(token);
+ string data = LSubstring(token, sub[1].first,
+ sub[1].second);
+ // data is now all the bib files separated by ','
+ // get them one by one and pass them to the helper
+ while (!data.empty()) {
+ string database;
+ data = split(data, database, ',');
+ database = ChangeExtension(database, "bib");
+ lyxerr[Debug::LATEX] << "Bibtex database: `"
+ << database << "'" << endl;
+ aux_info.databases.insert(database);
+ }
+ } else if (reg3.exact_match(token)) {
+ LRegex::SubMatches const & sub = reg3.exec(token);
+ string style = LSubstring(token, sub[1].first,
+ sub[1].second);
+ // token is now the style file
+ // pass it to the helper
+ style = ChangeExtension(style, "bst");
+ lyxerr[Debug::LATEX] << "Bibtex style: `"
+ << style << "'" << endl;
+ aux_info.styles.insert(style);
+ } else if (reg4.exact_match(token)) {
+ LRegex::SubMatches const & sub = reg4.exec(token);
+ string file2 = LSubstring(token, sub[1].first,
+ sub[1].second);
+ scanAuxFile(file2, aux_info);
+ }