Problem with constants declared with line wrap?

This forum designated to discuss the TsiLang Components Suite.
Post Reply
Malcolm
Posts: 109
Joined: Tue Jan 21, 2003 5:18 pm
Location: Scotland

Problem with constants declared with line wrap?

Post by Malcolm »

Hello Igor

Delphi D10.

I had a list of about 75 string constants in a unit and tried to translate them. Mostly it worked fine and converted them to string variables.

However, a few of the original declarations had been wrapped by my source code formatter as follows:

mylongerstringconstant =
'a string of about 70 .... 80 characters';

These items either vanished from my source or the code generated was incomplete or invalid. Can you reproduce this?

No big deal - I just fixed my source .. but ..

Malcolm

isiticov
Site Admin
Posts: 2268
Joined: Thu Nov 21, 2002 3:17 pm

Post by isiticov »

Hi Malcolm,
Current workaround is to fixe the source code. We will try to improve TsiLang Expert parsing in next version to handle this kind of declarations.
Best regards,
Igor Sitikov.

Malcolm
Posts: 109
Joined: Tue Jan 21, 2003 5:18 pm
Location: Scotland

Post by Malcolm »

Hi Igor

OK, I expect you can do it. :)

Malcolm

Jean-Paul Brassard
Posts: 65
Joined: Thu May 08, 2008 7:46 pm

Re: Problem with constants declared with line wrap?

Post by Jean-Paul Brassard »

Malcolm wrote:... a few of the original declarations had been wrapped by my source code formatter as follows:

Code: Select all

  mylongerstringconstant = 
    'a string of about 70 .... 80 characters';
These items either vanished from my source or the code generated was incomplete or invalid...
I got two other forms of the same problem (in Delphi 7 with version 6.2.2).
If a constant is split on two lines, the generated source code can be wrong.

Expected:

Code: Select all

  SimpleConst = 'All on one line';
=>

Code: Select all

  SimpleConst: string = ''; (* All on one line *)
Putting the string in a comment helps one to know that it can't update it here.

First problem:

Code: Select all

  ConstOnTwoLines = 'First line'+
                    'Second lines';
=>

Code: Select all

  ConstOnTwoLine: string = 'First line'+
                   'Second line';
In this case, the string is not replaced by a comment.
The generated code works and both lines are inserted in the TsiLang Container.
However, this is a minor problem since one can update the source string instead of the TsiLang Container.

Second Problem:

Code: Select all

  ConstWithPlusOnSecondLine = 'First line'
                             +'Second line';
=>

Code: Select all

  ConstWithPlusOnSecondLine: string = ''; (* First line *)
                             +'Second line';
Which does not compile (the second line has been forgotten).
Moreover, that second line is not inserted in the TsiLang Container.

It seems that all those problems come from an incomplete Syntax parsing.
Jean-Paul
Jean-Paul Brassard
Quebec, Canada

isiticov
Site Admin
Posts: 2268
Joined: Thu Nov 21, 2002 3:17 pm

Post by isiticov »

We will try to improve this in next version.
Best regards,
Igor Sitikov.

Post Reply