From 850c8625ae784a08094f30dde9c85b74e369bacd Mon Sep 17 00:00:00 2001 From: Luc Van Oostenryck Date: Mon, 18 May 2020 02:18:49 +0200 Subject: univ-init: add helper match_token_zero() Signed-off-by: Luc Van Oostenryck --- token.h | 7 +++++++ 1 file changed, 7 insertions(+) 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 -- cgit 1.2.3-korg