Ejemplo n.º 1
0
// reads an instruction line from the input file
// lines consisting solely of whitespace and/or comments are skipped
char* get_line(FILE* in , char* buffer)
{
	if(fgets(buffer,LINE_BUFFER_SIZE,in) == NULL) return NULL;
	char* line = make_lower(trim(trim_comment(buffer)));
	if(streq(line,"")) return get_line(in,buffer);
	else return line;
}
Ejemplo n.º 2
0
void    parser(t_list **l, header_t *h, char *s)
{
    while (s && *s != 0)
    {
        if (*s == COMMENT_CHAR)
            s = trim_comment(s);
        if (ft_strncmp(".name", s, 5) == 0)
            s += set_header_name(h, s, 6);
        else if (ft_strncmp(".comment", s, 8) == 0)
            s += set_header_cmt(h, s, 9);
        else if (ft_strchr(LABEL_CHARS, *s))
            s = define(s, l);
        s++;
    }
    ft_iter_label(*l, instr_inlabel);
}