Skip to content

Commit aadd893

Browse files
caiiiycukkripken
andauthored
Apply suggestions from code review
Co-authored-by: Alon Zakai <[email protected]>
1 parent 40e0744 commit aadd893

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/support/string.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,11 @@ namespace wasm::String {
3232
// Creates a vector of the split parts of a string, by a delimiter.
3333
class Split : public std::vector<std::string> {
3434
private:
35+
// If we split on newlines then we do not need to handle bracketing at all. Otherwise,
36+
// splitting on say "," does require us to understanding the scoping of brackets, e.g.,
37+
// "foo(x, y),bar" should be split as "foo(x, y)", "bar".
3538
bool needToHandleBracketingOperations = true;
39+
3640
void split(const std::string& input, const std::string& delim) {
3741
size_t lastEnd = 0;
3842
while (lastEnd < input.size()) {
@@ -47,7 +51,10 @@ class Split : public std::vector<std::string> {
4751
}
4852
friend String::Split handleBracketingOperators(String::Split split);
4953

54+
5055
public:
56+
// This can be used when we want to split on newlines if there are any, and if there are not,
57+
// then using the given delimiter.
5158
struct NewLineOr {
5259
const std::string delim;
5360
explicit NewLineOr(const std::string& delim) : delim(delim) {}

0 commit comments

Comments
 (0)