From 80e57e7490f899e64a1f931afb93fa900bc9e221 Mon Sep 17 00:00:00 2001 From: albert-github Date: Mon, 15 Apr 2019 19:39:31 +0200 Subject: Windows crash in case of incorrect end statement Some Fortran compilers accept the END statement instead of the mandatory END TYPE. The code crashes on Windows as no correct END statement is found. --- src/fortranscanner.l | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/fortranscanner.l b/src/fortranscanner.l index 7d7437d..848b17e 100644 --- a/src/fortranscanner.l +++ b/src/fortranscanner.l @@ -698,6 +698,14 @@ private { typeMode = false; yy_pop_state(); } +^{BS}"end"{BS}/(\n|!|;) { /* incorrect end type definition */ + warn(yyFileName,yyLineNr, "Found 'END' instead of 'END TYPE'"); + last_entry->parent()->endBodyLine = yyLineNr; + if (!endScope(current_root)) + yyterminate(); + typeMode = false; + yy_pop_state(); + } } /*------- module/global/typedef variable ---------------------------------------------------*/ @@ -2819,7 +2827,7 @@ static void scanner_abort() // dummy call to avoid compiler warning (void)yy_top_state(); - + return; //exit(-1); } -- cgit v0.12