static chunk_t *chunk_search_typelevel(chunk_t *cur, c_token_t type, scope_e scope, direction_e dir, int level) { /* * Depending on the parameter dir the search function searches * in forward or backward direction */ search_t search_function = select_search_fct(dir); chunk_t *pc = cur; do // loop over the chunk list { pc = search_function(pc, scope); // in either direction while #if DEBUG if (pc != nullptr) { if (pc->type == CT_NEWLINE) { LOG_FMT(LCHUNK, "%s(%d): orig_line is %zu, orig_col is %zu, NEWLINE\n", __func__, __LINE__, pc->orig_line, pc->orig_col); } else { LOG_FMT(LCHUNK, "%s(%d): orig_line is %zu, orig_col is %zu, pc->text() '%s', type is %s\n", __func__, __LINE__, pc->orig_line, pc->orig_col, pc->text(), get_token_name(pc->type)); } } #endif } while ( pc != nullptr // the end of the list was not reached yet && (is_expected_type_and_level(pc, type, level) == false)); return(pc); // the latest chunk is the searched one }
static chunk_t *chunk_search_str(chunk_t *cur, const char *str, size_t len, nav_t nav, loc_t dir, int level) { /* Depending on the parameter dir the search function searches * in forward or backward direction */ search_t search_function = select_search_fct(dir); chunk_t *pc = cur; do /* loop over the chunk list */ { pc = search_function(pc, nav); /* in either direction while */ } while ((pc != NULL) && /* the end of the list was not reached yet */ (is_expected_string_and_level(pc, str, level, len) == false)); return(pc); /* the latest chunk is the searched one */ }
static chunk_t *chunk_get_ncnlnpnd(chunk_t *cur, const scope_e scope, const direction_e dir) { search_t search_function = select_search_fct(dir); chunk_t *pc = cur; do // loop over the chunk list { pc = search_function(pc, scope); // in either direction while } while ( pc != nullptr // the end of the list was not reached yet && !chunk_is_comment_or_newline(pc) && !chunk_is_preproc(pc) && (pc->type == CT_DC_MEMBER)); return(pc); }
static chunk_t *chunk_search(chunk_t *cur, const check_t check_fct, const nav_t nav, const loc_t dir, const bool cond) { /* Depending on the parameter dir the search function searches * in forward or backward direction */ search_t search_function = select_search_fct(dir); chunk_t *pc = cur; do /* loop over the chunk list */ { pc = search_function(pc, nav); /* in either direction while */ } while ((pc != NULL) && /* the end of the list was not reached yet */ (check_fct(pc) != cond)); /* and the demanded chunk was not found either */ return(pc); /* the latest chunk is the searched one */ }
static chunk_t *chunk_search_str(chunk_t *cur, const char *str, size_t len, scope_e scope, direction_e dir, int level) { /* * Depending on the parameter dir the search function searches * in forward or backward direction */ search_t search_function = select_search_fct(dir); chunk_t *pc = cur; do // loop over the chunk list { pc = search_function(pc, scope); // in either direction while } while ( pc != nullptr // the end of the list was not reached yet && (is_expected_string_and_level(pc, str, level, len) == false)); return(pc); // the latest chunk is the searched one }
static chunk_t *chunk_search(chunk_t *cur, const check_t check_fct, const scope_e scope, const direction_e dir, const bool cond) { /* * Depending on the parameter dir the search function searches * in forward or backward direction */ search_t search_function = select_search_fct(dir); chunk_t *pc = cur; do // loop over the chunk list { pc = search_function(pc, scope); // in either direction while } while ( pc != nullptr // the end of the list was not reached yet && (check_fct(pc) != cond)); // and the demanded chunk was not found either return(pc); // the latest chunk is the searched one }
static chunk_t *chunk_search_typelevel(chunk_t *cur, c_token_t type, nav_t nav, loc_t dir, int level) { /* Depending on the parameter dir the search function searches * in forward or backward direction */ search_t search_function = select_search_fct(dir); chunk_t *pc = cur; do /* loop over the chunk list */ { pc = search_function(pc, nav); /* in either direction while */ #if DEBUG if (pc != NULL) { LOG_FMT(LCHUNK, "%s(%d): pc: %s, type is %s, orig_line=%zu, orig_col=%zu\n", __func__, __LINE__, pc->text(), get_token_name(pc->type), pc->orig_line, pc->orig_col); } #endif } while ((pc != NULL) && /* the end of the list was not reached yet */ (is_expected_type_and_level(pc, type, level) == false)); return(pc); /* the latest chunk is the searched one */ }