}
if (c != -1)
isl_stream_ungetc(s, c);
+ if (!isdigit(c)) {
+ tok = isl_token_new(s->ctx, line, col, old_line != line);
+ if (!tok)
+ return NULL;
+ tok->type = (enum isl_token_type) '-';
+ return tok;
+ }
}
if (c == '-' || isdigit(c)) {
tok = isl_token_new(s->ctx, line, col, old_line != line);
goto error;
if (c != -1)
isl_stream_ungetc(s, c);
- if (s->len == 1 && s->buffer[0] == '-')
- isl_int_set_si(tok->u.v, -1);
- else {
- isl_stream_push_char(s, '\0');
- isl_int_read(tok->u.v, s->buffer);
- }
+ isl_stream_push_char(s, '\0');
+ isl_int_read(tok->u.v, s->buffer);
return tok;
}
if (isalpha(c)) {
}
if (c == '>') {
int c;
+ tok = isl_token_new(s->ctx, line, col, old_line != line);
+ if (!tok)
+ return NULL;
if ((c = isl_stream_getc(s)) == '=') {
- tok = isl_token_new(s->ctx, line, col, old_line != line);
- if (!tok)
- return NULL;
tok->type = ISL_TOKEN_GE;
return tok;
}
if (c != -1)
isl_stream_ungetc(s, c);
+ tok->type = ISL_TOKEN_GT;
+ return tok;
}
if (c == '<') {
int c;
+ tok = isl_token_new(s->ctx, line, col, old_line != line);
+ if (!tok)
+ return NULL;
if ((c = isl_stream_getc(s)) == '=') {
- tok = isl_token_new(s->ctx, line, col, old_line != line);
- if (!tok)
- return NULL;
tok->type = ISL_TOKEN_LE;
return tok;
}
if (c != -1)
isl_stream_ungetc(s, c);
+ tok->type = ISL_TOKEN_LT;
+ return tok;
}
if (c == '&') {
tok = isl_token_new(s->ctx, line, col, old_line != line);