24 for (
const char *p = token.c_str(); *p != 0; p++)
26 if (*p >=
'0' && *p <=
'7') val = val * 8 + *p -
'0';
34 for (
const char *p = token.c_str(); *p != 0; p++)
36 if (*p >=
'0' && *p <=
'9') val = val * 10 + *p -
'0';
44 for (
const char *p = token.c_str(); *p != 0; p++)
46 if (*p >=
'0' && *p <=
'9') val = val * 16 + *p -
'0';
47 else if (*p >=
'a' && *p <=
'f') val = val * 16 + *p -
'a' + 10;
48 else if (*p >=
'A' && *p <=
'F') val = val * 16 + *p -
'A' + 10;
57 for (
const char *p = token.c_str(); *p != 0; p++)
59 if (*p >=
'0' && *p <=
'1') val = val * 2 + *p -
'0';
70 case 'n':
return CPPValue((
long)
'\n');
71 case 't':
return CPPValue((
long)
'\t');
72 case 'v':
return CPPValue((
long)
'\v');
73 case 'b':
return CPPValue((
long)
'\b');
74 case 'r':
return CPPValue((
long)
'\r');
75 case 'f':
return CPPValue((
long)
'\f');
76 case 'a':
return CPPValue((
long)
'\a');
77 case '\\':
return CPPValue((
long)
'\\');
78 case '?':
return CPPValue((
long)
'\?');
79 case '\'':
return CPPValue((
long)
'\'');
80 case '"':
return CPPValue((
long)
'"');
92 default: printf(
"Invalid escape sequence %s found!\n",token.c_str());