int parse_line(t_line *l, t_ftl_root *hist) { if (l->str == NULL) return (0); if (parse_history(l, hist) == 1) return (1); if (parse_quote(l) == 1) return (1); parse_newline(l->str, hist); return (0); }
static bool parse_ignored(tok_ctx& ctx, chunk_t& pc) { int nl_count = 0; /* Parse off newlines/blank lines */ while (parse_newline(ctx)) { nl_count++; } if (nl_count > 0) { pc.nl_count = nl_count; pc.type = CT_NEWLINE; return(true); } /* See if the UO_enable_processing_cmt text is on this line */ ctx.save(); pc.str.clear(); while (ctx.more() && (ctx.peek() != '\r') && (ctx.peek() != '\n')) { pc.str.append(ctx.get()); } if (pc.str.size() == 0) { /* end of file? */ return(false); } /* Note that we aren't actually making sure this is in a comment, yet */ const char *ontext = cpd.settings[UO_enable_processing_cmt].str; if (ontext == NULL) { ontext = UNCRUSTIFY_ON_TEXT; } if (pc.str.find(ontext) < 0) { pc.type = CT_IGNORED; return(true); } ctx.restore(); /* parse off whitespace leading to the comment */ if (parse_whitespace(ctx, pc)) { pc.type = CT_IGNORED; return(true); } /* Look for the ending comment and let it pass */ if (parse_comment(ctx, pc) && !cpd.unc_off) { return(true); } /* Reset the chunk & scan to until a newline */ pc.str.clear(); while (ctx.more() && (ctx.peek() != '\r') && (ctx.peek() != '\n')) { pc.str.append(ctx.get()); } if (pc.str.size() > 0) { pc.type = CT_IGNORED; return(true); } return(false); } // parse_ignored