Skip to content

Commit

Permalink
Merge pull request #152 from sparkprime/fix_strip_ws
Browse files Browse the repository at this point in the history
Fix #151
  • Loading branch information
sparkprime committed Apr 1, 2016
2 parents 6b2fe56 + 9c0863c commit 4fbc23c
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions core/lexer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ static const std::vector<std::string> EMPTY;
/** Strip whitespace from both ends of a string, but only up to margin on the left hand side. */
static std::string strip_ws(const std::string &s, unsigned margin)
{
if (s.size() == 0) return s; // Avoid underflow below.
size_t i = 0;
while (i < s.length() && (s[i] == ' ' || s[i] == '\t' || s[i] == '\r') && i < margin)
i++;
Expand Down

0 comments on commit 4fbc23c

Please sign in to comment.