2005-08-26 22:29:39 +04:00
unit UnitCodeUtils;
interface
uses SysUtils, Classes, Forms, Controls, Windows, ScintillaLanguageManager,
RichEdit, ComCtrls, JvInspector;
2005-10-08 01:52:48 +04:00
function PosBack( eSubStr, eStr: String ) : Integer ;
2005-08-26 22:29:39 +04:00
function IsAtStart( eSubStr, eStr: String ; AllowFunctions: Boolean = True ) : Boolean ;
function GetIndents( Line: Integer = - 1 ) : String ;
function GetStyleAt( ePos: Integer ) : TSciStyle;
function LineFromPos( ePos: Integer ) : Integer ;
function RemoveSemicolon( eStr: String ) : String ;
procedure IndentCode;
procedure UnindentCode;
2005-10-08 01:52:48 +04:00
function Between( eText, eFirst, eSecond: String ; eSecondBack: Boolean = False ) : String ;
2005-08-26 22:29:39 +04:00
procedure Delay( eTime: Integer ) ;
function CountChars( eIn: String ; eChar: Char ) : Integer ;
2005-10-08 01:52:48 +04:00
function RemoveStringsAndComments( eLine: String ; eRemoveStrings: Boolean ; eRemoveComments: Boolean ) : String ;
2005-08-26 22:29:39 +04:00
function GetMatchingBrace( eString: String ) : Integer ;
function GetColoredLine( eLine: Integer ) : String ;
2005-11-19 22:46:29 +03:00
function GetFunctionPos: Integer ;
function GetCurrFunc: String ;
2005-08-26 22:29:39 +04:00
function GetRTFText( ARichEdit: TRichedit) : string ;
procedure SetRTFText( ARichEdit: TRichedit; ARTFText: String ) ;
implementation
2005-09-04 00:00:46 +04:00
uses UnitfrmMain, UnitMainTools, UnitLanguages, UnitfrmIRCPaster;
2005-08-26 22:29:39 +04:00
2005-10-08 01:52:48 +04:00
function PosBack( eSubStr, eStr: String ) : Integer ;
begin
Result : = 0 ;
if Pos( eSubStr, eStr) < > 0 then begin
while Pos( eSubStr, Copy( eStr, Result + 1 , Length( eStr) ) ) < > 0 do
Inc( Result , 1 ) ;
end ;
end ;
2005-08-26 22:29:39 +04:00
function IsAtStart( eSubStr, eStr: String ; AllowFunctions: Boolean = True ) : Boolean ;
begin
eStr : = LowerCase( Trim( StringReplace( eStr, #9 , #32 , [ rfReplaceAll] ) ) ) ;
eSubStr : = LowerCase( eSubStr) ;
if Pos( eSubStr + #32 , eStr) = 1 then
Result : = True
else if ( Pos( eSubStr + '(' , eStr) = 1 ) and ( AllowFunctions) then
Result : = True
else
Result : = False ;
end ;
function GetIndents( Line: Integer = - 1 ) : String ;
var i: integer ;
begin
Result : = '' ;
if Line = - 1 then
Line : = frmMain. sciEditor. GetCurrentLineNumber;
if Length( frmMain. sciEditor. Lines[ Line] ) < > 0 then begin
for i : = 1 to Length( frmMain. sciEditor. Lines[ Line] ) do begin
if ( frmMain. sciEditor. Lines[ Line] [ i] < > #32 ) and ( frmMain. sciEditor. Lines[ Line] [ i] < > #9 ) then
break
else
Result : = Result + frmMain. sciEditor. Lines[ Line] [ i] ;
end ;
end ;
end ;
function GetStyleAt( ePos: Integer ) : TSciStyle;
var eBits: Integer ;
eStyleNo: Byte ;
i: integer ;
begin
Result : = nil ;
eStyleNo : = Byte( frmMain. sciEditor. GetStyleAt( ePos) ) ;
eBits : = frmMain. sciEditor. GetStyleBits;
if eBits = 5 then
eStyleNo : = eStyleNo and $1f //Strip away the indicators (3 bits)
else if eBits = 7 then
eStyleNo : = eStyleNo and $7f //Strip away the indicators (1 bit)
else if eBits = 6 then
2005-10-08 01:52:48 +04:00
eStyleNo : = eStyleNo and $3f ; //Strip away the indicators (2 bits)
2005-08-26 22:29:39 +04:00
2005-10-08 01:52:48 +04:00
with frmMain. sciEditor. LanguageManager. LanguageList. Find( ActiveDoc. Highlighter) . Styles do begin
for i : = 0 to Count - 1 do begin
if TSciStyle( Items[ i] ) . StyleNumber = eStyleNo then
Result : = TSciStyle( Items[ i] ) ;
2005-08-26 22:29:39 +04:00
end ;
end ;
end ;
function LineFromPos( ePos: Integer ) : Integer ;
var i: integer ;
eLength: Integer ;
begin
Result : = - 1 ;
eLength : = 0 ;
for i : = 0 to frmMain. sciEditor. Lines. Count - 1 do begin
2005-09-04 00:00:46 +04:00
eLength : = eLength + Length( frmMain. sciEditor. Lines[ i] ) + 2 ;
2005-08-26 22:29:39 +04:00
if eLength > = ePos then begin
Result : = i;
break;
end ;
end ;
end ;
function RemoveSemicolon( eStr: String ) : String ;
begin
if Length( eStr) < > 0 then begin
if eStr[ Length( eStr) ] = ';' then
Result : = Copy( eStr, 1 , Length( eStr) - 1 )
else
Result : = eStr;
end
else
Result : = eStr;
end ;
procedure IndentCode;
var eStr: TStringList;
i, k: integer ;
2005-10-08 01:52:48 +04:00
eIndent, eTempIndent: Integer ;
2005-08-26 22:29:39 +04:00
eString: String ;
begin
Screen. Cursor : = crHourGlass;
frmMain. sciEditor. Enabled : = False ;
eStr : = TStringList. Create;
2005-10-08 01:52:48 +04:00
eIndent : = 0 ;
eTempIndent : = 0 ;
2005-08-26 22:29:39 +04:00
2005-09-12 20:08:45 +04:00
Cancel : = False ;
2005-09-09 20:49:41 +04:00
ShowProgress( False ) ;
2005-08-26 22:29:39 +04:00
frmMain. pbLoading. Max : = frmMain. sciEditor. Lines. Count * 2 - 2 ;
for i : = 0 to frmMain. sciEditor. Lines. Count - 1 do begin
if Cancel then begin
Cancel : = False ;
exit;
end ;
eStr. Add( TrimLeft( frmMain. sciEditor. Lines[ i] ) ) ;
// Remove strings and comments virtually because they could include brackets
frmMain. pbLoading. Position : = i;
SetProgressStatus( 'Indenting Code...' ) ;
2005-10-08 01:52:48 +04:00
eStr[ i] : = RemoveStringsAndComments( eStr[ i] , True , True ) ;
2005-11-12 18:11:14 +03:00
eStr[ i] : = LowerCase( Trim( eStr[ i] ) ) ;
2005-08-26 22:29:39 +04:00
end ;
for i : = 0 to eStr. Count - 1 do begin
if CountChars( eStr[ i] , '{' ) < > CountChars( eStr[ i] , '}' ) then
2005-10-08 01:52:48 +04:00
eIndent : = eIndent - CountChars( eStr[ i] , '}' ) ;
2005-08-26 22:29:39 +04:00
frmMain. sciEditor. Lines[ i] : = TrimLeft( frmMain. sciEditor. Lines[ i] ) ;
2005-10-08 01:52:48 +04:00
for k : = 1 to eIndent + eTempIndent do
2005-08-26 22:29:39 +04:00
frmMain. sciEditor. Lines[ i] : = ' ' + frmMain. sciEditor. Lines[ i] ;
2006-07-01 01:23:26 +04:00
if eTempIndent > 0 then
2005-10-08 01:52:48 +04:00
eTempIndent : = eTempIndent - 1 ;
2005-08-26 22:29:39 +04:00
if ( IsAtStart( 'if' , eStr[ i] , True ) ) and ( Pos( '{' , eStr[ i] ) = 0 ) and ( Length( eStr[ i] ) > 3 ) then begin
eString : = eStr[ i] ;
Delete( eString, 1 , 2 ) ;
if ( eString[ 1 ] < > Trim( eString) [ 1 ] ) or ( eString[ 1 ] = '(' ) then begin
eString : = Trim( eString) ;
if GetMatchingBrace( eString) = Length( eString) then
2005-10-08 01:52:48 +04:00
eTempIndent : = eTempIndent + 1 ;
2005-08-26 22:29:39 +04:00
end ;
end
else if ( IsAtStart( 'for' , eStr[ i] , True ) ) and ( Pos( '{' , eStr[ i] ) = 0 ) and ( Length( eStr[ i] ) > 4 ) then begin
eString : = eStr[ i] ;
Delete( eString, 1 , 3 ) ;
if ( eString[ 1 ] < > Trim( eString) [ 1 ] ) or ( eString[ 1 ] = '(' ) then begin
eString : = Trim( eString) ;
if GetMatchingBrace( eString) = Length( eString) then
2005-10-08 01:52:48 +04:00
eTempIndent : = eTempIndent + 1 ;
2005-08-26 22:29:39 +04:00
end ;
end
2006-09-30 22:49:28 +04:00
else if ( eStr[ i] = 'else' ) or ( ( Pos( 'else if' , eStr[ i] ) = 1 ) or ( Pos( 'case' , eStr[ i] ) = 1 ) or ( Pos( 'switch' , eStr[ i] ) = 1 ) ) and ( Pos( '{' , eStr[ i] ) = 0 ) then
2005-11-12 18:11:14 +03:00
eTempIndent : = eTempIndent + 1
2005-08-26 22:29:39 +04:00
else if ( Pos( '{' , eStr[ i] ) = 0 ) and ( Length( eStr[ i] ) > 6 ) then begin
if ( IsAtStart( 'stock' , eStr[ i] , False ) ) or ( IsAtStart( 'while' , eStr[ i] , True ) ) then begin
eString : = eStr[ i] ;
Delete( eString, 1 , 5 ) ;
if ( eString[ 1 ] < > Trim( eString) [ 1 ] ) or ( eString[ 1 ] = '(' ) then begin
eString : = Trim( eString) ;
if GetMatchingBrace( eString) = Length( eString) then
2005-10-08 01:52:48 +04:00
eTempIndent : = eTempIndent + 1 ;
2005-08-26 22:29:39 +04:00
end ;
end ;
end ;
if ( Pos( '{' , eStr[ i] ) = 0 ) and ( Length( eStr[ i] ) > 7 ) then begin
if ( Pos( 'public' , eStr[ i] ) = 1 ) or ( Pos( 'native' , eStr[ i] ) = 1 ) then begin
eString : = eStr[ i] ;
Delete( eString, 1 , 6 ) ;
if eString[ 1 ] < > Trim( eString) [ 1 ] then begin
eString : = Trim( eString) ;
if GetMatchingBrace( eString) = Length( eString) then
2005-10-08 01:52:48 +04:00
eTempIndent : = eTempIndent + 1 ;
2005-08-26 22:29:39 +04:00
end ;
end ;
end
else if ( IsAtStart( 'forward' , eStr[ i] , False ) ) and ( Pos( '{' , eStr[ i] ) = 0 ) and ( Length( eStr[ i] ) > 8 ) then begin
eString : = eStr[ i] ;
Delete( eString, 1 , 7 ) ;
if eString[ 1 ] < > Trim( eString) [ 1 ] then begin
eString : = Trim( eString) ;
if GetMatchingBrace( eString) = Length( eString) then
2005-10-08 01:52:48 +04:00
eTempIndent : = eTempIndent + 1 ;
2005-08-26 22:29:39 +04:00
end ;
end ;
if CountChars( eStr[ i] , '{' ) < > CountChars( eStr[ i] , '}' ) then
2005-10-08 01:52:48 +04:00
eIndent : = eIndent + CountChars( eStr[ i] , '{' ) ;
2006-05-11 20:03:18 +04:00
if ( i+ 1 < eStr. Count) and ( Trim( RemoveStringsAndComments( eStr[ i + 1 ] , true , true ) ) = '{' ) then
eTempIndent : = eTempIndent - 1 ;
2005-08-26 22:29:39 +04:00
frmMain. pbLoading. Position : = frmMain. sciEditor. Lines. Count + i - 1 ;
SetProgressStatus( 'Indenting Code...' ) ;
2005-09-09 20:49:41 +04:00
frmMain. pnlLoading. Repaint;
2005-08-26 22:29:39 +04:00
end ;
ActiveDoc. Modified : = True ;
frmMain. mnuModified. Caption : = lModified;
HideProgress;
frmMain. sciEditor. Enabled : = True ;
Screen. Cursor : = crDefault;
end ;
procedure UnindentCode;
var i: integer ;
begin
Screen. Cursor : = crHourGlass;
frmMain. sciEditor. Enabled : = False ;
2005-09-12 20:08:45 +04:00
Cancel : = False ;
2005-09-09 20:49:41 +04:00
ShowProgress( False ) ;
2005-08-26 22:29:39 +04:00
frmMain. pbLoading. Max : = frmMain. sciEditor. Lines. Count - 1 ;
2005-09-09 20:49:41 +04:00
2005-08-26 22:29:39 +04:00
for i : = 0 to frmMain. sciEditor. Lines. Count - 1 do begin
if Cancel then begin
Cancel : = False ;
exit;
end ;
frmMain. sciEditor. Lines[ i] : = TrimLeft( frmMain. sciEditor. Lines[ i] ) ;
frmMain. pbLoading. Position : = i;
SetProgressStatus( 'Unintending Code...' ) ;
2005-09-09 20:49:41 +04:00
frmMain. pnlLoading. Repaint;
2005-08-26 22:29:39 +04:00
end ;
HideProgress;
2005-09-09 20:49:41 +04:00
2005-08-26 22:29:39 +04:00
frmMain. sciEditor. Enabled : = True ;
Screen. Cursor : = crDefault;
end ;
2005-10-08 01:52:48 +04:00
function RemoveStringsAndComments( eLine: String ; eRemoveStrings: Boolean ; eRemoveComments: Boolean ) : String ;
2005-08-26 22:29:39 +04:00
begin
// Remove comments
2005-10-08 01:52:48 +04:00
if eRemoveComments then begin
if ( Pos( GetCurrLang. CommentBoxStart, eLine) = 1 ) or ( Pos( GetCurrLang. CommentBoxMiddle, eLine) = 1 ) or ( Pos( GetCurrLang. CommentBoxEnd, eLine) = 1 ) or ( Pos( GetCurrLang. CommentBlock, eLine) = 1 ) then
eLine : = '' ;
if Pos( GetCurrLang. CommentBlock, eLine) < > 0 then
eLine : = Copy( eLine, 1 , Pos( '//' , eLine) - 2 ) ;
if ( Pos( GetCurrLang. CommentStreamStart, eLine) < Pos( GetCurrLang. CommentStreamEnd, eLine) ) and ( Pos( GetCurrLang. CommentStreamStart, eLine) < > 0 ) then
eLine : = StringReplace( eLine, GetCurrLang. CommentStreamStart + Between( eLine, GetCurrLang. CommentStreamStart, GetCurrLang. CommentStreamEnd) + GetCurrLang. CommentStreamEnd, '' , [ rfReplaceAll] ) ; // maybe not the best method, but simple and quite easy
end ;
2005-08-26 22:29:39 +04:00
// Remove quotes
if eRemoveStrings then begin
2005-10-08 01:52:48 +04:00
while Between( eLine, '"' , '"' ) < > '' do
2005-08-26 22:29:39 +04:00
eLine : = StringReplace( eLine, '"' + Between( eLine, '"' , '"' ) + '"' , '' , [ rfReplaceAll] ) ;
end ;
Result : = eLine;
end ;
procedure Delay( eTime: Integer ) ;
var i: integer ;
begin
for i : = 1 to eTime do begin
Sleep( 1 ) ;
Application. ProcessMessages;
if Application. Terminated then
exit;
end ;
end ;
function CountChars( eIn: String ; eChar: Char ) : Integer ;
var i: integer ;
begin
Result : = 0 ;
if Length( eIn) < > 0 then begin
for i : = 1 to Length( eIn) do begin
if eIn[ i] = eChar then
Inc( Result , 1 ) ;
end ;
end ;
end ;
2005-10-08 01:52:48 +04:00
function Between( eText, eFirst, eSecond: String ; eSecondBack: Boolean = False ) : String ;
2005-08-26 22:29:39 +04:00
var eTemp: String ;
begin
2005-10-08 01:52:48 +04:00
Result : = '' ;
if Pos( eFirst, eText) = PosBack( eSecond, eText) then exit;
if Pos( eFirst, eText) = 0 then exit;
if PosBack( eSecond, eText) < Pos( eFirst, eText) then exit;
eTemp : = eText;
Delete( eTemp, 1 , Pos( eFirst, eText) + Length( eFirst) - 1 ) ;
if eSecondBack then
Delete( eTemp, PosBack( eSecond, eTemp) , Length( eTemp) )
else
2005-08-26 22:29:39 +04:00
Delete( eTemp, Pos( eSecond, eTemp) , Length( eTemp) ) ;
2005-10-08 01:52:48 +04:00
Result : = eTemp;
2005-08-26 22:29:39 +04:00
end ;
function GetMatchingBrace( eString: String ) : Integer ;
var a, b, c : integer ;
begin
Result : = 0 ;
if Length( eString) < 1 then exit;
b : = 0 ;
c : = 0 ;
for a : = 1 to Length( eString) do begin
if eString[ a] = '(' then begin
b : = b + 1 ;
c : = 1 ;
end
else if eString[ a] = ')' then begin
b : = b - 1 ;
c : = 1 ;
end ;
if ( b = 0 ) and ( c = 1 ) then begin
Result : = a;
exit;
end ;
end ;
end ;
function GetColoredLine( eLine: Integer ) : String ;
var eCurrStyle: String ;
eChars: Integer ;
i: integer ;
begin
eChars : = 0 ;
if eLine < > 0 then begin
for i : = 0 to eLine - 1 do
eChars : = eChars + Length( frmMain. sciEditor. Lines[ i] ) + 2 ; // +2 for #13#10
end ;
eCurrStyle : = '' ;
2005-09-04 00:00:46 +04:00
if frmIRCPaster. chkLineNumbers. Checked then
Result : = IntToStr( eLine + 1 ) + '] '
else
Result : = '' ;
2005-08-26 22:29:39 +04:00
2005-09-04 00:00:46 +04:00
if Trim( frmMain. sciEditor. Lines[ eLine] ) = '' then
exit;
2005-08-26 22:29:39 +04:00
for i : = 0 to Length( frmMain. sciEditor. Lines[ eLine] ) - 1 do begin
if eCurrStyle < > GetStyleAt( eChars + i) . Name then begin
eCurrStyle : = GetStyleAt( eChars + i) . Name ;
if ( eCurrStyle = 'White Space' ) and ( Length( Result ) < > Length( IntToStr( eLine + 1 ) + '] ' ) ) then
Result : = Result + ' ' ;
if eCurrStyle = 'Ok Braces' then
Result : = Result + ' 02' ;
if eCurrStyle = 'Bad Braces' then
Result : = Result + ' 04' ;
if eCurrStyle = 'White Space' then
Result : = Result + ' 12' ;
if eCurrStyle = 'Comment' then
Result : = Result + ' 07' ;
if eCurrStyle = 'Line Comment' then
Result : = Result + ' 07' ;
if eCurrStyle = 'Doc Comment' then
Result : = Result + ' 07' ;
if eCurrStyle = 'Number' then
Result : = Result + ' 12' ;
if eCurrStyle = 'Keyword' then
Result : = Result + ' 03' ;
if eCurrStyle = 'Double quoted string' then
Result : = Result + ' 04' ;
if eCurrStyle = 'Single quoted string' then
Result : = Result + ' 04' ;
if eCurrStyle = 'Symbols/UUID' then
Result : = Result + ' 04' ;
if eCurrStyle = 'Preprocessor' then
Result : = Result + ' 07' ;
if eCurrStyle = 'Operators' then
Result : = Result + ' 12' ;
if eCurrStyle = 'Identifier' then
Result : = Result + ' 12' ;
if eCurrStyle = 'Regular expressions' then
Result : = Result + ' 10' ;
if eCurrStyle = 'Doc Comment Line' then
Result : = Result + ' 07' ;
if eCurrStyle = 'User-defined keywords' then
Result : = Result + ' 04' ;
end ;
Result : = Result + frmMain. sciEditor. Lines[ eLine] [ i + 1 ] ;
end ;
Result : = StringReplace( Result , ' ' , ' ' , [ rfReplaceAll] ) ;
end ;
{ ------------------ NOTES ------------------ }
function GetRTFText( ARichEdit: TRichedit) : string ;
var
ss: TStringStream;
emptystr: string ;
eStr: TStringList;
i: integer ;
begin
Result : = '' ;
emptystr : = '' ;
ss : = TStringStream. Create( emptystr) ;
eStr : = TStringList. Create;
try
ARichEdit. PlainText : = False ;
ARichEdit. Lines. SaveToStream( ss) ;
eStr. Text : = StringReplace( ss. DataString, '\' , '\\ ' , [ rfReplaceAll] ) ;
for i : = 0 to eStr. Count - 1 do
Result : = Result + '\n' + eStr[ i] ;
Delete( Result , 1 , 2 ) ;
finally
ss. Free;
eStr. Free;
end ;
end ;
procedure SetRTFText( ARichEdit: TRichedit; ARTFText: String ) ;
var
ss: TStringStream;
begin
ARTFText : = StringReplace( ARTFText, '\n' , #13 #10 , [ rfReplaceAll] ) ;
ARTFText : = StringReplace( ARTFText, '\\ ' , '\' , [ rfReplaceAll] ) ;
ss : = TStringStream. Create( ARTFText) ;
try
ARichEdit. PlainText : = False ;
ARichEdit. Lines. LoadFromStream( ss) ;
finally
ss. Free;
end ;
end ;
2005-11-19 22:46:29 +03:00
function GetFunctionPos: Integer ;
var eStr: String ;
i: integer ;
begin
Result : = 0 ;
2005-12-01 19:30:26 +03:00
eStr : = Copy( eStr, 1 , frmMain. sciEditor. GetCaretInLine) ;
2006-01-11 21:02:42 +03:00
eStr : = StringReplace( frmMain. sciEditor. Lines[ frmMain. sciEditor. GetCurrentLineNumber] , '^"' , '' , [ rfReplaceAll] ) ;
if ( Length( eStr) = 0 ) then exit;
2005-11-19 22:46:29 +03:00
while Between( eStr, '"' , '"' ) < > '' do
eStr : = StringReplace( eStr, Between( eStr, '"' , '"' ) , '' , [ rfReplaceAll] ) ;
while Between( eStr, '{' , '}' ) < > '' do
2005-12-01 19:30:26 +03:00
eStr : = StringReplace( eStr, Between( eStr, '{' , '}' ) , '' , [ rfReplaceAll] ) ;
2006-01-11 21:02:42 +03:00
for i : = Length( eStr) - 1 downto 1 do begin
2005-11-19 22:46:29 +03:00
if eStr[ i] = ',' then
2006-01-11 21:02:42 +03:00
Result : = Result + 1
else if eStr[ i] = '(' then
exit;
2005-11-19 22:46:29 +03:00
end ;
end ;
function GetCurrFunc: String ;
var eStr: String ;
2006-01-11 21:02:42 +03:00
i: integer ;
eStart, eEnd: integer ;
eInString, eInArray: Boolean ;
2005-11-19 22:46:29 +03:00
begin
2006-01-11 21:02:42 +03:00
Result : = '' ;
eStart : = 1 ;
eEnd : = - 1 ;
eInString : = False ;
eInArray : = False ;
2005-11-19 22:46:29 +03:00
eStr : = frmMain. sciEditor. Lines[ frmMain. sciEditor. GetCurrentLineNumber] ;
2006-01-11 21:02:42 +03:00
eStr : = StringReplace( eStr, '^"' , 'AB' , [ rfReplaceAll] ) ; // we don't need those
if ( Length( eStr) = 0 ) then exit;
for i : = frmMain. sciEditor. GetCaretInLine downto 1 do begin
if eStr[ i] = '"' then
eInString : = not eInString
else if ( eStr[ i] = '{' ) and ( not eInString) then
eInArray : = True
else if ( eStr[ i] = '}' ) and ( not eInString) then
eInArray : = False
else if ( not eInArray) and ( not eInString) and ( eStr[ i] = '(' ) then begin
eEnd : = i- 1 ;
break;
end ;
end ;
if eEnd < > - 1 then begin
for i : = eEnd downto 1 do begin
if eStr[ i] = '"' then
eInString : = not eInString
else if ( eStr[ i] = '{' ) and ( not eInString) then
eInArray : = True
else if ( eStr[ i] = '}' ) and ( not eInString) then
eInArray : = False
else if ( not eInArray) and ( not eInString) and ( eStr[ i] = '(' ) then begin
eStart : = i+ 1 ;
break;
end ;
end ;
end
2005-11-19 22:46:29 +03:00
else
2006-01-11 21:02:42 +03:00
exit;
Result : = Trim( Copy( eStr, eStart, eEnd - eStart + 1 ) ) ;
2005-11-19 22:46:29 +03:00
end ;
2005-08-26 22:29:39 +04:00
end .