Page 1 of 1
Problem with constants declared with line wrap?
Posted: Sun Feb 03, 2008 3:52 pm
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
Posted: Mon Feb 04, 2008 7:36 am
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.
Posted: Mon Feb 04, 2008 8:49 am
by Malcolm
Hi Igor
OK, I expect you can do it.
Malcolm
Re: Problem with constants declared with line wrap?
Posted: Tue May 13, 2008 8:10 pm
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: 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
Posted: Wed May 14, 2008 5:55 am
by isiticov
We will try to improve this in next version.