Commit 3b2c6d33 authored by Dridi Boukelmoune's avatar Dridi Boukelmoune

Move libvcc away from is* macros

Refs #2354
parent 56f7ff4d
......@@ -43,6 +43,8 @@
#define VCT_TCHAR (1<<9)
#define VCT_NAME (1<<10)
#define VCT_VAR (1<<11)
#define VCT_VT (1<<12)
#define VCT_SPACE (VCT_LWS | VCT_VT)
extern const uint16_t vct_typtab[256];
......@@ -60,8 +62,10 @@ vct_is(int x, uint16_t y)
#define vct_ishex(x) vct_is(x, VCT_HEX)
#define vct_islws(x) vct_is(x, VCT_LWS)
#define vct_isctl(x) vct_is(x, VCT_CTL)
#define vct_isspace(x) vct_is(x, VCT_SPACE)
#define vct_isdigit(x) vct_is(x, VCT_DIGIT)
#define vct_isalpha(x) vct_is(x, VCT_ALPHA)
#define vct_isalnum(x) vct_is(x, VCT_ALPHA | VCT_DIGIT)
#define vct_issep(x) vct_is(x, VCT_SEPARATOR)
#define vct_issepctl(x) vct_is(x, VCT_SEPARATOR | VCT_CTL)
#define vct_isident1(x) vct_isalpha(x)
......
......@@ -54,7 +54,7 @@ const uint16_t vct_typtab[256] = {
[0x08] = VCT_CTL,
[0x09] = VCT_CTL | VCT_SP | VCT_SEPARATOR,
[0x0a] = VCT_CTL | VCT_CRLF,
[0x0b] = VCT_CTL,
[0x0b] = VCT_CTL | VCT_VT,
[0x0c] = VCT_CTL,
[0x0d] = VCT_CTL | VCT_CRLF,
[0x0e] = VCT_CTL,
......
......@@ -29,7 +29,6 @@
#include "config.h"
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
......@@ -304,7 +303,7 @@ vcc_ExpectCid(struct vcc *tl, const char *what)
ERRCHK(tl);
/* XXX: too soon to use vct_invalid_name() */
for (q = tl->t->b; q < tl->t->e; q++) {
if (!isalnum(*q) && *q != '_') {
if (!vct_isalnum(*q) && *q != '_') {
VSB_printf(tl->sb, "Name of %s, ", what);
vcc_ErrToken(tl, tl->t);
VSB_printf(tl->sb,
......@@ -371,7 +370,7 @@ vcc_Lexer(struct vcc *tl, struct source *sp)
for (p = sp->b; p < sp->e; ) {
/* Skip any whitespace */
if (isspace(*p)) {
if (vct_isspace(*p)) {
p++;
continue;
}
......@@ -501,9 +500,9 @@ vcc_Lexer(struct vcc *tl, struct source *sp)
}
/* Match numbers { [0-9]+ } */
if (isdigit(*p)) {
if (vct_isdigit(*p)) {
for (q = p; q < sp->e; q++)
if (!isdigit(*q))
if (!vct_isdigit(*q))
break;
vcc_AddToken(tl, CNUM, p, q);
p = q;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment