33 #ifndef CHECK_INCLUDED
34 #include "../base/check.h"
45 static const int CH_TABSIZE = 256;
55 typedef enum ch_enum {
87 #define CH_CHARCAST(c) ((int) ((unsigned char)(c)))
106 static inline ch_t classify(
char c)
108 "ch_c::classify(not initialized)");
109 CHECK(CH_CHARCAST(c)<Tabsize,
110 "ch_c::classify(index out of range)");
111 return(Classify[CH_CHARCAST(c)]); }
117 static inline bool is_alnum(
char c)
119 "ch_c::is_alnum(not initialized)");
120 CHECK(CH_CHARCAST(c)<Tabsize,
121 "ch_c::is_alnum(index out of range)");
122 return(IsAlnum[CH_CHARCAST(c)]); }
128 static inline bool is_space(
char c)
129 {
return(c==
' ' || c==
'\t' || c==
'\r'); }
135 static inline bool is_comment(
char c)
142 static inline bool is_newline(
char c)
149 static inline bool is_quote(
char c)
156 static inline bool is_backslash(
char c)
163 static inline bool is_escape_seq(
char c)
164 {
return(c==
'\\' || c==
'\'' || c==
'\"' || c==
'n' || c==
'r' ||
171 static inline bool is_undersc(
char c)
178 static inline int digit_val(
char c) {
198 static inline int ord(
char c)
200 "ch_c::ord(not initialized)");
201 CHECK(CH_CHARCAST(c)<Tabsize,
202 "ch_c::ord(index out of range)");
203 return(Ord[CH_CHARCAST(c)]); }
209 static inline int xord(
char c)
211 "ch_c::xord(not initialized)");
212 CHECK(CH_CHARCAST(c)<Tabsize,
213 "ch_c::xord(index out of range)");
214 return(Xord[CH_CHARCAST(c)]); }
252 static inline void enter(
char c, ch_t cl);
262 static bool Initialized;
268 static ch_t Classify[CH_TABSIZE];
274 static bool IsAlnum[CH_TABSIZE];
280 static int Ord[CH_TABSIZE];
286 static int Xord[CH_TABSIZE];
const char * str_t
Definition: str.h:41
#define CHECK(EX, MSG)
Definition: check.h:69