Fix all special cases where line number was wrong
This commit is contained in:
parent
cece07145c
commit
da542698e7
26
cc_reader.c
26
cc_reader.c
|
@ -23,9 +23,16 @@ struct token_list* token;
|
||||||
int line;
|
int line;
|
||||||
char* file;
|
char* file;
|
||||||
|
|
||||||
|
int grab_byte()
|
||||||
|
{
|
||||||
|
int c = fgetc(input);
|
||||||
|
if(10 == c) line = line + 1;
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
|
||||||
int clearWhiteSpace(int c)
|
int clearWhiteSpace(int c)
|
||||||
{
|
{
|
||||||
if((32 == c) || (9 == c)) return clearWhiteSpace(fgetc(input));
|
if((32 == c) || (9 == c)) return clearWhiteSpace(grab_byte());
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,7 +41,7 @@ int consume_byte(int c)
|
||||||
hold_string[string_index] = c;
|
hold_string[string_index] = c;
|
||||||
string_index = string_index + 1;
|
string_index = string_index + 1;
|
||||||
require(MAX_STRING > string_index, "Token exceeded MAX_STRING char limit\nuse --max-string number to increase\n");
|
require(MAX_STRING > string_index, "Token exceeded MAX_STRING char limit\nuse --max-string number to increase\n");
|
||||||
return fgetc(input);
|
return grab_byte();
|
||||||
}
|
}
|
||||||
|
|
||||||
int preserve_string(int c)
|
int preserve_string(int c)
|
||||||
|
@ -48,7 +55,7 @@ int preserve_string(int c)
|
||||||
c = consume_byte(c);
|
c = consume_byte(c);
|
||||||
require(EOF != c, "Unterminated string\n");
|
require(EOF != c, "Unterminated string\n");
|
||||||
} while(escape || (c != frequent));
|
} while(escape || (c != frequent));
|
||||||
return fgetc(input);
|
return grab_byte();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -243,20 +250,18 @@ reset:
|
||||||
c = consume_byte(c);
|
c = consume_byte(c);
|
||||||
if(c == '*')
|
if(c == '*')
|
||||||
{
|
{
|
||||||
c = fgetc(input);
|
c = grab_byte();
|
||||||
while(c != '/')
|
while(c != '/')
|
||||||
{
|
{
|
||||||
while(c != '*')
|
while(c != '*')
|
||||||
{
|
{
|
||||||
c = fgetc(input);
|
c = grab_byte();
|
||||||
require(EOF != c, "Hit EOF inside of block comment\n");
|
require(EOF != c, "Hit EOF inside of block comment\n");
|
||||||
if('\n' == c) line = line + 1;
|
|
||||||
}
|
}
|
||||||
c = fgetc(input);
|
c = grab_byte();
|
||||||
require(EOF != c, "Hit EOF inside of block comment\n");
|
require(EOF != c, "Hit EOF inside of block comment\n");
|
||||||
if('\n' == c) line = line + 1;
|
|
||||||
}
|
}
|
||||||
c = fgetc(input);
|
c = grab_byte();
|
||||||
goto reset;
|
goto reset;
|
||||||
}
|
}
|
||||||
else if(c == '/')
|
else if(c == '/')
|
||||||
|
@ -266,7 +271,6 @@ reset:
|
||||||
}
|
}
|
||||||
else if (c == '\n')
|
else if (c == '\n')
|
||||||
{
|
{
|
||||||
line = line + 1;
|
|
||||||
c = consume_byte(c);
|
c = consume_byte(c);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -307,7 +311,7 @@ struct token_list* read_all_tokens(FILE* a, struct token_list* current, char* fi
|
||||||
line = 1;
|
line = 1;
|
||||||
file = filename;
|
file = filename;
|
||||||
token = current;
|
token = current;
|
||||||
int ch =fgetc(input);
|
int ch =grab_byte();
|
||||||
while(EOF != ch) ch = get_token(ch);
|
while(EOF != ch) ch = get_token(ch);
|
||||||
|
|
||||||
return token;
|
return token;
|
||||||
|
|
|
@ -179,8 +179,8 @@ fc31fc8b2d78bd50a4c89eb0e29149626868a70842a3dcb01ea87bb275a9e3c2 test/results/t
|
||||||
965bdf7049179199b9f423250a186c7b64ea55326c3249127d2daf7d42ae53cc test/results/test0106-knight-native-binary
|
965bdf7049179199b9f423250a186c7b64ea55326c3249127d2daf7d42ae53cc test/results/test0106-knight-native-binary
|
||||||
0a929d6990caee3e93b1188a38fd3041c6f8e46d25a386024647c0f05c33bce7 test/results/test0106-knight-posix-binary
|
0a929d6990caee3e93b1188a38fd3041c6f8e46d25a386024647c0f05c33bce7 test/results/test0106-knight-posix-binary
|
||||||
331ffb5284bd824494ad61a3b0b2dff5681a63ab604e9a06100af531ae237148 test/results/test0106-x86-binary
|
331ffb5284bd824494ad61a3b0b2dff5681a63ab604e9a06100af531ae237148 test/results/test0106-x86-binary
|
||||||
6fa2ce14e9b6c30165902e69e5949c315c2b70674801f3886976d03d576ec5a5 test/results/test1000-aarch64-binary
|
b059b96414cf326cf211c3b1d63eb01a15924a3c60964ed2e583856715e522fa test/results/test1000-aarch64-binary
|
||||||
b9e67dc42ef0add9673e9f15bc459ba193816906f28371284740ea0042a363ba test/results/test1000-amd64-binary
|
c257acf49baa7335f29fd08dcc33986734bb11217b9489f908ec1a46ac228837 test/results/test1000-amd64-binary
|
||||||
bd9d5f4152c9e0bf5ef7a51728135de2d0a860d13f78f84eabba9f8447905eab test/results/test1000-armv7l-binary
|
0ecdeb7ff165e675d30973906691d02cf2a3a9486d4d3e4da1074e1b8e58dbf7 test/results/test1000-armv7l-binary
|
||||||
2ed7798fc821afcf32e0ef36a4d2fd78f80f098b94775f0450bf56a1ffcfc57b test/results/test1000-knight-posix-binary
|
423b5e50018d464c62c6a5fc4384cb716f56a07ad434c32e7adc6a4446ebcb4c test/results/test1000-knight-posix-binary
|
||||||
d8d73527fd105564db075726923143b1d278682488a761aae29b06ec5e30506d test/results/test1000-x86-binary
|
989b624d9a37aae9a92286542d45450775bcbb924667a4e7a975834e5e85050b test/results/test1000-x86-binary
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
63f61f98451e2d1f88c0211694bc95257aaf67e03af5943bf3a1cc8361138bc2 test/test1000/proof
|
1b63f8b58ff8758d46629d57e45c97fc95bab326603107689883ba6aef0a77cc test/test1000/proof
|
||||||
|
|
Loading…
Reference in New Issue