void check_my_type(t_mar *mar) { int c; c = 0; if (mar->str[c] == 'i' || mar->str[c] == 'c' && mar->str[c + 1] == 'h' || mar->str[c] == 's' && mar->str[c + 1] == 'h') print_basic(mar, c); else if (mar->str[c] == 'l') check_long(mar, c); else if (mar->str[c] == 's' && mar->str[c + 1] == 't' && mar->str[c + 2] == 'a' && mar->str[c + 3] == 't' && mar->str[c + 4] == 'i' && mar->str[c + 5] == 'c' && mar->str[c + 6] == ' ') check_static(mar, c); else if (mar->str[c] == 'c' && mar->str[c + 1] == 'o' && mar->str[c + 2] == 'n' && mar->str[c + 3] == 's' && mar->str[c + 4] == 't' && mar->str[c + 5] == ' ') check_const(mar, c); else if (mar->str[c] == 'u' || mar->str[c] == 'v' || mar->str[c] == 'f' || mar->str[c] == 'd') check_my_type_two(mar, c); printf("Déclaration de la variable de type %s%s nommé %s.\n", mar->ptr, mar->type, mar->var); }
int main(int argc, char **argv) { struct block *block = block_new(); parse(stdin, block); print_basic(stdout, block); block_free(block); return 0; }
void print_basic(FILE *out, struct block *b) { static int depth = 0; indent(out, depth); fputs(b->text, out); fputc('\n', out); if (b->inner) { depth++; print_basic(out, b->inner); depth--; indent(out, depth); fputs("end.", out); } if (b->next) print_basic(out, b->next); }