aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2020-05-18 02:18:49 +0200
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2020-05-18 04:08:31 +0200
commit850c8625ae784a08094f30dde9c85b74e369bacd (patch)
tree10e6bc71729b7fc10f4a5a87557d0fa3ffa6ebf1
parentb8fad4bcd02210912de8cbdefcd77e9ca743a575 (diff)
downloadsparse-850c8625ae784a08094f30dde9c85b74e369bacd.tar.gz
univ-init: add helper match_token_zero()
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
-rw-r--r--token.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/token.h b/token.h
index 292db167..33a6eda1 100644
--- a/token.h
+++ b/token.h
@@ -241,4 +241,11 @@ static inline int match_ident(struct token *token, struct ident *id)
return token->pos.type == TOKEN_IDENT && token->ident == id;
}
+static inline int match_token_zero(struct token *token)
+{
+ if (token_type(token) != TOKEN_NUMBER)
+ return false;
+ return token->number[0] == '0' && !token->number[1];
+}
+
#endif