From 7a6b76f519695d686c378f2450658504448c75f6 Mon Sep 17 00:00:00 2001 From: lemon Date: Mon, 19 Jun 2023 09:30:27 +0200 Subject: move ctype to common.h --- common.h | 7 +++++++ parse.h | 11 ----------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/common.h b/common.h index f6dc5e3..ec2c6d7 100644 --- a/common.h +++ b/common.h @@ -88,6 +88,13 @@ ilog2(uint x) { /* assumes x is a power of 2 */ #endif } +#define aisprint(c) in_range(c, ' ', '~') +#define aisdigit(c) in_range(c, '0', '9') +#define aisodigit(c) in_range(c, '0', '7') +#define aisalpha(c) in_range((c)|0x20, 'a', 'z') +static inline bool aisspace(int c) { return c == ' ' || in_range(c, '\t', '\r'); } +static inline bool aisxdigit(int c) { return aisdigit(c) || in_range(c|0x20, 'a', 'f'); } + /******************/ /* COMPILER STATE */ /******************/ diff --git a/parse.h b/parse.h index a28c301..be5f81e 100644 --- a/parse.h +++ b/parse.h @@ -113,17 +113,6 @@ enum typetag parsenumlit(uvlong *, double *, const struct token *, bool ispp); void initparser(struct parser *, const char *file); void parse(struct parser *); -/***********/ -/** CTYPE **/ -/***********/ - -#define aisprint(c) in_range(c, ' ', '~') -#define aisdigit(c) in_range(c, '0', '9') -#define aisodigit(c) in_range(c, '0', '7') -#define aisalpha(c) in_range((c)|0x20, 'a', 'z') -static inline bool aisspace(int c) { return c == ' ' || in_range(c, '\t', '\r'); } -static inline bool aisxdigit(int c) { return aisdigit(c) || in_range(c|0x20, 'a', 'f'); } - /************/ /* ANALYSIS */ /************/ -- cgit v1.2.3