Skip to content

Commit

Permalink
implement string contains for c
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfv committed Jul 25, 2024
1 parent f269a72 commit 3798731
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/libasr/codegen/asr_to_c_cpp.h
Original file line number Diff line number Diff line change
Expand Up @@ -1244,6 +1244,15 @@ PyMODINIT_FUNC PyInit_lpython_module_)" + fn_name + R"((void) {
src = "_lfortran_strrepeat_c(" + s + ", " + n + ")";
}

void visit_StringContains(const ASR::StringRepeat_t &x) {
CHECK_FAST_C_CPP(compiler_options, x)
self().visit_expr(*x.m_left);
std::string substr = src;
self().visit_expr(*x.m_right);
std::string str = src;
src = "_lfortran_str_contains(" + str + ", " + substr + ")";
}

void visit_Assignment(const ASR::Assignment_t &x) {
std::string target;
ASR::ttype_t* m_target_type = ASRUtils::expr_type(x.m_target);
Expand Down

0 comments on commit 3798731

Please sign in to comment.