Skip to content

Commit

Permalink
Undo, limit maxsize to 1000 tokens
Browse files Browse the repository at this point in the history
  • Loading branch information
chrchr-github committed Sep 12, 2023
1 parent 3001cfa commit 21e7b5f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
14 changes: 5 additions & 9 deletions simplecpp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1362,18 +1362,14 @@ std::string simplecpp::TokenList::lastLine(int maxsize) const
if (++count > maxsize)
return "";
if (!ret.empty())
ret += ' ';
// add tokens in reverse for performance reasons
ret.insert(0, 1, ' ');
if (tok->str()[0] == '\"')
ret += "%rts%"; // %str%
ret.insert(0, "%str%");
else if (tok->number)
ret += "%mun%"; // %num%
else {
ret += tok->str();
std::reverse(ret.end() - tok->str().length(), ret.end());
}
ret.insert(0, "%num%");
else
ret.insert(0, tok->str());
}
std::reverse(ret.begin(), ret.end());
return ret;
}

Expand Down
2 changes: 1 addition & 1 deletion simplecpp.h
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ namespace simplecpp {
std::string readUntil(Stream &stream, const Location &location, char start, char end, OutputList *outputList);
void lineDirective(unsigned int fileIndex, unsigned int line, Location *location);

std::string lastLine(int maxsize=100000) const;
std::string lastLine(int maxsize=1000) const;
bool isLastLinePreprocessor(int maxsize=100000) const;

unsigned int fileIndex(const std::string &filename);
Expand Down

0 comments on commit 21e7b5f

Please sign in to comment.