diff -Naur pspp-0.7.5-g8a0397.orig/src/language/control/repeat.c pspp-0.7.5-g8a0397/src/language/control/repeat.c --- pspp-0.7.5-g8a0397.orig/src/language/control/repeat.c 2010-09-26 00:25:16.000000000 -0500 +++ pspp-0.7.5-g8a0397/src/language/control/repeat.c 2010-09-27 14:31:47.658673980 -0500 @@ -286,6 +286,33 @@ return true; } +/* Returns true if LINE contains the keyword 'end' followed by anything other than 'if' or 'loop', Returns false + otherwise. */ +static bool +recognize_invalid_end(struct substring line) +{ + bool result; + + result = false; + if(recognize_keyword (&line, "end")) + { + struct substring line_copy = line; + + result = true; + if(recognize_keyword (&line, "if")) + { + return false; + } + + if(recognize_keyword (&line_copy, "loop")) + { + return false; + } + } + + return result; +} + /* Read all the lines we are going to substitute, inside the DO REPEAT...END REPEAT block. */ static bool @@ -343,6 +370,11 @@ ds_destroy (&text); return true; } + else if (recognize_invalid_end (ds_ss (&text))) + { + msg (SE, _("Invalid line '%s'."), text.ss.string); + return false; + } ds_destroy (&text); /* Add the line to the list. */ diff -Naur pspp-0.7.5-g8a0397.orig/src/ui/terminal/main.c pspp-0.7.5-g8a0397/src/ui/terminal/main.c --- pspp-0.7.5-g8a0397.orig/src/ui/terminal/main.c 2010-09-26 00:25:16.000000000 -0500 +++ pspp-0.7.5-g8a0397/src/ui/terminal/main.c 2010-09-27 13:41:24.762669180 -0500 @@ -127,6 +127,7 @@ msg (SE, _("Stopping syntax file processing here to avoid " "a cascade of dependent command failures.")); getl_abort_noninteractive (the_source_stream); + break; } else if (msg_ui_too_many_errors ()) getl_abort_noninteractive (the_source_stream);