summaryrefslogtreecommitdiff
path: root/compiler_and_linker/FrontEnd/C/CPrepTokenizer.c
diff options
context:
space:
mode:
Diffstat (limited to 'compiler_and_linker/FrontEnd/C/CPrepTokenizer.c')
-rw-r--r--compiler_and_linker/FrontEnd/C/CPrepTokenizer.c106
1 files changed, 53 insertions, 53 deletions
diff --git a/compiler_and_linker/FrontEnd/C/CPrepTokenizer.c b/compiler_and_linker/FrontEnd/C/CPrepTokenizer.c
index 4ea0fb0..4c36aab 100644
--- a/compiler_and_linker/FrontEnd/C/CPrepTokenizer.c
+++ b/compiler_and_linker/FrontEnd/C/CPrepTokenizer.c
@@ -91,7 +91,7 @@ loop:
for (;;) {
if (!(c = *(p++))) {
if (tokenstacklevel > 0 || p >= (StringPtr) prep_file_end) {
- CPrep_Error(103);
+ CPrep_Error(CErrorStr103);
nextcharpos = (char *) p - 1;
return c;
}
@@ -235,7 +235,7 @@ loop:
if (!(c = *(p++))) {
if (tokenstacklevel > 0 || p >= (StringPtr) prep_file_end) {
pos = (char *) p - 1;
- CPrep_Error(103);
+ CPrep_Error(CErrorStr103);
return c;
}
p[-1] = ' ';
@@ -411,12 +411,12 @@ void CPrep_MatchChar(char ch, Boolean flag) {
loop:
if (!(c = *(p++))) {
if (tokenstacklevel > 0 || p >= prep_file_end)
- CPrep_Error(102);
+ CPrep_Error(CErrorStr102);
else if (ch == '"')
- CPrep_Error(101);
+ CPrep_Error(CErrorStr101);
else if (ch == '\'')
- CPrep_Error(100);
- CPrep_Error(117);
+ CPrep_Error(CErrorStr100);
+ CPrep_Error(CErrorStr117);
pos = p - 1;
return;
}
@@ -427,7 +427,7 @@ loop:
foundnl();
if (*p == '\n')
p++;
- CPrep_Error(112);
+ CPrep_Error(CErrorStr112);
pos = p;
return;
}
@@ -487,12 +487,12 @@ char *CPrep_MatchChar2(char *start, char ch, Boolean flag) {
loop:
if (!(c = *(p++))) {
if (tokenstacklevel > 0 || p >= prep_file_end)
- CPrep_Error(102);
+ CPrep_Error(CErrorStr102);
else if (ch == '"')
- CPrep_Error(101);
+ CPrep_Error(CErrorStr101);
else if (ch == '\'')
- CPrep_Error(100);
- CPrep_Error(117);
+ CPrep_Error(CErrorStr100);
+ CPrep_Error(CErrorStr117);
return p - 1;
}
@@ -502,7 +502,7 @@ loop:
foundnl();
if (*p == '\n')
p++;
- CPrep_Error(112);
+ CPrep_Error(CErrorStr112);
return p;
}
haveBackslash = 0;
@@ -700,7 +700,7 @@ static short intsuffix(short token, Boolean flag) {
}
if ((t >= 'a' && t <= 'z') || (t >= 'A' && t <= 'Z') || (t == '_') || (t >= '0' && t <= '9'))
- CPrep_Error(105);
+ CPrep_Error(CErrorStr105);
if (!is_longlong && !is_long) {
if (!is_unsigned && CInt64_IsInRange(tkintconst, stsignedint.size))
@@ -720,7 +720,7 @@ static short intsuffix(short token, Boolean flag) {
if (CInt64_IsInURange(tkintconst, stsignedlonglong.size))
return IT_ULONGLONG;
}
- CError_Error(154);
+ CError_Error(CErrorStr154);
tkintconst = cint64_zero;
return IT_INT;
}
@@ -766,7 +766,7 @@ static short floatsuffix(short token) {
}
if ((token >= 'a' && token <= 'z') || (token >= 'A' && token <= 'Z') || (token == '_') || (token >= '0' && token <= '9')) {
- CPrep_Error(105);
+ CPrep_Error(CErrorStr105);
whichtype = IT_DOUBLE;
}
@@ -819,7 +819,7 @@ static SInt32 nextchar(StringPtr str) {
case 'x':
chr = tohex(prepnextstringchar(str, 1));
if (chr == -1) {
- CPrep_Error(100);
+ CPrep_Error(CErrorStr100);
return ' ';
}
out_of_bounds = 0;
@@ -830,7 +830,7 @@ static SInt32 nextchar(StringPtr str) {
out_of_bounds = 1;
}
if (out_of_bounds)
- CError_Error(100);
+ CError_Error(CErrorStr100);
break;
default:
if (t >= '0' && t <= '7') {
@@ -845,7 +845,7 @@ static SInt32 nextchar(StringPtr str) {
i++;
}
if (out_of_bounds)
- CError_Error(100);
+ CError_Error(CErrorStr100);
} else {
chr = t;
}
@@ -1018,7 +1018,7 @@ void skipendofline(void) {
if ((ch = *(p++)) == 0) {
if (tokenstacklevel > 0 || p >= (StringPtr) prep_file_end) {
pos = (char *) p - 1;
- CPrep_Error(103);
+ CPrep_Error(CErrorStr103);
return;
}
p[-1] = ' ';
@@ -1084,12 +1084,12 @@ void CPrep_SkipAsmComment(void) {
macrocheck = save_macrocheck;
}
-static short tille(void) { return TK_NEG6; }
+static short tille(void) { return TK_ILLEGAL; }
static short tcret(void) {
newline();
if (cprep_eoltokens)
- return TK_NEG7;
+ return TK_EOL;
else
return 0;
}
@@ -1107,7 +1107,7 @@ static short tapos(short _t) {
start = (StringPtr) pos;
t = nextchar((StringPtr) pos);
if ((t == '\'' || t == 0 || t == '\r') && !was_escchar) {
- CPrep_Error(100);
+ CPrep_Error(CErrorStr100);
tkintconst = cint64_zero;
tksize = IT_INT;
return TK_INTCONST;
@@ -1170,7 +1170,7 @@ static short tapos(short _t) {
while (1) {
if ((t2 == 0 || t2 == '\r') && !was_escchar) {
- CPrep_Error(100);
+ CPrep_Error(CErrorStr100);
break;
}
@@ -1183,7 +1183,7 @@ static short tapos(short _t) {
break;
if (i >= stunsignedlonglong.size) {
- CPrep_Error(100);
+ CPrep_Error(CErrorStr100);
break;
}
}
@@ -1237,9 +1237,9 @@ static short tquot(short t) {
c = nextchar(start_pos);
if ((c == '"' || c == '\r' || c == 0) && !was_escchar) {
if (c == 0 && (tokenstacklevel > 0 || pos >= prep_file_end))
- CPrep_Error(102);
+ CPrep_Error(CErrorStr102);
else if (c != '"')
- CPrep_Error(101);
+ CPrep_Error(CErrorStr101);
break;
}
if ((size + type->size) >= maxstringsize) {
@@ -1262,7 +1262,7 @@ static short tquot(short t) {
if (ispascalstring) {
if (size > 255 && type->size == 1) {
- CPrep_Error(106);
+ CPrep_Error(CErrorStr106);
size = 255;
}
CInt64_SetLong(&ch64, size / type->size);
@@ -1571,7 +1571,7 @@ static short tzero(short t) {
case 'e':
pos = CMach_FloatScan(p, &tkfloatconst, &floatFailed);
if (floatFailed)
- CPrep_Error(154);
+ CPrep_Error(CErrorStr154);
tksize = floatsuffix(prepcurchar());
return TK_FLOATCONST;
}
@@ -1580,7 +1580,7 @@ static short tzero(short t) {
}
if (failed) {
- CPrep_Error(154);
+ CPrep_Error(CErrorStr154);
tkintconst = cint64_zero;
}
@@ -1601,7 +1601,7 @@ static short tpoin(void) {
if (ch >= '0' && ch <= '9') {
pos = CMach_FloatScan(p, &tkfloatconst, &failed);
if (failed)
- CPrep_Error(154);
+ CPrep_Error(CErrorStr154);
tksize = floatsuffix(prepcurchar());
return TK_FLOATCONST;
}
@@ -1631,13 +1631,13 @@ static short tnumb(short t) {
if (ch == '.' || ch == 'e' || ch == 'E') {
pos = CMach_FloatScan(p, &tkfloatconst, &floatFailed);
if (floatFailed)
- CPrep_Error(154);
+ CPrep_Error(CErrorStr154);
tksize = floatsuffix(prepcurchar());
return TK_FLOATCONST;
}
if (failed) {
- CPrep_Error(154);
+ CPrep_Error(CErrorStr154);
tkintconst = cint64_zero;
}
@@ -1744,12 +1744,12 @@ static short tchrc(void) {
if (copts.cplusplus) {
if (!strcmp("const_cast", tkidentifier->name)) {
if (copts.ecplusplus)
- CPrep_Warning(339);
+ CPrep_Warning(CErrorStr339);
return TK_CONST_CAST;
}
if (!strcmp("catch", tkidentifier->name)) {
if (copts.ecplusplus)
- CPrep_Warning(339);
+ CPrep_Warning(CErrorStr339);
return TK_CATCH;
}
if (!strcmp("class", tkidentifier->name))
@@ -1778,7 +1778,7 @@ static short tchrd(void) {
return TK_DELETE;
if (!strcmp("dynamic_cast", tkidentifier->name)) {
if (copts.ecplusplus)
- CPrep_Warning(339);
+ CPrep_Warning(CErrorStr339);
return TK_DYNAMIC_CAST;
}
}
@@ -1875,7 +1875,7 @@ static short tchrm(void) {
return 0;
if (copts.cplusplus && !strcmp("mutable", tkidentifier->name)) {
if (copts.ecplusplus)
- CPrep_Warning(339);
+ CPrep_Warning(CErrorStr339);
return TK_MUTABLE;
}
return TK_IDENTIFIER;
@@ -1891,7 +1891,7 @@ static short tchrn(short t) {
return TK_NEW;
if (!strcmp("namespace", tkidentifier->name)) {
if (copts.ecplusplus)
- CPrep_Warning(339);
+ CPrep_Warning(CErrorStr339);
return TK_NAMESPACE;
}
if (!in_assembler && !preprocessing_only) {
@@ -1957,7 +1957,7 @@ static short tchrr(void) {
return TK_RETURN;
if (copts.cplusplus && !strcmp("reinterpret_cast", tkidentifier->name)) {
if (copts.ecplusplus)
- CPrep_Warning(339);
+ CPrep_Warning(CErrorStr339);
return TK_REINTERPRET_CAST;
}
if (copts.c9x && !strcmp("restrict", tkidentifier->name))
@@ -1984,7 +1984,7 @@ static short tchrs(void) {
return TK_SWITCH;
if (copts.cplusplus && !strcmp("static_cast", tkidentifier->name)) {
if (copts.ecplusplus)
- CPrep_Warning(339);
+ CPrep_Warning(CErrorStr339);
return TK_STATIC_CAST;
}
return TK_IDENTIFIER;
@@ -2006,27 +2006,27 @@ static short tchrt(void) {
return TK_TRUE;
if (!strcmp("template", tkidentifier->name)) {
if (copts.ecplusplus)
- CPrep_Warning(339);
+ CPrep_Warning(CErrorStr339);
return TK_TEMPLATE;
}
if (!strcmp("try", tkidentifier->name)) {
if (copts.ecplusplus)
- CPrep_Warning(339);
+ CPrep_Warning(CErrorStr339);
return TK_TRY;
}
if (!strcmp("throw", tkidentifier->name)) {
if (copts.ecplusplus)
- CPrep_Warning(339);
+ CPrep_Warning(CErrorStr339);
return TK_THROW;
}
if (!strcmp("typeid", tkidentifier->name)) {
if (copts.ecplusplus)
- CPrep_Warning(339);
+ CPrep_Warning(CErrorStr339);
return TK_TYPEID;
}
if (!strcmp("typename", tkidentifier->name)) {
if (copts.ecplusplus)
- CPrep_Warning(339);
+ CPrep_Warning(CErrorStr339);
return TK_TYPENAME;
}
}
@@ -2044,7 +2044,7 @@ static short tchru(void) {
return TK_UNSIGNED;
if (copts.cplusplus && !strcmp("using", tkidentifier->name)) {
if (copts.ecplusplus)
- CPrep_Warning(339);
+ CPrep_Warning(CErrorStr339);
return TK_USING;
}
return TK_IDENTIFIER;
@@ -2151,7 +2151,7 @@ static short tdoll(short t) {
static short tisid(void) {
if (!tokenstacklevel)
- CError_Error(105);
+ CError_Error(CErrorStr105);
return 0;
}
@@ -2161,7 +2161,7 @@ static short tnull(short t) {
return t;
} else {
pos[-1] = -64;
- return TK_NEG6;
+ return TK_ILLEGAL;
}
}
@@ -2169,7 +2169,7 @@ static short t0x1a(void) {
if (*pos == 0)
return 0;
else
- return TK_NEG6;
+ return TK_ILLEGAL;
}
typedef short (*TokenizePtr)(short);
@@ -2228,7 +2228,7 @@ short lookahead_noeol(void) {
CPrep_TokenStreamGetState(&state);
do {
t = lex();
- } while (t == TK_NEG7);
+ } while (t == TK_EOL);
CPrep_TokenStreamSetState(&state);
return t;
@@ -2303,7 +2303,7 @@ static void CPrep_StringConCat(Boolean flag) {
ch = lex();
elem = --ts_current;
memmove(elem, elem + 1, sizeof(TStreamElement) * ts_preread_elements);
- } while (ch == TK_NEG7);
+ } while (ch == TK_EOL);
chunk = lalloc(sizeof(StringChunk));
chunk->next = chunks;
@@ -2330,7 +2330,7 @@ short lex(void) {
short t;
while (1) {
- if (ts_preread_elements > 0)
+ if (ts_preread_elements <= 0)
break;
t = ts_current->tokentype;
@@ -2353,7 +2353,7 @@ short lex(void) {
tksize = ts_current->data.tkstring.size;
ispascalstring = ts_current->subtype;
break;
- case TK_NEG7:
+ case TK_EOL:
nlflag = 1;
if (!cprep_eoltokens) {
ts_current++;
@@ -2414,7 +2414,7 @@ short lex(void) {
return t;
}
break;
- case TK_NEG6:
+ case TK_ILLEGAL:
ts_current++;
CError_Error(CErrorStr105);
ts_current--;