We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents ef3fef8 + a513d6a commit 216a95bCopy full SHA for 216a95b
core/lexer.cpp
@@ -32,10 +32,11 @@ static std::string strip_ws(const std::string &s, unsigned margin)
32
size_t i = 0;
33
while (i < s.length() && (s[i] == ' ' || s[i] == '\t' || s[i] == '\r') && i < margin)
34
i++;
35
- size_t j = s.size() - 1;
36
- while (j >= i && (s[j] == ' ' || s[j] == '\t' || s[j] == '\r'))
+ size_t j = s.size();
+ while (j > i && (s[j - 1] == ' ' || s[j - 1] == '\t' || s[j - 1] == '\r')) {
37
j--;
38
- return std::string(&s[i], &s[j+1]);
+ }
39
+ return std::string(&s[i], &s[j]);
40
}
41
42
/** Split a string by \n and also strip left (up to margin) & right whitespace from each line. */
0 commit comments