add isl_token_get_type
authorSven Verdoolaege <skimo@kotnet.org>
Tue, 28 May 2013 10:12:45 +0000 (12:12 +0200)
committerSven Verdoolaege <skimo@kotnet.org>
Tue, 28 May 2013 18:42:48 +0000 (20:42 +0200)
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
include/isl/stream.h
isl_stream.c

index 2e6e1b7..7484af1 100644 (file)
@@ -55,6 +55,7 @@ struct isl_token {
 
 __isl_give isl_val *isl_token_get_val(isl_ctx *ctx, struct isl_token *tok);
 __isl_give char *isl_token_get_str(isl_ctx *ctx, struct isl_token *tok);
+int isl_token_get_type(struct isl_token *tok);
 void isl_token_free(struct isl_token *tok);
 
 struct isl_stream {
index 388c204..c40756d 100644 (file)
@@ -81,6 +81,13 @@ struct isl_token *isl_token_new(isl_ctx *ctx,
        return tok;
 }
 
+/* Return the type of "tok".
+ */
+int isl_token_get_type(struct isl_token *tok)
+{
+       return tok ? tok->type : ISL_TOKEN_ERROR;
+}
+
 /* Given a token of type ISL_TOKEN_VALUE, return the value it represents.
  */
 __isl_give isl_val *isl_token_get_val(isl_ctx *ctx, struct isl_token *tok)