Skip to content

Too permissive syntax in writeln()

Summary

The compiler do not complain when encountering an wrong statement in writeln()

System Information

  • Operating system: both linux 64 bits (Mageia) and Windows10 32 bits
  • Processor architecture: Intel x86
  • Compiler version: 3.2.2
  • Device: Laptop

Steps to reproduce

Try to compile the following program

PROGRAM doublepoint;
   {$APPTYPE CONSOLE}
VAR
   F: TEXT;
BEGIN
   ASSIGN(F, 'doublepoint.txt');
   REWRITE(F);
   WRITELN(F, 'Hello');   { ',' is legal - compiler just do its job }
   WRITELN(F: 'Hello');   { ':' is not legal - compiler should emit an error, but 3.2.2 fail to }
   CLOSE(F);
END.

The compilation should fail due to the second Hello line where ':' is not allowed by definition. 3.2.2 compile without complaining ; he should stop compiling.

Example Project

See above.

What is the current bug behavior?

Compile without complaining.

What is the expected (correct) behavior?

The compiler should complain and stop the job.

Relevant logs and/or screenshots

Possible fixes

After @PascalDragon: most probably linked to the parsing of the code for numerical output as 3.1415:5:2, but not legal for an assigned textfile.

Edited by Sven/Sarah Barth
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information