Skip to content

Commit

Permalink
TexLogParser needs to deal with >1 file scopes on same line
Browse files Browse the repository at this point in the history
  • Loading branch information
jcheng5 committed Feb 21, 2012
1 parent eb716e9 commit 7464a00
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions src/cpp/core/tex/TexLogParser.cpp
Expand Up @@ -129,7 +129,7 @@ FilePath resolveFilename(const FilePath& rootDir,

// Check for existence of file
FilePath file = rootDir.complete(result);
if (file.exists())
if (file.exists() && !file.isDirectory())
return file;
else
return FilePath();
Expand Down Expand Up @@ -217,10 +217,15 @@ class FileStack : public boost::noncopyable

void processLine(const std::string& line)
{
std::vector<std::string::const_iterator> parens;
typedef std::vector<std::string::const_iterator> Iterators;
Iterators parens;
findUnmatchedParens(line, &parens);
BOOST_FOREACH(std::string::const_iterator it, parens)
for (Iterators::const_iterator itParen = parens.begin();
itParen != parens.end();
itParen++)
{
std::string::const_iterator it = *itParen;

if (*it == ')')
{
if (!fileStack_.empty())
Expand All @@ -236,8 +241,16 @@ class FileStack : public boost::noncopyable
}
else if (*it == '(')
{
fileStack_.push_back(
resolveFilename(rootDir_, std::string(it+1, line.end())));
std::string::const_iterator itFilenameEnd =
// case: no other ( on this line
(itParen + 1 == parens.end()) ? line.end() :
// case: space before next paren, eat it
*(*(itParen+1)-1) == ' ' ? *(itParen+1)-1 :
// case: other
*(itParen+1);

std::string filename = std::string(it+1, itFilenameEnd);
fileStack_.push_back(resolveFilename(rootDir_, filename));

updateCurrentFile();
}
Expand Down

0 comments on commit 7464a00

Please sign in to comment.