bool check_letterdigit(t_parser *parser, char *string, char end) { int i; if (DEBUG == true) printf("check_letterdigit : %s\n", &(string[parser->pos])); i = 0; if (check_letter(string[parser->pos]) == false && check_digit(string[parser->pos]) == false) return (false); while (string[++(parser->pos)] != end && string[parser->pos] != 0) { ++i; if (check_letter(string[parser->pos]) == false && check_digit(string[parser->pos]) == false) { parser->pos -= i; return (dspb("letter", false)); } } if (string[parser->pos] != end) { parser->pos -= i; return (dspb("letter", false)); } ++(parser->pos); return (dspb("letter", true)); }
int word_check(char *str, int i, t_token **token) { char *word; int j; j = 0; word = xmalloc((strlen(str) + 1) * sizeof(char*)); word = memset(word, 0, (strlen(str) + 1)); while (((check_letter(str[i]) != -1) || str[i] == '\t' ) && (str[i] != '\0')) { word[j] = str[i]; j++; i++; } word[i] = '\0'; if (word[0] != '\0') { word = epur_str(word); *token = insert(*token, TOKEN_WORD, strdup(word), i); } free(word); return (i); }