// 这些函数算是比较基本的了,看看就明白
static inline int is_space(int ch)
{
return ch == ‘ ‘ || ch == ‘\t’ || ch == ‘\v’ || ch == ‘\f’ || ch == ‘\r’;
}
static inline int isid(int c)
{
return (c >= ‘a’ && c <= ‘z’) || (c >= ‘A’ && c <= ‘Z’) || c == ‘_’;
}
static inline int isnum(int c)
{
return c >= ‘0’ && c <= ‘9’;
}
static inline int isoct(int c)
{
return c >= ‘0’ && c <= ‘7’;
}
static inline int toup(int c)
{
return (c >= ‘a’ && c <= ‘z’) ? c – ‘a’ + ‘A’ : c;
}
preprocess_new () at tccpp.c:3199
初始化isidnum表
/* init isid table */
for(i=CH_EOF;i<256;i++)
isidnum_table[i-CH_EOF] = isid(i) || isnum(i);
// 该函数剩下几行把tcc的关键字插入 ptable (代码如下)
[code]
static TokenSym *tok_alloc_new(TokenSym **pts, const char *str, int len)
{
TokenSym *ts, **ptable;
[/code]
[code]
//在头文件tcctok.h定义了tcc的关键字
static const char tcc_keywords[] =
#define DEF(id, str) str “\0”
#include “tcctok.h”
#undef DEF
;
[/code]
ST_FUNC TokenSym *tok_alloc(const char *str, int len)