diff --git a/src/parser_util.c b/src/parser_util.c
index 1ece241..17e3027 100644
--- a/src/parser_util.c
+++ b/src/parser_util.c
@@ -16,8 +16,10 @@ parse_result_t parse_success(ast_node_t *ast, tokenlist_entry_t *next) {
 }
 
 parse_result_t parse_token(tokenlist_entry_t *current,
-                           lexer_token_id_t token_id, node_id_t ast_id) {
-    if (current->token.id != token_id)
+                           lexer_token_id_t token_id, node_id_t ast_id,
+                           token_validator_t is_valid) {
+    if (current->token.id != token_id ||
+        (is_valid && !is_valid(&current->token)))
         return parse_no_match();
 
     ast_node_t *node;
diff --git a/src/parser_util.h b/src/parser_util.h
index f21af58..8d7936a 100644
--- a/src/parser_util.h
+++ b/src/parser_util.h
@@ -11,11 +11,14 @@ typedef struct parse_result {
     ast_node_t *node;
 } parse_result_t;
 
+typedef bool (*token_validator_t)(lexer_token_t *);
+
 parse_result_t parse_error(error_t *err);
 parse_result_t parse_no_match();
 parse_result_t parse_success(ast_node_t *ast, tokenlist_entry_t *next);
 parse_result_t parse_token(tokenlist_entry_t *current,
-                           lexer_token_id_t token_id, node_id_t ast_id);
+                           lexer_token_id_t token_id, node_id_t ast_id,
+                           token_validator_t is_valid);
 
 tokenlist_entry_t *skip_insignificant(tokenlist_entry_t *);