Forum > Editor

Possible syntax highlighting bug

(1/4) > >>

440bx:

Lazarus v3.4 (latest release) 64 bit on Win7 SP1

Consider the following simple program:
--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---{$APPTYPE CONSOLE} program _SyntaxHighlighting; uses  Windows  ; var  Offset : DWORD; begin  Offset := ptruint(                    @TIMAGE_LOAD_CONFIG_DIRECTORY32(nil^).SeHandlerTable                   );    readln;end.           Refer to the attachment to see the color mismatch.

Notice the color of the typecast's close parenthesis does not match the color of the open parenthesis.  Normally all the parentheses are the same color.

Comments welcome.

Martin_fr:
I like your wording "possible..." => leaves me the option to declare it a feature and walk away. ;)

It looks like it thinks it is a string. The following prints a tab-char ("i" is the 9th char)

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---writeln('a'^i'b');
But why it does that with a closing bracket.... That shouldn't happen.

There are known cases where the HL currently can not distinguish between (nested types/const in structures...)

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---type I = integer; PI = ^I; // a pointer type// ORconst Tab = ^I; // a char constant

Martin_fr:
Ok, I thought it would be A-Z, but this compiles:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---writeln( ^) );

Martin_fr:
fixed

440bx:
Hello Martin,


--- Quote from: Martin_fr on July 19, 2024, 11:15:20 am ---fixed

--- End quote ---
That was quick. :) Should I still report it as a bug ? or forget it since it is already fixed ?


--- Quote from: Martin_fr on July 19, 2024, 10:58:13 am ---Ok, I thought it would be A-Z, but this compiles:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---writeln( ^) );
--- End quote ---
To my surprise it does compile and outputs "i".  Isn't that a compiler bug ?  "^)" doesn't look like a valid writeln argument... am I missing something ?

Navigation

[0] Message Index

[#] Next page

Go to full version