Forum > Editor
Possible syntax highlighting bug
Martin_fr:
--- Quote from: 440bx on July 19, 2024, 02:16:34 pm ---
--- Quote from: Martin_fr on July 19, 2024, 10:58:13 am ---
--- 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 ?
--- End quote ---
Trip down memory lane tells me I have seen it documented. But I couldn't find it now.
It is basically a syntax for Control characters. Such as the commonly seen ^C for Ctrl-C which produces the old ASCII #03 (C being the 3rd char), if you prevent the signal.
I don't know about it taking "char"s outside the a..z / A..Z range. No idea if that is a feature. Well, there is the fact that ctrl chars go from #01 to #31 => and a..z goes from 1 to 26.
TRon:
--- Quote from: Martin_fr on July 19, 2024, 03:56:51 pm ---Trip down memory lane tells me I have seen it documented. But I couldn't find it now.
--- End quote ---
Me neither in modern documentation (I am sure it is there but today is bleh)
Turbo pascal manual:
--- Quote ---TURBO Pascal also allows control characters to be embedded in strings. Two
notations for control characters are supported: 1) The # symbol followed by
an integer constant in the range 0 .. 255 denotes a character of the corre-
sponding ASCII value, and 2) the ^ symbol followed by a character, denotes
the corresponding control character.
Sequences of control characters may be concatenated into strings by writing
them without separators between the individual characters::
--- End quote ---
440bx:
I know/remember that the "^" followed by a character is interpreted as a control character identifier _but_ there is no "^)". IOW, there is no control character (or plain character) identified by "^)".
Attached to this post is a snapshot that shows the known/accepted control characters and "^(" is not in the list.
I believe that FPC's acceptance of "^(" is a bug. whatever "^(" may be, it certainly isn't the character "i" (which is what it outputs.) I believe it should issue an error upon encountering an invalid character after the "^".
TRon:
--- Quote from: 440bx on July 19, 2024, 04:33:51 pm ---I know/remember that the "^" followed by a character is interpreted as a control character identifier _but_ there is no "^)". IOW, there is no control character (or plain character) identified by "^)".
--- End quote ---
Ah ok.
In that case I misunderstood your question. Sorry for that because afaik you are right.
Control characters live in the 0..31 range (except of 32 and 127) and the c1 control characters are in the range 128..159.
440bx:
--- Quote from: TRon on July 19, 2024, 04:42:00 pm ---In that case I misunderstood your question. Sorry for that because afaik you are right.
--- End quote ---
No problem.
I use that little table in the snapshot somewhat often (it's part of the editor I use), that's why the "^(" immediately raised a red flag in my mind. I knew there was no such thing as a "^(" control/"or otherwise" character.
Hopefully an FPC developer will see this thread/posts and emit an opinion.
Navigation
[0] Message Index
[#] Next page
[*] Previous page