+added a program too long error.

This commit is contained in:
Wang Renxin 2016-07-20 10:12:01 +08:00 committed by GitHub
parent 44b54bd524
commit 763177adda

View File

@ -210,6 +210,7 @@ static const char* _ERR_DESC[] = {
"Invalid character", "Invalid character",
/** Running */ /** Running */
"Empty program", "Empty program",
"Program too long",
"Syntax error", "Syntax error",
"Invalid data type", "Invalid data type",
"Type does not match", "Type does not match",
@ -12271,9 +12272,16 @@ int mb_load_string(struct mb_interpreter_t* s, const char* l, bool_t reset) {
if(n == 1) { if(n == 1) {
char ch = *l; char ch = *l;
if((ch == _NEWLINE_CHAR || ch == _RETURN_CHAR) && (!wrapped || wrapped == ch)) { if((ch == _NEWLINE_CHAR || ch == _RETURN_CHAR) && (!wrapped || wrapped == ch)) {
unsigned short before = 0;
wrapped = ch; wrapped = ch;
++context->parsing_row; before = context->parsing_row++;
context->parsing_col = 0; context->parsing_col = 0;
if(before > context->parsing_row) {
context->parsing_col = 1;
_handle_error_now(s, SE_RN_PROGRAM_TOO_LONG, s->last_error_file, MB_FUNC_ERR);
goto _exit;
}
break; break;
} }