Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - jnavr

Pages: [1]
1
General Board / Re: Parsing Problems
« on: February 14, 2006, 06:53:16 am »
Hi,
I experienced similar errors while importing Delphi code with curly braces (posted just today in General Board). As a workaround, try to add // on the affected lines wherever possible.

I have already reported this problem to Sparx as a bug.

Some examples of code that lead to parse errors:

{$IFDEF MGR}
{$DEFINE NOMACRO}
//parse error:
{$ENDIF}

//parse error:
{$MINENUMSIZE 4}

//parse error, very strange:
{ord()}

//parse error:
const ver = {$I ver.pas};

2
General Board / Bugs in parsing Delphi code
« on: February 14, 2006, 12:50:38 am »
I have found another parser bugs in EA when I tried to import a large Delphi project into EA (the latest build 786). I am pleased that this build addresses the parse error bug caused by a property declaration using qualified structure members names.

Sometimes there is a workaround - to break the declaration into two or three simpler declarations (e.g. declarations of arrays of initialized structures). The {$} directives errors are especially very annoying.

1) The keyword "stdcall" causes a parse error in type declaration, while the same clause is accepted in a function declaration:

//parse error:
type
 TCrHndlFunc = function (DrvName, DevName, Output: PChar;
   InitData: PDevMode): HDC stdcall;

//OK:
function LongMulDiv(Mult1, Mult2, Div1: Longint): Longint; stdcall;
 external 'kernel32.dll' name 'MulDiv';

//OK, as well:
function AbortProc(Prn: HDC; Err: Integer): Boolean; stdcall;
begin
 ...
end;


2) Type or const declarations that include multiple initialization values cause a parse error:

//parse error:
type
 TCodePage = ('ISO-8859-1', 'ISO-8859-2', 'windows-1252', 'windows-1250');

const
 Functions: array [1..FuncCount] of record ID,Params: string end = (
      (ID: '555,0'; Params: '0=0,0;1=1,0;2=0,1;3=1,1'));


3) Variant parts in record declaration (using case ... of ...) also cause an error:

//parse error:
type
 PSockAddrIn = ^TSockAddrIn;
 sockaddr_in = record
   sin_family: u_short;
   case Integer of
     0: (sin_family: u_short;
         sin_port: u_short;
         sin_addr: TInAddr;
         sin_zero: array[0..7] of Char);
     1: (sa_family: u_short;
         sa_data: array[0..13] of Char)
 end;
 TSockAddrIn = sockaddr_in;


4) Some {$...} directives make parse errors:

{$IFDEF MGR}
{$DEFINE NOMACRO}
//parse error:
{$ENDIF}

//parse error:
{$MINENUMSIZE 4}

//parse error, very strange:
{ord()}

//parse error:
const ver = {$I ver.pas};


3
General Board / Re: Crash parsing Delphi properties
« on: January 13, 2006, 12:10:03 am »
Thanks.

4
General Board / Crash parsing Delphi properties
« on: January 12, 2006, 12:21:39 am »
Hi.

I tried to import a Delphi unit containing properties stored in a structure, something like this:

   property LinkValue : String read FDBTNStruct.LinkValue write FDBTNStruct.LinkValue;

EA crashes parsing that line. If this line is removed from the source file, it is successfully parsed. Even the latest build experiences this issue.

It seems that this bug is new to version 6.0, it was encountered on builds 781 and 778. An older build 5.00.768 parses the same unit successfully.

Pages: [1]