Skip to content

Commit

Permalink
Refactor rapidsai#3
Browse files Browse the repository at this point in the history
  • Loading branch information
codereport committed Jul 2, 2020
1 parent 4d9e016 commit dc52162
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions cpp/src/jit/parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,18 +212,14 @@ std::string ptx_parser::parse_statement(const std::string& src)

std::vector<std::string> ptx_parser::parse_function_body(const std::string& src)
{
const size_t length = src.size();
size_t start = 0;
size_t stop = 0;

auto f = src.cbegin();
auto l = src.cbegin();
std::vector<std::string> statements;

while (stop < length) {
stop = start;
while (stop < length && src[stop] != ';') { stop++; }
statements.push_back(parse_statement(std::string(src, start, stop - start)));
stop++;
start = stop;
while (l < src.cend()) {
l = std::find_if(l, src.cend(), [](auto c) { return c == ';'; });
statements.push_back(parse_statement(std::string(f, l)));
f = ++l;
}
return statements;
}
Expand Down

0 comments on commit dc52162

Please sign in to comment.