Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2010-05

Syntax highlighting question

11 messages · 5 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Graeme Geldenhuys

Hi,

Why is the 'string' type not highlighted in the same color as other types? eg: integer, pointer, boolean etc?
I see this is even done in other editors with type syntax highlighting like Midnight Commander, Cooledit etc.. gEdit being the exception.

Regards, - Graeme - _______________________________________________ fpGUI - a cross-platform Free Pascal GUI toolkit http://opensoft.homeip.net/fpgui/ -------------- next part -------------- A non-text attachment was scrubbed... Name: synatx_highlighting.png Type: image/png Size: 4813 bytes Desc: not available URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20100507/9a1eba33/attachment.png>

Reply by email

Michael Van Canneyt
to Graeme Geldenhuys
Graeme Geldenhuys wrote 6 lines
Hi, Why is the 'string' type not highlighted in the same color as other types? eg: integer, pointer, boolean etc? I see this is even done in other editors with type syntax highlighting like Midnight Commander, Cooledit etc.. gEdit being the exception.

Because 'String' is a keyword, the others are not. Contrary to popular belief, 'Boolean' and 'Integer' are not keywords, they are identifiers.

Michael.

Reply by email

Razvan Adrian Bogdan
to Michael Van Canneyt
Michael Van Canneyt wrote 14 lines
On Fri, 7 May 2010, Graeme Geldenhuys wrote: Hi, > > Why is the 'string' type not highlighted in the same color as other > types? eg: integer, pointer, boolean etc? > I see this is even done in other editors with type syntax highlighting > like Midnight Commander, Cooledit etc.. gEdit being the exception. > Because 'String' is a keyword, the others are not. Contrary to popular belief, 'Boolean' and 'Integer' are not keywords, they are identifiers.

This is exactly why Borland didn't do it but it makes sense to highlight all simple native types and then it would make sense to write them in lowercase but i find it strange and non-standard to write tstringlist or tStringList instead of TStringList, when they are prefixed with a T, no highlighting is needed.

Razvan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20100507/9420531e/attachment-0001.html>

Reply by email

Graeme Geldenhuys
to Michael Van Canneyt: Because 'String' is a keyword, the others are not. Contrary to popular belief, 'Boolean'…
Michael Van Canneyt wrote
Because 'String' is a keyword, the others are not.

So it is. umm... I learnt something new again.

Contrary to popular belief, 'Boolean' and 'Integer' are not keywords, they are identifiers.

How do they (whoever they might be) justify this? All of them are simple/standard types. Plus the following code doesn't compile:

procedure MyProc;
var
  integer: Integer;
begin
  //
end
fails to compile with the following message. Mode objfpc is used.
frm_main.pas(547,19) Error: Error in type definition
Regards, - Graeme - _______________________________________________ fpGUI - a cross-platform Free Pascal GUI toolkit http://opensoft.homeip.net/fpgui/

Reply by email

Graeme Geldenhuys
to Razvan Adrian Bogdan: On Fri, May 7, 2010 at 6:06 AM, Michael Van Canneyt This is exactly why Borland didn't do…

2010/5/7 Razvan Adrian Bogdan :

simple native types and then it would make sense to write them in lowercase but i find it strange and non-standard to write tstringlist or tStringList instead of TStringList, when they are prefixed with a T, no highlighting is

The JCF (Jedi Code Formatter) does this for me. I use the original Windows jcf because the Lazarus included one is not 100% working yet.

Regards, - Graeme - _______________________________________________ fpGUI - a cross-platform Free Pascal GUI toolkit http://opensoft.homeip.net/fpgui/

Reply by email

Florian Klaempfl
to Graeme Geldenhuys: So it is. umm... I learnt something new again. How do they (whoever they might be)…
Show quoted text 21 lines
On 7 May 2010 15:06, Michael Van Canneyt wrote: > Because 'String' is a keyword, the others are not. So it is. umm... I learnt something new again. > Contrary to popular > belief, 'Boolean' and 'Integer' are not keywords, they are identifiers. How do they (whoever they might be) justify this? All of them are simple/standard types. Plus the following code doesn't compile: procedure MyProc; var integer: Integer; begin // end fails to compile with the following message. Mode objfpc is used. frm_main.pas(547,19) Error: Error in type definition
When the : is parsed, integer is already known as variable.
Try
integer : system.integer;

Reply by email

Razvan Adrian Bogdan
to Florian Klaempfl
Florian Klaempfl wrote
When the : is parsed, integer is already known as variable. Try integer : system.integer;

Wow, i never thought this was legal syntax, probably the reason why some people prefer CaseSensitive languages even if the are not a natural way to write anything, the case being used just because it looks nice in natural language and in Pascal.

Razvan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20100507/35beebea/attachment.html>

Reply by email

Graeme Geldenhuys
to Florian Klaempfl: When the : is parsed, integer is already known as variable. Try integer : system.integer;
Florian Klaempfl wrote
When the : is parsed, integer is already known as variable. Try integer : system.integer;

OK, that works. Thanks.

I still can't think why Boolean and Integer are not keywords though. Borland must have been smoking something really strong that day. :)

Regards, - Graeme - _______________________________________________ fpGUI - a cross-platform Free Pascal GUI toolkit http://opensoft.homeip.net/fpgui/

Reply by email

Florian Klaempfl
to Graeme Geldenhuys
Show quoted text 8 lines
On 7 May 2010 15:30, Florian Klaempfl wrote: > When the : is parsed, integer is already known as variable. > Try > integer : system.integer; OK, that works. Thanks. I still can't think why Boolean and Integer are not keywords though.

If they were keywords, something like system.integer wouldn't be possible. The question is wrong btw: you've to ask why string is a keyword. And this can be answered: when using it to defined shortstrings with a given length (string[123]), it's more logical to consider string as keyword instead of a identifier.

Borland must have been smoking something really strong that day. :)

No. This was Nikolas Wirth :)

Reply by email

Justin Smyth
to Graeme Geldenhuys: OK, that works. Thanks. I still can't think why Boolean and Integer are not keywords…

Guys now that under win32 the issues with SendMessage & PostMessage have been fixed under win64 i have a question to ask

I have an application that i will need to send messages with payloads between the application and other applications ( some Located on the same pc and the other being located on another pc on the network ).

I was tinkering with the idea to use a named pipe to send data between my application and the remote end ( sometimes on the local pc , sometimes on another pc ) and also to send information between my application and a deskband object dll ( toolbar application thats run from a explorer thread that hosts things like the start button ).

Basically i would be sending a message between my application and another instance of my application ( could be local or remote ) to tell the Application to do something like stop , shutdown or process a new file ( and that filename would be part of the message - hence maybe with a namedpipe i might end up with different message sizes )

Would this be an issue on a namedpipe ? ie when in messagemode can one send different size messages into the pipe ? or would this not work ?

i only am considering this since if i dont use a named pipe i would need to write the code twice and have one set to use the sendmessage/postmessage for a local connection and another section of code to get to a remote pc ( using tcpip ).

I've allready code some code that uses a namedpipe working to comunicate between the application and another instance on the same pc but havent got around to doing so for the something like a deskband object yet.

Any ideas welcome , as i am just asking to clarify which would be the better one to use.

Delphian

Reply by email

Razvan Adrian Bogdan
to Justin Smyth
Justin Smyth wrote 35 lines
Guys now that under win32 the issues with SendMessage & PostMessage have been fixed under win64 i have a question to ask I have an application that i will need to send messages with payloads between the application and other applications ( some Located on the same pc and the other being located on another pc on the network ). I was tinkering with the idea to use a named pipe to send data between my application and the remote end ( sometimes on the local pc , sometimes on another pc ) and also to send information between my application and a deskband object dll ( toolbar application thats run from a explorer thread that hosts things like the start button ). Basically i would be sending a message between my application and another instance of my application ( could be local or remote ) to tell the Application to do something like stop , shutdown or process a new file ( and that filename would be part of the message - hence maybe with a namedpipe i might end up with different message sizes ) Would this be an issue on a namedpipe ? ie when in messagemode can one send different size messages into the pipe ? or would this not work ? i only am considering this since if i dont use a named pipe i would need to write the code twice and have one set to use the sendmessage/postmessage for a local connection and another section of code to get to a remote pc ( using tcpip ). I've allready code some code that uses a namedpipe working to comunicate between the application and another instance on the same pc but havent got around to doing so for the something like a deskband object yet. Any ideas welcome , as i am just asking to clarify which would be the better one to use.

For local communication i think there is a SimpleIPC implementation done in a CrossPlatform way, if you don't need extreme performance you could use TCP for everything maybe with Synapse/Indy, i used Indy a lot with Delphi, it's powerful and fast enough but quite large, i used Synapse only as a client and i'm not sure if it's slower than Indy, never used Named Pipes so i can't comment about their performance but i understand that they are not the same on every platform but maybe someone found a way to abstract them ?

Razvan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20100513/3cefd5cb/attachment.html>

Reply by email