ISL_TOKEN_TO, ISL_TOKEN_AND,
ISL_TOKEN_OR, ISL_TOKEN_EXISTS,
ISL_TOKEN_DEF, ISL_TOKEN_INFTY, ISL_TOKEN_NAN,
+ ISL_TOKEN_STRING,
ISL_TOKEN_LAST };
struct isl_token {
return;
if (tok->type == ISL_TOKEN_VALUE)
isl_int_clear(tok->u.v);
- else if (tok->type == ISL_TOKEN_IDENT)
+ else if (tok->type == ISL_TOKEN_IDENT || tok->type == ISL_TOKEN_STRING)
free(tok->u.s);
free(tok);
}
tok->u.s = strdup(s->buffer);
return tok;
}
+ if (c == '"') {
+ tok = isl_token_new(s->ctx, line, col, old_line != line);
+ if (!tok)
+ return NULL;
+ tok->type = ISL_TOKEN_STRING;
+ tok->u.s = NULL;
+ while ((c = isl_stream_getc(s)) != -1 && c != '"' && c != '\n')
+ isl_stream_push_char(s, c);
+ if (c != '"') {
+ isl_stream_error(s, NULL, "unterminated string");
+ goto error;
+ }
+ tok->u.s = strdup(s->buffer);
+ return tok;
+ }
if (c == ':') {
int c;
tok = isl_token_new(s->ctx, line, col, old_line != line);