Wrong error position for "period ('.') expected"

Hi,

When using non-visual class TPSPascalCompiler, for the following code

begin
{any code here}
end;

the error is fired “period (’.’) expected” - this is right - but the error always has wrong position (1:1).
This does not occur for visual component.

Hi,

I couldn’t reproduce this situation with 3 latest RO versions. What version do you use?

Best regards

PascalScript 3.0.51.881, Delphi 7.
The situation is reproduced in the “Import” example project (and in my application). Error message is:

Failed when compiling
[Error] (1:1): period (’.’) expected

Note that you should put semicolon instead of comma after “end” operator, or put nothing after “end”. What is wrong - error position (1:1).

Hi,

I was able to reproduce the situation. It arises (on the Import sample) if you use TPSPreProcessor and do
xpre.PreProcess(xpre.MainFileName, s);
and
xpre.AdjustMessages(x1);

Try to do without it - and you will get right error position.

If you really need to use it then add Enter after the last end; in script. Or modify:
procedure TMainForm.New1Click(Sender: TObject);
begin
if not SaveTest then
exit;
Memo1.Lines.Text := ‘Program Test;’#13#10’Begin’#13#10’End.’#13#10;
Memo2.Lines.Clear;
fn := ‘’;
end;

Note, if you Compile scripts from .rops files from this sample you will get right error position too, because all .rops files have Enter (#13#10) after the last end.

Best regards

Thank you. I will add #13#10 (if absent) at the end of script as a workaround.

Hi,

The #13#10 fix only helps when semicolon or other character is present after “end”.
In the case of bare “end” the error position is still wrong.

Regards,
Dmitry.

Hi,

If you save your script - error position will be right. But compiling script that was not saved give you wrong error position. And again, this situation arises only if you use TPSPreProcessor and do AdjustMessages.

The issue was logged as #49926, thanks for the report. 

Best regards