Remove a useless status
diff --git a/include/bc.h b/include/bc.h
index 5207720..7f4a36a 100644
--- a/include/bc.h
+++ b/include/bc.h
@@ -78,7 +78,6 @@
BC_STATUS_PARSE_QUIT,
BC_STATUS_PARSE_MISMATCH_NUM_FUNCS,
BC_STATUS_PARSE_DUPLICATE_LOCAL,
- BC_STATUS_PARSE_EOF,
BC_STATUS_PARSE_BUG,
BC_STATUS_MATH_NEGATIVE,
diff --git a/src/bc/bc.c b/src/bc/bc.c
index 64151c9..9651acc 100644
--- a/src/bc/bc.c
+++ b/src/bc/bc.c
@@ -126,7 +126,7 @@
while (!status) status = bc_parse_parse(&vm.parse);
- if (status != BC_STATUS_LEX_EOF && status != BC_STATUS_PARSE_EOF) goto err;
+ if (status != BC_STATUS_LEX_EOF) goto err;
// Make sure to execute the math library.
status = bc_program_exec(&vm.program);
diff --git a/src/bc/data.c b/src/bc/data.c
index cc45d43..8f9a4ab 100644
--- a/src/bc/data.c
+++ b/src/bc/data.c
@@ -70,7 +70,6 @@
"Parse",
"Parse",
"Parse",
- "Parse",
"Math",
"Math",
@@ -163,7 +162,6 @@
"number of functions does not match the number of entries "
"in the function map; this is most likely a bug in bc",
"function parameter or auto var has the same name as another",
- "end of file",
"bug in parser",
"negative number",
diff --git a/src/bc/parse.c b/src/bc/parse.c
index 3e2ae2e..9eb94bc 100644
--- a/src/bc/parse.c
+++ b/src/bc/parse.c
@@ -1518,7 +1518,7 @@
case BC_LEX_EOF:
{
- if (parse->flags.len > 0) status = BC_STATUS_PARSE_EOF;
+ if (parse->flags.len > 0) status = BC_STATUS_LEX_INVALID_TOKEN;
break;
}
@@ -1833,7 +1833,7 @@
case BC_LEX_EOF:
{
- status = BC_STATUS_PARSE_EOF;
+ status = BC_STATUS_LEX_EOF;
break;
}
diff --git a/src/bc/program.c b/src/bc/program.c
index 88dd80c..6d70243 100644
--- a/src/bc/program.c
+++ b/src/bc/program.c
@@ -434,10 +434,7 @@
status = bc_parse_expr(&parse, &func->code, BC_PARSE_EXPR_NO_READ);
- if (status != BC_STATUS_LEX_EOF &&
- status != BC_STATUS_PARSE_EOF &&
- parse.token.type != BC_LEX_NEWLINE)
- {
+ if (status != BC_STATUS_LEX_EOF && parse.token.type != BC_LEX_NEWLINE) {
status = status ? status : BC_STATUS_EXEC_INVALID_READ_EXPR;
goto exec_err;
}
diff --git a/src/bc/vm.c b/src/bc/vm.c
index b2b7e7e..ffad061 100644
--- a/src/bc/vm.c
+++ b/src/bc/vm.c
@@ -102,8 +102,7 @@
status = bc_parse_parse(&vm->parse);
- if (status && status != BC_STATUS_LEX_EOF && status != BC_STATUS_PARSE_EOF)
- {
+ if (status && status != BC_STATUS_LEX_EOF) {
bc_error_file(status, vm->parse.lex.file, vm->parse.lex.line);
goto err;
}
@@ -119,7 +118,6 @@
if (status) {
if (status != BC_STATUS_LEX_EOF &&
- status != BC_STATUS_PARSE_EOF &&
status != BC_STATUS_PARSE_QUIT &&
status != BC_STATUS_PARSE_LIMITS)
{
@@ -144,12 +142,8 @@
} while (!status);
- if (status != BC_STATUS_PARSE_EOF &&
- status != BC_STATUS_LEX_EOF &&
- status != BC_STATUS_PARSE_QUIT)
- {
+ if (status != BC_STATUS_LEX_EOF && status != BC_STATUS_PARSE_QUIT)
goto read_err;
- }
if (BC_PARSE_CAN_EXEC(&vm->parse)) {
@@ -303,10 +297,7 @@
if (status) {
- if (status == BC_STATUS_PARSE_QUIT ||
- status == BC_STATUS_LEX_EOF ||
- status == BC_STATUS_PARSE_EOF)
- {
+ if (status == BC_STATUS_PARSE_QUIT || status == BC_STATUS_LEX_EOF) {
break;
}
else if (status == BC_STATUS_PARSE_LIMITS) {
@@ -334,7 +325,7 @@
bc_program_limits(&vm->program);
status = BC_STATUS_SUCCESS;
}
- else if (status != BC_STATUS_LEX_EOF && status != BC_STATUS_PARSE_EOF) {
+ else if (status != BC_STATUS_LEX_EOF) {
BcFunc *func;
BcInstPtr *ip;
@@ -398,8 +389,7 @@
status = !status || status == BC_STATUS_PARSE_QUIT ||
status == BC_STATUS_EXEC_HALT ||
- status == BC_STATUS_LEX_EOF ||
- status == BC_STATUS_PARSE_EOF ?
+ status == BC_STATUS_LEX_EOF ?
BC_STATUS_SUCCESS : status;
exit_err: