View Issue Details

IDProjectCategoryView StatusLast Update
0034277FPCUtilitiespublic2019-01-11 15:47
Reporterhellotiger Assigned ToMichael Van Canneyt  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version3.0.4 
Target Version3.2.0Fixed in Version3.3.1 
Summary0034277: ptop put operators on different lines
DescriptionWhen ptop indents too much, it puts the rest of a line on different lines, each with one token. Operators like <> and <= are put on different lines, causing a compilation failure.
Steps To ReproduceCopy test.p.
fpc test.p (Success)
ptop test.p test2.p
fpc test2.p (Failure)

Error messages:
Compiling test2.p
test2.p(11,98) Error: Illegal expression
test2.p(11,100) Fatal: Syntax error, "THEN" expected but "ordinal const" found
Fatal: Compilation aborted
Error: /usr/bin/ppcx64 returned an error exitcode
TagsNo tags attached.
Fixed in Revision40803
FPCOldBugId
FPCTarget
Attached Files

Activities

hellotiger

2018-09-13 21:37

reporter  

test.p (193 bytes)

Bart Broersma

2018-09-15 17:11

reporter  

ptop.diff (1,490 bytes)   
Index: utils/ptopu.pp
===================================================================
--- utils/ptopu.pp	(revision 39352)
+++ utils/ptopu.pp	(working copy)
@@ -72,7 +72,7 @@
                notsym,nilsym,orsym,setsym,tosym,virtualsym,usessym,
                casevarsym,ofobjectsym,
                { other symbols }
-               becomes,delphicomment,dopencomment,dclosecomment,opencomment,closecomment,semicolon,colon,equals,
+               becomes,notequal,delphicomment,dopencomment,dclosecomment,opencomment,closecomment,semicolon,colon,equals,
                openparen,closeparen,period,endoffile,othersym);
 
   { Formatting options }
@@ -252,7 +252,7 @@
                'and','arr','div','down','file','goto',
                'in','mod','not','nil','or','set','to','virtual','uses',
                'casevar','ofobject',
-               'becomes','delphicomment','dopencomment','dclosecomment',
+               'becomes','notequal','delphicomment','dopencomment','dclosecomment',
                'opencomment','closecomment','semicolon',
                'colon','equals',
                'openparen','closeparen','period','endoffile','other');
@@ -265,7 +265,7 @@
 
 
   DblChar : DblCharTable =
-     ( ':=', '//','(*','*)' );
+     ( ':=', '<>', '//','(*','*)' );
 
   SglChar : SglCharTable =
     ('{', '}', ';', ':', '=', '(', ')', '.' );
@@ -1411,5 +1411,5 @@
 
 
 Begin
-  dblch := [becomes, opencomment];
+  dblch := [becomes, notequal, opencomment];
 end.
ptop.diff (1,490 bytes)   

Bart Broersma

2018-09-15 17:12

reporter   ~0110766

Possible patch attached.
Please review. It's hard to follow the code flow of ptop.
Attached sample project at least compiles after conversion with this patch.

Bart Broersma

2018-09-15 17:17

reporter   ~0110767

Last edited: 2018-09-15 17:17

View 3 revisions

B.t.w. if compiled with heaptrace and tested with the attached sample program:

Heap dump by heaptrc unit
1032 memory blocks allocated : 204622/206968
870 memory blocks freed : 189534/191872
162 unfreed memory blocks : 15088

delfion

2018-09-15 18:19

reporter   ~0110771

Handle <= and >= too.

Bart Broersma

2018-09-15 21:07

reporter  

ptop3.diff (1,590 bytes)   
Index: utils/ptopu.pp
===================================================================
--- utils/ptopu.pp	(revision 39352)
+++ utils/ptopu.pp	(working copy)
@@ -72,7 +72,7 @@
                notsym,nilsym,orsym,setsym,tosym,virtualsym,usessym,
                casevarsym,ofobjectsym,
                { other symbols }
-               becomes,delphicomment,dopencomment,dclosecomment,opencomment,closecomment,semicolon,colon,equals,
+               becomes,notequal,lessorequal,greaterorequal,delphicomment,dopencomment,dclosecomment,opencomment,closecomment,semicolon,colon,equals,
                openparen,closeparen,period,endoffile,othersym);
 
   { Formatting options }
@@ -252,7 +252,7 @@
                'and','arr','div','down','file','goto',
                'in','mod','not','nil','or','set','to','virtual','uses',
                'casevar','ofobject',
-               'becomes','delphicomment','dopencomment','dclosecomment',
+               'becomes','notequal','lessorequal','greaterorequal','delphicomment','dopencomment','dclosecomment',
                'opencomment','closecomment','semicolon',
                'colon','equals',
                'openparen','closeparen','period','endoffile','other');
@@ -265,7 +265,7 @@
 
 
   DblChar : DblCharTable =
-     ( ':=', '//','(*','*)' );
+     ( ':=', '<>', '<=', '>=',  '//','(*','*)' );
 
   SglChar : SglCharTable =
     ('{', '}', ';', ':', '=', '(', ')', '.' );
@@ -1411,5 +1411,5 @@
 
 
 Begin
-  dblch := [becomes, opencomment];
+  dblch := [becomes, notequal, lessorequal, greaterorequal, opencomment];
 end.
ptop3.diff (1,590 bytes)   

Bart Broersma

2018-09-15 21:08

reporter   ~0110774

ptop3.diff also handles <= and >=.
Please test.
@devels: please review.

Bart Broersma

2019-01-07 12:51

reporter   ~0113233

Some sort of feedback would be nice.

Michael Van Canneyt

2019-01-08 03:56

administrator   ~0113253

Applied third patch, thanks for looking into this.

If no-one replies, feel free to mail on mailing list.
I simply didn't see this bug report.

hellotiger

2019-01-11 15:47

reporter   ~0113330

Tested <=, <=, and <> with the ptop3.diff patch. It solves the problem. Thanks!

Issue History

Date Modified Username Field Change
2018-09-13 21:37 hellotiger New Issue
2018-09-13 21:37 hellotiger File Added: test.p
2018-09-15 17:11 Bart Broersma File Added: ptop.diff
2018-09-15 17:12 Bart Broersma Note Added: 0110766
2018-09-15 17:17 Bart Broersma Note Added: 0110767
2018-09-15 17:17 Bart Broersma Note Edited: 0110767 View Revisions
2018-09-15 17:17 Bart Broersma Note Edited: 0110767 View Revisions
2018-09-15 18:19 delfion Note Added: 0110771
2018-09-15 21:07 Bart Broersma File Added: ptop3.diff
2018-09-15 21:08 Bart Broersma Note Added: 0110774
2019-01-07 12:51 Bart Broersma Note Added: 0113233
2019-01-08 03:52 Michael Van Canneyt Assigned To => Michael Van Canneyt
2019-01-08 03:52 Michael Van Canneyt Status new => assigned
2019-01-08 03:56 Michael Van Canneyt Fixed in Revision => 40803
2019-01-08 03:56 Michael Van Canneyt Note Added: 0113253
2019-01-08 03:56 Michael Van Canneyt Status assigned => resolved
2019-01-08 03:56 Michael Van Canneyt Fixed in Version => 3.3.1
2019-01-08 03:56 Michael Van Canneyt Resolution open => fixed
2019-01-08 03:56 Michael Van Canneyt Target Version => 3.2.0
2019-01-11 15:47 hellotiger Note Added: 0113330
2019-01-11 15:47 hellotiger Status resolved => closed