IBM / zopeneditor-about

IBM Z Open Editor: File issues here!
https://ibm.github.io/zopeneditor-about
Apache License 2.0
47 stars 25 forks source link

PL/I syntax error missed on nested blocks #397

Open luisitoortiz opened 3 months ago

luisitoortiz commented 3 months ago

Development environment used

Problem Description

The PL/I block below won't throw a syntax error on the missing END; for the SELECT block below. If I remove any other random END; line it works, but in the example below it doesn't which leads then to a compiler error with the NOMULTICLOSE rule enforced. I'll venture to guess the syntax checker in iDZ is one in the same because it behaves identically with the code below. Just to note, the editor does know what END; belongs to what SELECT, DO, etc. (Click on END;); but then it simply chooses to ignore the fact that one missing below is a problem. Note that you can make the code even more generic to avoid the other 2 syntax error, but it doesn't change the outcome.

PROCESS_INPUT_FILE: PROCEDURE;
  DO WHILE(FILE_EOF = '0');
     SELECT(MATCH_KEYS());
        WHEN (-1) DO;
        END;

        WHEN (+1) DO;
        END;

        WHEN (0) DO;
        END;

        OTHERWISE DO;
        END;
  END;
END;

Observed behavior

Syntax error ignored for the missing END; for the SELECT block.

Expected behavior

Syntax error flagged for missing END; for the SELECT block.

Russell-May commented 3 months ago

The example provided produces an error on line 1 'The block does not have an END statement'. If you modify the final END statement to be labeled with PROCESS_INPUT_FILE it will multiclose the missing end statement and the syntax error will no longer be shown. The compiler option NOMULTICLOSE is not currently supported in the parser. This is why you are not getting a syntax error where you are expecting. This should be labeled as an enhancement request.

luisitoortiz commented 3 months ago

I actually cleaned up the code a bit too much from details because the PROCESS_INPUT_FILE line is in the original, but yes, it would be nice if the syntax checker enforced the NOMULTICLOSE option since it's a default flag in newer versions of PL/I.